title: pages meta box - get_categories dropdown

text:
I created a meta box with a dropdown list which consists of all existing categories. The administrator of the page should be able to choose one of the categories out of the dropdown list which will be saved by the save/update page function of wordpress.               <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>       <option value=""><?php echo esc_attr(__('Select Event')); ?></option>       <?php        $categories=  get_categories('child_of=10');        foreach ($categories as $category) {         $option = '<option value="/category/archives/'.$category->category_nicename.'">';         $option .= $category->cat_name;         $option .= ' ('.$category->category_count.')';         $option .= '</option>';         echo $option;       }      ?>     </select>      I have absolutely no idea how to work with the selected list item without redirecting to another page like "action=bla.php"?! In the past I worked with simple imput fields which can be saved by the update/save page function but how can this be done with a dropdown list? Here's the complete code:               <?php     /*     Plugin Name: myname » Membership     Plugin URI: http://www.myname.com     Description: Das membership Plugin.     Author: myname     Version: 2     Author URI: http://www.myname.com     */          add_action( 'add_meta_boxes', 'membership_meta_box_add' );          function membership_meta_box_add() {     /*       * add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args );      * id = unique identifier for css or javascript      * title = displayed at the top of the meta box      * callback = function which renders the meta box      * page = will be displayed on "post", "page" or "some_custom_post_type"      * context = where to place the box: "normal" (below the editor), "side" and "advanced" (column of post editor but further down)      * priority = from top to bottom: "high", "default", "low"      * callback_args = will the disregard by us      */              add_meta_box( 'myname_membership_box_id', 'myname Membership Einstellungen', 'membership_meta_box_cb', 'page', 'normal', 'high' );      }          function membership_meta_box_cb($post) {                // $post is already set, and contains an object: the WordPress post         $values = get_post_custom( $post->ID );              /***************************************************          *              Einlesen der bereits gespeicherten Variablen          ***************************************************/              $membership_premium_category = isset( $values['membership_premium_category'] ) ? esc_attr($values['membership_premium_category'][0]) : '';                // We'll use this nonce field later on when saving.         wp_nonce_field( 'membership_meta_box_ms_nonce', 'meta_box_ms_nonce' );              /***************************************************          *              Konfiguration der Stylesheets          ***************************************************/        ?>                       <?         /***************************************************          *              Aufbau der Eingabefelder          ***************************************************/            ?>
Hier finden Sie alle verfügbaren Einstellungsmöglichkeiten für die Membership Site.

Kategorie für Membership Artikel

dev: "membership_premium_category"
                 <input type="text" class="membership-box-field" name="membership_premium_category" id="membership_premium_category" value="<?php echo $membership_premium_category; ?>" />
Bitte tragen Sie hier den Namen (nicht Slug/Titelform) der obersten Kategorie aller Premium Artikel ein. Diese Eingabe ist notwendig.

                       <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>              <option value=""><?php echo esc_attr(__('Select Event')); ?></option>              <?php              $categories=  get_categories('child_of=10');              foreach ($categories as $category) {                 $option = '<option value="/category/archives/'.$category->category_nicename.'">';                 $option .= $category->cat_name;                 $option .= ' ('.$category->category_count.')';                 $option .= '</option>';                 echo $option;             }             ?>         </select>                   <?php     }               /***************************************************          *              Speicherfunktion des Plugins          ***************************************************/          add_action( 'save_post', 'membership_meta_box_save' );          function membership_meta_box_save( $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_ms_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_ms_nonce'], 'membership_meta_box_ms_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post' ) ) return;                // now we can actually save the data           $allowed = array('a' => array( 'href' => array()),                                 'object' => '',                                 'iframe' => array( 'width' => array(), 'height' => array(), 'src' => array(), 'frameborder' => array(), 'allowfullscreen' => array())           );                /***************************************************          *              Speicherung der einzelnen oben definierten Felder          ***************************************************/              // Make sure your data is set before trying to save it         if( isset( $_POST['membership_premium_category'] ) )             update_post_meta( $post_id, 'membership_premium_category', wp_kses( $_POST['membership_premium_category'] ) );     }      ?>


title: Custom Post Type Category List & Post Count

text:
I'm looking for Cutom Post Type Category List & Post Count. Here is my code..                           <?php                 $taxonomy = 'project-tags';                 $tax_terms = get_terms($taxonomy);                 ?>                      <?php                 foreach ($tax_terms as $tax_term) {                 echo '
' . 'name ) . '" ' . '>' . $tax_term->name.''. $show_count. '
';                 }?>       This code works perfect for getting categories under my custom post type. But How do I get number of post count per category ?


title: How to Replace YouTube Videos with a "Click to Play" Thumbnail?

text: I use a lot of embedded videos (via `oembed`) on my blog, and that can slow down page loads. Is there a way to automatically replace YouTube (and other) videos with a thumbnail (preferably the post's featured image). And then replace the thumbnail with the video iframe when clicked?


How can I sort posts ascending by post title for a specific post type, but on a category archive template? My schema involves a "video" custom post type and multiple subcategories of the aforementioned post type. I am using the Custom Content Type Manager plugin. How can I implement this?


title: Fetch array with $wpdb

text: I am trying to convert this code to use the $wpdb.               $data = array();          $query = "SELECT * FROM videos";     $query_exec = mysql_query($query) or die();          while($row = mysql_fetch_array($query_exec)) {         if ( $row['video'] == "http://youtu.be/".end(explode('http://youtu.be/',$row['video'])) ) {                 $data[$row['id']] = end(explode('http://youtu.be/', $row['video']));             } else {                 $data[$row['id']] = end(explode('?v=', $row['video']));             }            }      So I did:               $query = $wpdb->get_results("SELECT * FROM videos");      But how can I fetch the array? Thank you in advance for the help.


title: If contributor has published 2 or more posts then show otherwise hide

text: If the contributor has already published two or more posts I show a maximum of 5 of them in the post-single.php using this code               <?php echo do_shortcode('[latestbyauthor show="5"]'); ?>      I have a text that introduces the code (other posts by the same author) This works fine if the contributor really has published 2 or more article but totally uselless if he has just one post. What I'm looking is a way to hide the text before the code by checking the total number of posts published, if 1 then hide and if 2 then show. Is it possible? Thanks!


title: Sharing Buttons not Working - Sharing Settings

text: I'm trying to add a "share this" button to my site. I am having an issue configure this because when I go to settings -> sharing I get the image below![enter image description here](http://i.stack.imgur.com/CXS2W.png) Update: Here is my inspector error console:![enter image description here](http://i.stack.imgur.com/nNQJ5.png)               Uncaught SyntaxError: Unexpected token < /?ver=2:1     Uncaught SyntaxError: Unexpected token < /?ver=3:1     JQMIGRATE: Logging is active s0.wp.com/:9823


title: Show menu on page with all sub-pages and sub-sub-pages of that page

text: I am trying to create a menu, with sub-pages and sub-sub-pages of a current page. I want the menu to work as a dropdown, where the sub-sub-pages for a sub-pages are shown when the user clicks the sub-page, and hidden again if the user clicks on the sub-page a second time. So it is important that the sub-pages in the menu are not links. I need to show the same menu, no matter how deep in the sub pages the user is at. Can anyone help? :)


title: WordPress Custom Fields (Checkboxes with multiple values)

text:
I am currently using a custom post type, with a custom field that is a checkbox. There are multiple values in the checkbox including: Laptop, New, No-Marketing-text and several more. If No-marketing-text is the only one selected, it has no problem with doing what I want it to do. If multiple checkboxes are selected, it only looks at the first one that is selected. What should I change to make it work even if multiple checkboxes are selected?               <?php                //REMOVES BACK TO TOP BUTTON FOR PROGRAMS THAT HAVE NO MARKETING BLURB - JUNE 27, 2013 - Brandon Carson              if("No-marketing-text" == get_post_meta($post->ID, 'program_flags', true)){                      echo "";                  }else{                 echo "
";                      the_content();                  echo "Back to Top
";                       }              ?>


title: WordPress - Retrieve a Page if it's a direct descendant of another Page

text:
I have this piece of code that works great: it retrieves a particular page from my WordPress database so I can wrap custom code around it in a template. In the instance below it grabs the page called Showreel:                       <?php             $page = get_page_by_title('Showreel');             ?>                       <?php                  $my_id = $page;                  $post_id = get_post($my_id, ARRAY_A);                  $title = $post_id['post_title'];                  $content = $post_id['post_content'];             ?>
<?php echo $title;?>
                                    <?php                  echo $content             ?>      However, I have conundrum - I have some pages that do not have unique names. How can I retrieve a page only if it is a direct descendant of a certain parent e.g. I would like to retrieve a page under Showreel called _The Ruth Rendell Mysteries_. My initial thought was that the code below would work, but it doesn't.                       <?php             $page = get_page_by_title('Showreel->The Ruth Rendell Mysteries');             ?>


title: Capability to read/edit page in wp-admin only for administrators

text: I want to create a page which is only for editable and readable (within wp- admin) for administrators. To restrict other users to edit any page (and not only the own ones) is not the solution as I want them to have this capability. I am using the plugin called "Access" by wp-types.


title: One time login on 2 different Wordpress sites

text: Im trying to figure out how to login one time to mydomain.com and being automatically loged in to mydomain.com/blog . I have figured out how to share tables (so that the same users on my main site, are also on the blog site) through MyPHPAdmin. I was hoping in this manner, I wouldn't have to use WPMU. Any advice, or links would be GREATLY appreciated. Im currently using version 3.8.1


title: Cannot use existing image as a featured image since 3.8.1 update

text: Since the 3.8.1 update i have been unable to use an existing image in my media galley as a featured image thumbnail on my blog. I have to manually download, change the name, and re-upload the file in order to use it as a featured image. Is this some type of corruption in the database? I'm going a bit bonkers trying to find the solution. Any help much appreciated. Thanks


title: wp pagenavi not working with category id

text: Can someone let me know i am using wp pagenavi wordpress plugin http://renegadehealth.com/blog/?cat=6708 When i click on the next button at the bottom the following link comes:- http://renegadehealth.com/blog/blog/index.php?cat=6708&paged=2 an extra "blog/blog/" is being added


title: WPDB update is not working for tables with large number of columns

text: I am using a form to update a cutom WP datatable. The update function is working fine for all the table except one which have 14columns. I can delete the rows but can't edit any entries. For edit I am using:               $wpdb->update($mysql_table_name, $formdata, array($id_key => $id_val));      For delete:               $wpdb->delete($mysql_table_name, array($id_key => $id_val));


title: Get post related on category

text: it's a catalog website for different product. I need a function that will get the category of the selected product, and get all the product from that category Let see an example. A table, is in wood category and kitchen. So when display table, under the table i like all the other kitchen product listed as well as all the other wood product... it good for cross selling !... how do i do that ?


title: Add custom taxonomy to title tag

text: I'm using Yoast's WordPress SEO plugin for a variety of websites. In setting title tag templates with his `%%category%%` syntax, I've figured out that you can reference custom fields by using `%%cf_<custom_field_name>%%`. What I haven't been able to figure out is how to reference custom taxonomies. Within a custom post type, I have a category that I want to reference (i.e. `customcategory`). If I try adding `%%customcategory%%`, it doesn't work. Does anyone know if this is possible with the WordPress SEO plugin or point me in the right direction if I need to add a function to work with the plugin?


title: Woocommerce product page is not showing custom css

text: I am using woocommerce plugin for wordpress to make an eCommerce website. It is working fine with little bit customization. As I have configured shop page as the default product page so that in that page every product can be seen and a user can buy product from that page. But now I want to use some highlights image for special discount on that item and I just placed all that item just over the products page by posting images in that page. But in order to style that images I used WordPress Page Specific CSS Plugin to write some custom css, but it is strange that in that particular page custom css is not working. Can somebody tell me why this is happening and how to solve this? Any help and suggestions are welcome :)


title: How do I modify this page template to show subpage excerpts (not post excerpts)?

text:
I have made a page template which shows linked subpages using this bit of code:               <?php             $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'sort_or                  foreach( $mypages as $page ) {                     $content = $page->post_content;                     if ( ! $content ) // Check for empty page                             continue;                          $content = apply_filters( 'the_content', $content );     ?>
<a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?><
<?php echo $content; ?>
     <?php     }     ?>      I got the code from here and have changed it to order subpages in the order of their Page Order. It works, but it displays the full pages' contents. I only want it to show page excerpts, with the featured image. (I have enabled page excerpts in the editor by adding `add_post_type_support( 'page', 'excerpt' );` to functions.php) How do I modify this page template to show subpage excerpts?


title: WordPress fetches the archive page instead of my custom template

text:
I'm using WooCommerce and it created a page called "Shop" which I've attributed to my custom template "Store" through the "page attributes" module in the dashboard.               <?php     /*     Template Name: Store     */     ?>                  <?php get_header();?>
                          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                                                                           <article id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                                 <?php the_content(); ?>

                          <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                          <?php endif; ?>
                  <?php get_footer(); ?>      However, for some reason, WordPress keeps fetching the `archive` page instead of my custom Store page. This is what the `body` class looks like: `<body class="archive post-type- archive post-type-archive-product logged-in woocommerce woocommerce-page infinite-scroll neverending">` I'm aware of the issue that the slug cannot match a custom post type with the same name and I've made sure of that. I don't have any custom post types at all. I've double-checked this by changing the name of the page slug and the custom template to something random and still WordPress pulls the `archive` page. What could be causing this issue?


title: Display images in attched gallery of custom post type

text:
i have a custom post type-> events. I have a gallery page in which the featured image from a custom post is used as album cover . Now when a person clicks on the album cover i.e featured image , i want to display images in attached gallery in the post. I have been using the following code to display the featured images in the main gallery page .But how do i show the rest of the images of the post. Please help me out.                <?php $paged= (get_query_var('paged' )) ? get_query_var('paged'):1; ?>                         <?php $args = array( 'post_type'=>'events',                                              'posts_per_page' => 100 ,                                              'paged'=>$paged                                            );                              $loop = new WP_Query( $args );                         if($loop->have_posts()):while ( $loop->have_posts() ) : $loop->the_post();                                ?>                              <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array(225,225) ); ?>                         <?php if(!$image) :continue; else:?>

                                                 <img class="img-responsive" src="<?php echo $image[0]; ?>" alt="" />

<?php the_title(); ?>

                              <?php endif; ?>                           <?php endwhile;endif; ?>       If i take the featured image in the anchor tag with href="the_permalink" then it takes me to the template single-events.php which is having a lot of infomation . How do i display only the images in the attached gallery Any hint will be really helpful and appreciable


title: How to add “Check all” to Edit post page in WP?

text: I want to add a checkbox to Edit Post page in Wordpress admin and clicking on that checkbox should select all categories How can I do that? Image description bellow... ![enter image description here](http://i.stack.imgur.com/940I5.jpg)


title: No filter of code on switch from html to visual editor, how?

text: _Yes, i have found other questions to this topic, but no have the same topic exactly and no solution for my problem._ If you include code inside the html-tab and you switch to the visual mode, then format WP the code to a block, remove all breaks and leave lines, see the screenshots. I think this easier to understand as my bad english. **my example in html-tab** ![enter image description here](http://i.stack.imgur.com/i9lSn.png) **the same example after switch to visual** ![enter image description here](http://i.stack.imgur.com/sH1VQ.png) My tests for an solution. i have test this to stop WP for this with the follow test plugin, also readable in this Gist 1663554               add_filter( 'tiny_mce_before_init', 'fb_tinymce', 9 );          function fb_tinymce( $init ) {              $init['fix_list_elements'] = FALSE;         $init['wpautop'] = FALSE;         $init['remove_linebreaks'] = FALSE;         $init['apply_source_formatting'] = TRUE;         $init['extended_valid_elements'] .= ',pre[*],code[*]';              return $init;     }      Maybe an other reader has an solution for this topic.


title: XML RPC post produces immediate revision with odd post_date_gmt

text: I am sending a post to Wordpress 3.8 with XML RPC. Here is the raw XML being sent to wordpress:               <?xml version="1.0" encoding="UTF-8"?>     <methodCall>        <methodName>wp.newPost</methodName>        <params>           <param>              <value>                 <int>0</int>              </value>           </param>           <param>              <value>                 <string>admin</string>              </value>           </param>           <param>              <value>                 <string>password</string>              </value>           </param>           <param>              <value>                 <struct>                    <member>                       <name>post_status</name>                       <value>                          <string>publish</string>                       </value>                    </member>                    <member>                       <name>post_title</name>                       <value>                          <string>test 0.762719240039587</string>                       </value>                    </member>                    <member>                       <name>post_content</name>                       <value>                          <dateTime.iso8601>20140111T20:39:15</dateTime.iso8601>                       </value>                    </member>                    <member>                       <name>post_date</name>                       <value>                          <dateTime.iso8601>20140111T20:39:15</dateTime.iso8601>                       </value>                    </member>                    <member>                       <name>terms_names</name>                       <value>                          <struct>                             <member>                                <name>category</name>                                <value>                                   <array>                                      <data>                                         <value>                                            <string>test</string>                                         </value>                                      </data>                                   </array>                                </value>                             </member>                          </struct>                       </value>                    </member>                 </struct>              </value>           </param>        </params>     </methodCall>      Seems ok. The Date is being sent with the correct UTC (the post was made at 14:39 Chicago time, -6 GMT) time and I get a post ID back (in this case 28062). Groovy. Taking a look at it in phpMyAdmin the results go a bit weird. ![phpMyAdmin Results](http://i.stack.imgur.com/gSsoO.png) ID #28063 has the correct timestamp on post_date_gmt, but the parent (28062), has a date that is 12 hours out from the date that was sent. Double the correct GMT offset. What is going on here?


title: Add a class to post_class if more than one post shares same meta_value_num

text: I would like to be able to add a class such as `.samedate` to posts that share the same `meta_value_num` from a custom meta box. So for example:   Say two posts share the same custom meta box value for a date entered as `2013/11/03`... If those two posts have the same meta value number, then add the class to those posts.


title: Wordpress Permlinks 404 Not Found

text: I have installed the latest WordPress on my EC2 Ubuntu 13.1 server. Once I have changed the permalink to use `/%post-name%/`, I encounter 404 not found for posts. I have followed almost everything here in this article (Page Not Found - Permalink WordPress -- FelfelWorld.com), but still having the issue. FYI, I remember I did disable the directory listing for my apache server using SELinux (if I remember it correctly)


title: Password Protected Page Redirects To Dashboard on Submit

text: I am trying to use the built in post/page password protection feature on Wordpress 3.4. However, on the password protected page when you click submit, you are taken to the wp-login page or dashboard, not the actual page. I've updated the functions.php to include the most recent code from the codex, specifically: `$o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">` I've also tried setting the permalink to default and back to custom, clearing page & browser caches, and deleting/rebuilidng the .htaccess, and NOTHING has worked. Can anyone assist in this matter? I'm utterly stumped at this point : \ Thanks in advance! Full Code:               // Change Password Required Style     function matrix_password_form() {         global $post;         $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );         $o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">         <p>' . __( "This post is password protected. To view it please enter your password below:", 'matrix' ) . '</p>         <label class="pass-label" for="' . $label . '">' . __( "PASSWORD:", 'matrix' ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" class="input-field"/><input type="submit" name="Submit" class="submit-button" value="' . esc_attr__( "Submit" ) . '" />         </form>         ';         return $o;     }     add_filter( 'the_password_form', 'matrix_password_form' );


title: right_now_content_table_end function not working?

text: I noticed recently my custom counts for custom post types are not showing on the dashboard. Im using this function: right_now_content_table_end It worked well before, Im not sure when it stopped working but I think after updating to 3.8? Or is there a new function I should use with the new dashboard that is in 3.8? Thanks in advance.


title: get_permalink returning first letter

text: I'm trying to use an ajax function in my custom template to retrieve a post's custom fields to show a post overview. Getting the custom fields is working, but the getting the permalink isn't. I'm getting the permalink so I can link to the post. All I get back when I use `get_permalink()` is the first letter. Also, be noted that I'm using AJAX to return an array. I don't know if that is making the problem though. Thank you so so so much. Hunter Code               function ajax_action_stuff()     {         $post_id = $_POST['post_id']; // getting variables from ajax post              $get_plane_custom = get_post_custom($post_id);              $condition = $get_plane_custom['Condition'];         $rules = $get_plane_custom['Flight Rules'];         $manufacturer = $get_plane_custom['Manufacturer'];         $model = $get_plane_custom['Model'];         $price = $get_plane_custom['Price'];         $lease = $get_plane_custom['To Lease'];         $time = $get_plane_custom['Total Time'];         $year = $get_plane_custom['Year'];         $permalink = get_permalink($post_id);              $plane_details = array("condition" => $condition, "rules" => $rules, "manufacturer" => $manufacturer, "model" => $model, "price" => $price, "lease" => $lease, "time" => $time, "year" => $year, "link" => $permalink);              foreach($plane_details as $key => $value)         {             echo $value[0] . "|";         }              die();     }


title: Loop through Custom Post Type, and then show children within each iteration

text: I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so:               <?php         $loop = new WP_Query( array(             'post_type' => 'programs',             'posts_per_page' => -1,             'post_parent' => 0         ) );     ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>              loop stuff          <?php endwhile; ?>      Within each loop, I need to to do another loop, which shows all of the children of that post that is currently being iterated on. The point is to show each post, and then all of the children of that post underneath it. I need to loop through the children pages so I can show the title, content, image, custom fields, etc. I do not know how to approach this, as using a QP_Query loop inside another leads to unexpected results. Any ideas?


title: Unable to select image with custom field

text: I'm using the advanced custom field plugin to convert WP into a CMS (it's works brilliantly for this). There's just one issue - with an image field it's not quite a smooth process as images need to be selected twice, this causes user confusion. Rather than me up all the images again - please see here for step by step process of the problem. I'm not sure if this is a WP problem or a problem with the plugin.


title: Multiple Taxonomies Using Custom SQL Query

text: I am running a custom SQL query, and I am trying to pull posts with two taxonomies assigned to it. Here is my query which works:               $querystr3 = "SELECT *,              events_startdate.meta_value AS the_start,             events_enddate.meta_value AS the_end             FROM $wpdb->posts p             LEFT JOIN $wpdb->term_relationships ON(p.ID = $wpdb->term_relationships.object_id)               LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)             LEFT JOIN $wpdb->postmeta AS events_startdate ON(p.ID = events_startdate.post_id AND events_startdate.meta_key = 'events_startdate' )             LEFT JOIN $wpdb->postmeta AS events_enddate ON(p.ID = events_enddate.post_id AND events_enddate.meta_key = 'events_enddate' )              WHERE ($wpdb->term_taxonomy.term_id = 11             AND $wpdb->term_taxonomy.taxonomy = 'status'             AND p.post_type = 'pmg_events'             AND p.post_status = 'publish'             AND events_startdate.meta_value != ''             AND events_enddate.meta_value != ''             AND events_enddate.meta_value >= CURDATE()             )             ORDER BY events_enddate.meta_value ASC";      But I'd like to get the posts with TWO taxonomies. So something like this, which obviously doesn't work:               $querystr3 = "SELECT *,                  events_startdate.meta_value AS the_start,                 events_enddate.meta_value AS the_end                 FROM $wpdb->posts p                 LEFT JOIN $wpdb->term_relationships ON(p.ID = $wpdb->term_relationships.object_id)                   LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)                 LEFT JOIN $wpdb->postmeta AS events_startdate ON(p.ID = events_startdate.post_id AND events_startdate.meta_key = 'events_startdate' )                 LEFT JOIN $wpdb->postmeta AS events_enddate ON(p.ID = events_enddate.post_id AND events_enddate.meta_key = 'events_enddate' )                  WHERE ($wpdb->term_taxonomy.term_id = 11                 AND $wpdb->term_taxonomy.taxonomy = 'status'                 AND $wpdb->term_taxonomy.term_id = 5                 AND $wpdb->term_taxonomy.taxonomy = 'status'                 AND p.post_type = 'pmg_events'                 AND p.post_status = 'publish'                 AND events_startdate.meta_value != ''                 AND events_enddate.meta_value != ''                 AND events_enddate.meta_value >= CURDATE()                 )                 ORDER BY events_enddate.meta_value ASC";      How can I achieve this? Do I need to LEFT JOIN my new taxonomy?


title: Displaying div from custom-post-type in Fancy Box

text: First of all, I have posted a very similar question here: Displaying custom post-types in a Fancybox div and then linking to them However, after being unable to find a solution I have taken a different approach and created a template page with just the portfolioProject div and not included the other elements such as header and footer. So now on this page( click here) when I click on one of the thumbnails it opens up the fancybox div but I have a few issues:   1. The close button doesn't appear to work   2. The second thumbnail doesn't appear to work but the first does   3. I don't want the scrollbar to show, and I have tried using the `option scrollbar : 'no'` but it does not seem to work Any help on this would be great! Thanks, Ash


title: Show more than 20 items in pages or posts edit table

text: How can an admin display more than 20 items under "ALL posts" ( or "All pages", or media or etc. )? I have read that there exist a special plugin, but is there not a built-in setting for it?


title: Is there a conditional tag for latest post or do i need a query?

text: I need to display an avatar in the post info position which i have written the code for but i only want to display it on the most recent post on the home page and not a specific post as this will change when a new post id published. Couldn't find a conditional tag which handles this. I'm using the code in a custom function with genesis_hook in the child theme.               function latest_post_author_avatars() {     if (is_single() || is_home() ) {       echo get_avatar(get_the_author_id(), 40);            }          }     add_action('genesis_after_post_title', 'latest_post_author_avatars');      // Here's the final solution which works. Thanks to both of you.               function latest_post_author_avatars() {     global $wp_query;     if (is_single() || is_home() && 0 === $wp_query->current_post)  {     echo get_avatar(get_the_author_id(), 40);            }          }     add_action('genesis_after_post_title', 'latest_post_author_avatars');


title: Child Theme CSS Not Overriding Parent Theme In MultiSite Site

text: I've been banging my head on the wall for a while now trying to figure this out. I have a multisite setup currently with just the main site and a network site I added. The main site displays just fine, however the network site I added has a few elements, like the sidebar, that are using the parent themes stylesheet. Specifics:   1. I'm using a multisite setup with subdomains.   2. I'm using the twentyeleven theme with a child theme   3. I did copy the wp_posts, wp_postmeta, wp_term_relationships and wp_term_taxonomy tables over from the main site to the network site. Not sure if that had something to do with it. I ran firebug on the network site and the css and html came back with no errors Here is the main site: http://onlinechimpwebsitesolution.com/ And here is the network site: http://sitetemplate.onlinechimpwebsitesolution.com/ The two should look identical. As you can see, the network sites sidebar is floated right when it should be left, as specified in the child themes stylesheet. Also the content and sidebar widths are being pulled from the parent themes stylesheet. I'm at a loss here.... Any help would be appreciated! Thanks!


title: Changing layout of defaul gallery output to masonry

text: I'm changing the default layout for gallery shortcode. I have this in my functions.php:               $attr['columns'] = 1;     $attr['size'] = 'full';     $attr['link'] = 'none';          $attr['orderby'] = 'post__in';     $attr['include'] = $attr['ids'];      These are hardcoded default options, which allow me to set max-width to all images whithin the .gallery:               $.each($('.gallery img'), function () {         $(this).css({             'max-width' : 300         });     });      After that I'm running masonry and it looks almost perfect. **My problem is...** that I want to set random max-width in one of the following ways: 1) randomly set max-width to each image from an array with three or four values 2) generate random even number withing a range (say 260 to 480 with a 20px "step") and set it as max-width **...and I have no clue how to achieve that**. It's been dozens of google search queries and still I'm floating in nowhere. I've tried simple javascript math.floor and math.random function, but I'm not a programmer, I guess I'm doing something wrong. I want to make galleries mobile-friendly. Will appreciate your help.


title: Show Custom Taxonomy Slug(s)?

text: can anyone help me with this? I need to print the slug of my custom taxonomy, can this be done? The following kind of works but it just shows the name, rather than the slug which i need for a class purpose..               <?php $terms = get_the_terms( $post->ID , 'area' ); foreach( $terms as $term ) {print $term->name; unset($term);}?>           Any way of just getting the slug for my custom taxonomy 'area' ?? Many thanks for any help :)


title: Show buddypress profile fields in a multsite blog

text: I want to show my users profile fields in theirs child blogs of my site. On the main template i use               <? echo bp_get_profile_field_data( 'field=Name'); ?>      On the child theme that i use for my users blogs this dont work. Checking $bp var i can see that $bp->displayed_user its empty There is way to do tihs? I just want to show on the multisite blogs created by users their profile of buddypress. Thanks!!


title: how can I call a posts featured image in any template?

text: I would like to call specific images in my template from the posts and pages of my choosing. For example I want to these featured images on my home page;   * About page    * Project post   * Another page I have used the_post_thumbnail() on my archive pages and to call the image to it's particular post or page. But i can't find any information about calling specific featured images. Does anybody know?


title: Saving custom profile fields

text: I'm adding a custom profile field to users of a specific role, like this :               function add_custom_profile_fields( $fields ) {              // get current user ID         $user = new WP_User( $_GET['user_id'] );              // get current user role         if ( !empty( $user->roles ) && is_array( $user->roles ) ) {             foreach ( $user->roles as $role ) {                      // filter roles                 if ($role == "paying_member"){                    $fields['paypal_account'] = 'Paypal account';                         }              }          }              return $fields;     }     add_filter('user_contactmethods','add_custom_profile_fields',10,1);      The problem is, the field's value doesn't get saved. When I login as admin an I edit a user's profile. It somehow has to do with the fact that I'm filtering by user role, because when I remove that part, the values get saved perfectly. EDIT : I think maybe the whole method is wrong, I'm going to try this instead.


title: How do I fix permalinks for custom post types that has the same slug as a page?

text: **I know that it's impossible to have the same custom post type slug as a page.** So, I thought it might be resolved in this way: `'rewrite' => array('slug' => 'my-category/!#')` for register_post_type But I get "Page not found" every time I visit /my-category/!#/title-1 As you understand, I also have a page named "/my-category". Is it somehow possible to resolve this conflict?


title: Form doesn't submit on second submit call

text: I've been strugling with the following issue for over a week now so please excuse the long description. I want it to be as accurate and clear as possible: I'm using the "simplr registration form" plugin to register new users. I need to add to the form an "address" field for the users to fill, and when the submit button is clicked the address should be sent to google maps API and recieve back the latitude and longitude which should then be saved in wpdb together with the rest of the user's data. To achieve this I've added the following to the php function which builds the html form:   \- address input field   \- 2 hidden fields for the lat&long   \- jquery function that responds to the submit button and is supposed to do its thing after the button's clicked but before the form is actually submitted and handled by the plugin's php function. Since using Google Maps API is asynchronous to get the job done I need to do the following: Write a function that responds to the submit click.   That function should prevent the form from being submitted and call another function which does the google maps stuff and after it's finished submits the form.   The problem lies with the second submit. It just doesn't happen.   I have tried different ways (with jquery):   \- a submit function that calls itself with the use of a flag that tells the first iteration not to submit and the second one to submit. The code works fine until the second iteration submit which simply doesn't work.   \- a submit function that calls "this.submit()". Again, "this.submit()" doesn't cause the form to submit.   \- a click function that should respond to the submit being clicked, do the google stuff and then call the submit function. Here even the click function doesn't fire at all.               // This is the button's definition:     $form .=  apply_filters('simplr-reg-submit', '<input type="submit" name="submit-reg" id="submit-reg" value="Register" class="submit button">');          // This is the php code that starts handling the submitted form      if(isset($_POST['submit-reg'])) {      Here's an example for one of my attempts:               function codeAddress(callback)     {         // do the google stuff         // when finished submit the form         $('#simplr-reg').get(0).submit();              // it's all being done except for the submit part     }          $('#simplr-reg').submit(function(event)     {         codeAddress(function(success){}); //callback from googlemaps         event.preventDefault();     }          // Here's a simplified example:     $('#simplr-reg').submit(function(event)     {         this.submit(); //doesn't cause the form to submit         event.preventDefault();     });      If I don't use event.preventDefault() and submit in the first iteration it submits fine. I've tried solving this with the help of the guys on stackoverflow but no one could find what's wrong so I'm guessing it's got something to do with WordPress or the plugin.


title: How to solve opening and ending tag mismatch error in feed page

text: When I visit my feed page I am getting "error on line 261 at column 24: Opening and ending tag mismatch: input line 0 and form" this error. What's wrong in feed page please need your help. My Site URL: http://www.mananpatel.in   Hear is image link: http://mananpatel.in/feed-error.png Thanks.


title: Wordpress update totally broke the install. Main page now displays empty rss feed

text: Hey guys- A friend of mine just did an auto-update for the most recent wordpress upgrade. Upon completion, her site began to display her rss feed on the front page instead of well, her front page. the rss feed also appeared to be empty. Upon further inspection, it appears that EVERY page goes to that empty feed page (including the admin panel link). Lastly, it seems that the main url wants to add an additional // at the end of the URL when hitting the root of the domain. Have any of you heard of anything like this? Said friend went to me looking for help because I'm usually a wellspring of knowledge on such things, but this is one problem Ive never come across. For reference, this is the site: http://lizconley.com/ Thanks for any input you might have!


title: WordPress MultiSite Link Cloaking/Redirect Solution?

text: Is there a method I can use to set and cloak an affiliate link once in WPMS and then all MS blogs will work using that relative link? ie: allWPMSurls.com* **/out/productname*** I have several affiliate blogs in a WordPress MultiSite install. They all use the same affiliate links and I'm currently use the Redirection plugin to cloak them. This works well, but it's fast-becoming too time consuming to update/edit the links in WP Admin for every blog (considering it's the same link for every blog). All the sites use the same relative link for the affiliate products (/out/product-name) so I'd love to be able to add/edit the links in a single place and for them to work on all the blogs. Navigating into WP Admin > Redirection > Link Setting for _every_ blog to change the same link is buckling me. I tweeted the always-helpful @andrea_r who replied about hard-coding the plugin into mu-plugins. But that is a beyond my skill-set. Has anyone else any suggestions?


title: Boldy Theme - Tweak PHP for 2nd Logo?

text: Running WordPress 3.1 with the free Boldy theme from Site5. Here is a working version of my website: http://www.dekhoforum.com I want to achieve something like this screenshot: ![enter image description here](http://i.stack.imgur.com/OdWcL.png) i.e. Have a 2nd logo above the social media icons. EDIT _\- Screenshot shows moving an existing image to the new location.   This is misleading, and I actually need a new placeholder for an image, and not to move the existing logo (which is the right image), as this will not be consistent on the other pages such as the blog. \- In short, its a marketing requirement to get this logo at the top of each page, across the entire site._ One option I did ponder, was somehow trying to add another social media icon, but link it to my main company website. I have tweaked PHP in the past on previous themes, but always had a little guidance from you wonderful lot. Was wondering if anyone could advise? I have been snooping in the header.php, but I imagine I will need to write a new line in somewhere? Any help would be great.


title: How to Add Custom Taxonomy To Woocommerce Plugin

text: I am trying to add a Custom Taxonomy to Woocommerce by targeting the product post type in Woocommerce. I used following code and added it into `functions.php` I am not getting any error message but the taxonomy is not showing in the Woocommerce as well. Can you please let me know how I can do this or what I am doing wrong here?               <?php     // Register Custom Taxonomy     function custom_taxonomy_Item()  {          $labels = array(         'name'                       => 'Items',         'singular_name'              => 'Item',         'menu_name'                  => 'Item',         'all_items'                  => 'All Items',         'parent_item'                => 'Parent Item',         'parent_item_colon'          => 'Parent Item:',         'new_item_name'              => 'New Item Name',         'add_new_item'               => 'Add New Item',         'edit_item'                  => 'Edit Item',         'update_item'                => 'Update Item',         'separate_items_with_commas' => 'Separate Item with commas',         'search_items'               => 'Search Items',         'add_or_remove_items'        => 'Add or remove Items',         'choose_from_most_used'      => 'Choose from the most used Items',     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,     );     register_taxonomy( 'item', 'product', $args );     }     ?>      **Update**               <?php     add_action( 'init', 'custom_taxonomy_Item' );          // Register Custom Taxonomy     function custom_taxonomy_Item()  {          $labels = array(         'name'                       => 'Items',         'singular_name'              => 'Item',         'menu_name'                  => 'Item',         'all_items'                  => 'All Items',         'parent_item'                => 'Parent Item',         'parent_item_colon'          => 'Parent Item:',         'new_item_name'              => 'New Item Name',         'add_new_item'               => 'Add New Item',         'edit_item'                  => 'Edit Item',         'update_item'                => 'Update Item',         'separate_items_with_commas' => 'Separate Item with commas',         'search_items'               => 'Search Items',         'add_or_remove_items'        => 'Add or remove Items',         'choose_from_most_used'      => 'Choose from the most used Items',     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,     );     register_taxonomy_for_object_type( 'item', 'product', $args );          }     ?>


title: update_post_meta frontend

text:
Ok I have searched and searched the internet to find an answer to no avail. Here is my issue. I have a form that is pre-populated with metadata fields. I want to have two submit buttons one will change the post meta to Won and the other will change the post meta to lost. Everything I've tried only lets one of the buttons work not both. This is what I have so far that is not working properly               <?php     global $post;     $postid = $post->ID;          if(isset($_POST['won'])){         update_post_meta($postid, 'wp_lead_status', 'Won');     }else{         update_post_meta($postid, 'wp_lead_status', 'Lost');     }     ?>      the form looks like this                <form id="update" method="post" action="">
                   First Name:         <input type="text" name="fName" value="<?php echo get_post_meta($post->ID, 'wpleads_first_name', true); ?>">
         Last Name:         <input type="text" name="lName"  value="<?php echo get_post_meta($post->ID, 'wpleads_last_name', true); ?>">
         Sales Item:         <input type="text" name="salesItem"  value="<?php echo get_post_meta($post->ID, 'wpleads_sales_item', true); ?>">
         Potential:         <input type="text" name="potential"  value="$<?php echo get_post_meta($post->ID, 'wpleads_potential', true); ?>">
         Lead Status:         <input type="text" name="leadStatus"  value="<?php echo get_post_meta($post->ID, 'wp_lead_status', true);?>">
         Notes:         <input type="text" name="notes"  value="<?php echo get_post_meta($post->ID, 'wpleads_notes', true); ?>">
         Additional Notes:         <textarea  name="addNotes"><?php echo get_post_meta($post->ID, 'wpleads_add_notes', true); ?></textarea>
         Contact Number/Areacode:         <input type="text" name="areaCode"  value="<?php echo get_post_meta($post->ID, 'wpleads_areacode', true);?> <?php echo get_post_meta($post->ID, 'wpleads_work_phone', true); ?>">
         Address:         <input type="text" name="address"  value="<?php echo get_post_meta($post->ID, 'wpleads_address', true); ?>">
         City:         <input type="text" name="city"  value="<?php echo get_post_meta($post->ID, 'wpleads_city', true); ?>">
         State:         <input type="text" name="state"  value="<?php echo get_post_meta($post->ID, 'wpleads_reigon_code', true); ?>">
         Zip Code:         <input type="text" name="zip"  value="<?php echo get_post_meta($post->ID, 'wpleads_zip', true); ?>">
         Sales Associate:         <input type="text" name="salesAssociate"  value="<?php echo get_post_meta($post->ID, 'wpleads_sales_associate', true); ?>">
         Weighted:         <input type="text" name="weighted"  value="<?php echo get_post_meta($post->ID, 'wpleads_weighted', true); ?>">

         <?php dynamic_sidebar( 'lead_sidebar' ); ?>

     <input type="hidden" name="Won" value="Won"/>     <button type="submit" class="inbound-button-win inbound-win" value="Won" name="won" id="inbound_form_win" style=" font-size:16px;">                          WON</button>

     <input type="hidden" name="Lost" value="Lost"/>     <button type="submit" class="inbound-button-lost inbound-win" value="Lost" name="lost" id="inbound_form_lost" style=" font-size:16px;">                          LOST</button>
     </form>      I'm not sure what I'm missing. I have tried doing both buttons separately with the if(isset.... but that didn't work either. I'm at my wits end with this. Any help would be greatly appreciated


title: Humanmade CMB | How to use checkboxes and radio buttons

text:
**I would like some help or advise for using checkbox and radio fields in HM CMB class.** ## Where I am so far I've been using the class to add all types of fields to my projects, with repeatable groups for certain area's of sites. For example I created a repeatable group which has an image left and a title and subheading to the right which the user can use to introduce a product or company. ## My aim I've been searching and testing different methods to achieve two things. 1\. Add radio buttons to change the background colour of the repeatable group; either white or transparent. 2\. Add radio buttons or drop-down menu to arrange the image either left or right. ## My code so far _( Without the options I'd like to add, as I really don't think anything I was doing is even close )_               // Featurette Meta Box Tag     function src_get_featurettes( $page_id ){          $featurettes = get_post_meta( $page_id, 'featurette', false );               if ( $featurettes ) {                  $featurette_list = "\n
\n";                 foreach ( $featurettes as $featurette ) {                       $featurette_image = false;                      $featurette_head = false;                     $featurette_sub = false;                     $featurette_list .= "\t
";                      if ( $featurette['a_feat_img'] ) {                          $featurette_image .= '';                         $featurette_image .= wp_get_attachment_image( $featurette['a_feat_img'], 'thumbnail', false );                          $featurette_image .= '';                     }                     if ( $featurette['a_feat_head'] ) {                           $featurette_head .= '
';                          $featurette_head .=  '
' . $featurette['a_feat_head'] . '
';                      }                     if ( $featurette['a_feat_sub'] ) {                          $featurette_sub .=  wpautop ($featurette['a_feat_sub'] );                          $featurette_sub .= "
";                      }                     $featurette_list .= $featurette_image;                      $featurette_list .= $featurette_head;                      $featurette_list .= $featurette_sub;                      $featurette_list .= "
\n";                   }                      $featurette_list .= "
\n";                       return $featurette_list;              }             else {                 return false;              }     }          function src_the_featurettes( $page_id ) {               if ( src_get_featurettes( $page_id ) ) {               echo src_get_featurettes( $page_id );          }         else {             return false;          }          }      I'm using the above to call the meta in my page template with `src_get_featurettes( 'my page id' )` Has anyone been doing this and would be able to point me in the right direction or give me some advice? Thank you so much anyone who adds to this.


title: Need To Deregister Scripts Via Functions.Php

text: Well, I am a little disappointed how difficult Wordpress it makes to deregister scripts. First, I got a list of all handles, so I looked it up and the handle was jquery-migrate I then added this to my functions.php               wp_dequeue_script('jquery-migrate');      Also this               wp_dequeue_script('jquery');      It does nothing, although the scripts are properly registered. What's up with the version strings, I can think of no reasons why they are still including those, should be removed in the next WP version asap, they only prevent caches from properly caching it in some cases and are annoying. Any input on how to "properly" deregister scripts is appreciated.


title: Set conditional query fetching posts of custom taxonomy term

text: I have a CPT > test and 2 taxonomies attached to it > P and R. My CPT archive page works fine. However, I am using the below code for my taxonomy archive template which gets me the posts in the specified term. But when I add more terms, it gets me a combined list of posts from all these terms. I want it to automatically look for the term-page and accordingly show posts for that term. How to achive that?               $args = array(                     'tax_query' => array(                         'relation' => 'AND',                         array(                             'taxonomy' => 'p',                             'field' => 'slug',                             'terms' => array( 'a-p', 'b-p', 'c-p' ),                         ),                          )                 );                 $my_query = null;                 $my_query = new WP_Query($args);                 if( $my_query->have_posts() ) {                   echo 'List of Pathology Tests - A';                   while ($my_query->have_posts()) : $my_query->the_post();      I also have another taxonomy and want to use the code to do the same for archive template of that.


title: Am I allowed to enqueue scripts like this to control what pages they are on?

text: I am working on my first WordPress plugin. The plugin basically creates a few short codes to achieve a few effects. In order to only include all of the css and js files on the pages where they are needed I have set my wp_enqueue_* function calls to be called if a short code is activated. That may not have been a very clear description so here are code snippets related to what I am talking about:               add_shortcode( 'slider_space', 'f_slider_space');          function link_page_files(){             wp_enqueue_style( 'cccslider-style', plugins_url("...") );             wp_enqueue_script( 'jquery' );             wp_enqueue_script( 'jquery.easing', plugins_url("..."), array('jquery') );             wp_enqueue_script( 'scrollcontrol', plugins_url("...") );             wp_enqueue_script( 'cccslider', plugins_url("..."), array('jquery.easing', 'scrollcontrol') );         }          function f_slider_space($atts, $content = null){     link_page_files();     // ..........     }      It seems to be working, but I am wondering if this is not best practice. What solution is best for controlling which pages the files are included in?


title: Get list of available wordpress actions

text: I don't think there is, but I was wondering whether anyone ran into this issue before. Is there a function (or variable) call to get all registered WP Actions and all registered WP Filters? My current way of doing so would be to have something like this:               static private $wp_actions = array(         'muplugins_loaded',         'registered_taxonomy',         'registered_post_type',         'plugins_loaded',         'setup_theme',         'load_textdomain',         'after_theme_setup',         'init',         'widgets_init',         'register_sidebar',         'wp_register_sidebar_widget',         'wp_default_scripts',         'wp_default_styles',         'admin_bar_init',         'add_admin_bar_menus',         'wp_loaded',         'parse_request',         'send_headers',         'parse_query',         'pre_get_posts',         'wp',         'template_redirect',         'get_header',         'wp_head',         'wp_enqueue_scripts',         'wp_print_styles',         'wp_print_scripts',         'loop_start',         'the_post',         'loop_end',         'get_sidebar',         'wp_footer',         'wp_print_footer_scripts',         'admin_bar_menu',         'shutdown'     );      Except that's undesirable because, what if...WP adds more actions, or deprecates some? I'd feel safer getting an already in-memory solution. _The above list was translated by hand fromthis link._ **EDIT:** I'm trying to write a somewhat decent plugin system using classes. Here's implementation I'm looking for:               abstract class AtlantisPlugin {         static private $atlantis_actions = array( );         static private $atlantis_filters = array( 'atlantis_plugin_init' );              // http://codex.wordpress.org/Plugin_API/Action_Reference         static private $wp_actions = /* see above */;         static private $wp_filters = array();              protected $atlantis;         private $class;              public function __construct(Atlantis $atlantis) {             $this->class = strtolower(get_class($this));                  $this->atlantis =& $atlantis;             $this->atlantis->registerPlugin($this->class, $this);                  $actions = array_intersect(self::$wp_actions, get_class_methods($this->class));             foreach($actions as $action) {                 add_action($action, array(&$this, $action), 2);             }                  $filters = array_intersect(self::$wp_filters, get_class_methods($this->class));             foreach($filters as $filter) {                 add_filter($filter, array(&$this, $filter), 2);             }         }     }      Thanks. **:)**


title: ASC and DESC separately from orderby

text: So I got this to sort my posts and it works great:               <div class="sort">        Sort by            <select onclick="if (this.value) { document.location = this.value; }">               <option value="" selected="selected">Latest first</option>               <option value="<?php echo $short_page_url; ?>?orderby=date">Oldest first</option>               <option value="<?php echo $short_page_url; ?>?orderby=title">Titles A-Z</option>            </select>     </div>      But how can I have the order as separate dropdown/links to change between ASC and DESC? So it adds "&order=desc/asc" to the link when there's "?orderby=title/date" present?


title: What are PHP extensions and libraries WP needs and/or uses?

text: Codex loosely only mentions PHP version in server requirements, however PHP can be configured in pretty wide range of excluding/including different parts. What are extensions/libraries that:   1. are required for WP to work at all? _MySQL..._   2. are required for specific functions? _GD ?..._   3. are preferred for best operation of specific functions? _cURL..._   4. are commonly used by plugins? _Zip..._


title: Building large multi-section pages with Advanced Custom Fields

text: I'm just beginning the build on a site which has long-form pages broken up into multiple sections. Each section should follow one of a limited number of formats - e.g. 3 column, 2 column, full-width, quote etc. I'd like to use the Advanced Custom Fields plugin to try and constrain how users enter the content so they can add similar pages in future without needing customisation from me. I can think of two ways of solving this:   1. I write a custom query which loops through all the sub-pages of the current one, then based on the template selected for the sub-page use get_template_part to pull in page content along with the relevant ACF fields.   2. I use the ACF flexible content plugin to define the entire page in sections. I've not used flexible content on ACF before - so I'd love to know whether anyone has learned from experience any performace or usability drawbacks to either approach?


title: Creating Sections for Post Types

text: I'm trying to create this page structure within WordPress:               - Home                (http://example.com/)     - Blog                (http://example.com/blog/)       - Blog Post         (http://example.com/blog/blog-post-name/)     - Projects            (http://example.com/projects/)       - Projects Post     (http://example.com/projects/project-post-name/)      Following the WordPress Codex guide Making Your Blog Appear in a Non-Root Folder I'm able to create this structure:               - Home                (http://example.com/)     - Blog                (http://example.com/blog/)       - Blog Post         (http://example.com/blog/blog-post-name/)      But not the "Projects" section. The Codex documents how to move where your blog sits, but not handle different post types in this way. I'm trying to achieve "Blog" page as the index of all "Blog Post" posts, and "Projects" page the index of all "Project Post" posts.


title: tag__in does not return posts

text: I want to get a custom post type posts with the same tags. Here's what I'm trying:               $tags = get_the_terms( $post->ID, 'item-tags' );    //returns tags array correctly          if ($tags) {              $tag_ids = array();         foreach($tags as $single_tag){             $tag_ids[] = $single_tag->term_id;         }              $args = array(             'tag__in' => $tag_ids,               'post__not_in' => array($post->ID),                                      'post_type' => 'item',                                       'showposts' => 5,             'ignore_sticky_posts' => 1         );            }      It does not return any post. If I remove tag_ _in and post_ _not_in then it returns all posts correctly. Is there anything wrong with the above arguments?


title: get all page IDs from wp_list_pages

text: I am looking for a way to output all page IDs from the following menu:               <?php wp_list_pages('depth=1&exclude='3,5,11')); ?>      Only top level pages needed, therefore the 'depth=1'. Any help appreciated.


title: Undefined function wp_set_password

text: I'm creating a plugin. I'm receiving the following error (WP 3.5):               Fatal error: Call to undefined function wp_set_password() in \path\to\plugin.php on line 18      Line 18 consists of simply:               wp_set_password( 'newpass', $user_id );      This is located in the main plugin file, and all other code has been commented out in order to try and seclude this error. I have no idea why it's showing up as undefined. Am I missing something here?: http://codex.wordpress.org/Function_Reference/wp_set_password Thanks


title: [Plugin WPML] : How to create a translation of a post using the WPML API?

text: I'm trying to figure out how to create a translation for a post using the internal WPML API (`inc/wpml-api.php`) I simply want to create a translation for post ID xx, set some content and publish it. I've tried to play around with `wpml_add_translatable_content` but couldn't get it right. Unfortunately there is not much documentation available for this. The closest lead I found is this thread, but I couldn't reduce the code to what I need. It's also possible to do this by directly writing to the database, following WPML's table structure, but I want to use the API. Any suggestions are welcome.


title: Remove Wordpress Scripts

text: I am working on a custom page template in my theme, i want to remove all other styles and scripts which are loaded, like default theme style, jquery & other scripts, i want to remove all for the template page. Please suggest.


title: How to configure site for automatic upgrades

text: I have a WP site running on Ubuntu 11.04. I set the apache www-data user to have write permissions on the entire wordpress directory recursively. This made it possible to update the plugins automatically, but the site upgrade functionality is prompting me for FTP credentials. How do I get that screen to work for updates without using FTP?


title: Site stuck in "Database Update Required" loop

text: I just updated to 3.1.3 and now when I go to the admin I get the "Database Update Required" `/wp-admin/upgrade.php` screen. I click 'Upgrade Now' and it says it's done, but then trying to access anything in the admin gets me the same screen again. How do I get past this? EDIT: In trying to use toscho's solution, I discovered that my wordpress db tables are not writable, which likely led to the error loop. Any ideas for how to track that down?


title: How to prevent duplicate slugs for wp_insert_post?

text: I have a function that creates a page when I create a post (so as to construct parent-child relationship trees). I'm using the $title of the post to create the page and this also creates a duplicate slug. Is there a way to alter the slug slightly so as to make it unique? How can I assure that the new slug will not interfere with the original post?


title: Register google jquery gets overwritten by plugin

text: I'm currently using a plugin, which includes jquery version 1.6.4 like this:               function thethe_image_slider_head_scripts(){         wp_deregister_script( 'jquery' );         wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/  jquery.min.js', false, 'latest');         wp_enqueue_script( 'jquery' );              wp_enqueue_script('slider-ui', THETHE_IMAGE_SLIDER_URL.'style/js/thethe-image-slider.js', array('jquery'));     }      The problem is, I'm deregistering jquery in my functions.php file within my theme, to get version 1.7.2. But it still takes the version 1.6.4.. I do like:                   wp_deregister_script( 'jquery' );         wp_register_script('jquery', (get_template_directory_uri() . "/js/jquery-1.7.2.min.js"), false, '1.7.2');         wp_enqueue_script( 'jquery' );      Does any know, why it takes the 1.6.4, and not version 1.7.2? Thanks!


title: Find and replace weird characters in the_content

text: So, I am using the following code to filter out certain letters.               $phrase = get_the_content();          $phrase = apply_filters('the_content', $phrase);     $replace = 'ï';          echo str_replace('Ã¯', $replace, $phrase);      Unfortunately, it doesn't seem to handle special characters that well. Any ideas?


title: Taxonomy Parameters in WP Query to get posts from two different taxonomies

text: For example I have custom post type Cars and two custom taxonomies Brand (with terms BMW, Honda, etc.) and Color (Red, Green, etc.). Car must has Brand but may not have Color. So it may be like: Car -> Brand : BMW -> Color : Red, and aslo it may be like this: Car -> Brand : BMW(without color). I need to get Cars from 1 brand which has colors: Car -> Brand : BMW -> Colors (any color). I have tryed to create query but it does not work.               $args = array(         'post_type' => 'cars',         'tax_query' => array(             'relation' => 'OR',             array(                 'taxonomy' => 'brand',                 'field' => 'slug',                 'terms' => 'bmw'             ),             array(                 'taxonomy' => 'color'             )         )     );     $query = get_posts( $args );     var_dump($query);     die();


title: How can I retrieve the slug for a custom post type via name?

text: How can I retrieve the slug for a particular custom post type via its name? I would appreciate some assistance.


title: WP Query - duplicated posts once including tags in search results

text: I running WordPress on `IIS & SQL server`. As some of the plugins do not work correctly with **DB ABSTRACTION** I am using a lot of `functions.php` filters as so on. To make my search results **include tags** I have added the following code to my `functions.php` \- http://pastebin.com/BZG20McY My search results now **include tags** , but I get plenty of **duplicated posts**. **Is there any way to filter`WP QUERY` and remove all duplicated post before going into the `WHILE LOOP`?** Here is my basic loop:               <?php          $query_args = explode("&", $query_string);     $search_query = array('');          foreach($query_args as $key => $string) {          $query_split = explode("=", $string);          $search_query[$query_split[0]] = urldecode($query_split[1]);     }      $search = new WP_Query($search_query);          ?>               <?php if ($search->have_posts()) : ?>          <?php while ($search->have_posts()) : $search->the_post(); ?>               // SOME POSTS          <?php endwhile; ?>     <?php else : ?>     // NO POSTS     <?php endif; ?>      **Any suggestions much appreciated.**


title: How to get lowest price from custom fields of posts

text:
Here is my Code. It is get sub category from main category. and from sub category having different posts related about different products. Now issue it this that i want lowest price value from custom field that i define. so i should i do it to get lowest/min value.
         <?php          $subcategories = get_categories('&child_of='.$cat.'&hide_empty');         foreach ($subcategories as $subcategory) {         ?>
               <?php               $subCatId=sprintf('%s',$subcategory->term_id); //the_content();                query_posts('cat='.$subCatId.'&order=ASC&meta_key=price&orderby=meta_value_number');               while ( have_posts() ) : the_post();                    /************************************************************************/               // this part of code is getting me price of custom fields                  $price=$post->ID;                $price = get_post_meta($price, 'price', true);               if ($price <= 3500) {               $minPrice=$price;               /************************************************************************/               ?>
                       <?php $postID=$post->ID; $image = wp_get_attachment_image_src (get_post_thumbnail_id( $pageID ),'medium', true) ; ?>                       <img width="445" height="209" src="<?php echo $image[0]; ?>" alt="" />

                       <?php echo sprintf('%s',get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name));?>

<?php the_content(); ?>

                           <a href="<?php echo sprintf('%s',get_category_link($subcategory->term_id)); ?>"><img src="<?php bloginfo( 'template_directory' );?>/images/btn-view.png" alt="" />

Price Start From £<?php echo $minPrice?>

                       <?php                   } // end if $price               endwhile; ?>
         <?php } //end foreach; ?>


title: Looping through custom taxonomy and display custom post types (Custom Post Type UI)

text:
I am using Custom Post Type UI and Custom Fields plugins for the WordPress theme I am creating. I have created a custom post type of price and I have created a custom taxonomy called price_types using Custom Post Type UI. On my Prices page I can loop through the built in taxonomy 'Categories' easily using the code below:               $categories = get_terms('category');     foreach( $categories as $category ):     ?>

<?php echo $category->name; // Print the cat title ?>

     <?php endforeach; ?>      If I try and do the same for my custom taxonomy even though I have added entries I get nothing?               $categories = get_terms('price_types');     foreach( $categories as $category ):     ?>

<?php echo $category->name; // Print the cat title ?>

     <?php endforeach; ?>      Does anyone have any ideas what I am doing wrong?


title: Get the_content with ajax

text: I'm using WordPress (WP) as the backend for an app that delivers content on a map. I've been trying for a couple of days to get my head around AJAx in WP and have found a good tutorial I'm trying to follow. I've adapted it for use in the theme, however how do I get it to 'GET' the_content? The parts that are relevant:               function the_content( $content ) {          global $post;          if( is_single() && 'post' == $post->post_type ) { //I'll want post from a specific category, not just single posts.          $content .= '<button class="ajax-yall" data-postid="'. $post->ID .'">'.     __('Click me!', 'ajax-yall') .'</button>'; //here I want it to get the post content of posts in a particular category     }     return $content;     }      and               $.get(             ajaxYall.ajaxurl,             {                 action  : ajaxYall.action,                 nonce   : ajaxYall.nonce,                 postID  : $el.attr('data-postid')             },      I've had various attempts at this, but my knowledge on the subject isn't sufficient.


title: How to disable special characters in usernames?

text: For a reason, I want to disable characters like `-`,`@`,`_`, that are allowed in usernames. Is this possible? How do I do this?


title: How to add custom Types to navigation menu

text: I'm using the Types plugin, and I created some custom types, linked to custom fields. It appears in the admin menu, and I can create new entries. But on the FO, how can I link my Custom type to a menu item ? When I go to theme->menu, I can select individual entry of my custom Types, but not the custom Types itself, so that its displays a page with the liste of all my entries in it. I could simulate it with categories, but it should be a more automatic way, no ?


title: wordpress update multiple posts post meta

text: I am trying to update multiple posts post meta at the same time. I have the following query:               <form action="" method="post">     <?php           $variations = new WP_Query();        $variations->query(array('showposts' => -1, 'post_type' => 'product_variation' )); while ($variations->have_posts()) : $variations->the_post(); ?>          <input name="regular_price[]" type="text" value="<?php echo get_post_meta(get_the_id(), "_regular_price", true); ?>" />     <input name="sale_price[]" type="text" value="<?php echo get_post_meta(get_the_id(), "_sale_price", true); ?>" />     <input name="item_id[]" type="hidden" value="<?php echo get_the_id(); ?>" />          <?php endwhile; wp_reset_query();?>      <input name="save" type="submit" />      I then have the following php to process the data:               <?php     if (isset($_POST['save'])) {              $ids = $_POST['item_id'];         $sales = $_POST['sale_price'];          foreach ($ids as $id){              update_post_meta($id,'_sale_price',$sale));          }     } ?>       For some reason the above does not save correctly. It will only save the last value, and apply this to all post meta. Is there something i am doing wrong?


title: Show content only if member left a comment

text: Functions Php :               add_shortcode( 'membervip', 'memberviparea' );     function memberviparea( $atts, $content = null ) {         if( is_user_logged_in() ) return '<p>' . $content . '</p>';         else return;     }      Post : > [membervip]Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed > diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat > volutpat.[/membervip] With this code I can show the links to only logged in members, but I want to only display the links for members who are logged in and have made a comment. What code can do this?


title: URL Rewrite breaks pagination on some permalink structures

text: i created some rewrite rules for my profile page with multiple tabs. Member and tab names are passed via url to the page template. Everything works fine except for the pagination. When a permalink structure other than default or /%postname%/ is selected i end up with "404 not found". Here is the code:               add_filter( 'page_rewrite_rules', 'profile_page_rewrite_rules' );     function profile_page_rewrite_rules( $rewrite_rules ) {              end( $rewrite_rules );         $last_pattern = key( $rewrite_rules );         $last_replacement = array_pop( $rewrite_rules );         $rewrite_rules +=  array(             'profile/([^/]+)/?$' => 'index.php?pagename=profile&member=$matches[1]',             'profile/([^/]+)/page/([0-9]+)/?$' => 'index.php?pagename=profile&member=$matches[1]&paged=$matches[2]',             'profile/([^/]+)/([^/]+)/?$' => 'index.php?pagename=profile&member=$matches[1]&tab=$matches[2]',             'profile/([^/]*)/([^/]*)/page/([0-9]+)/?$' => 'index.php?pagename=profile&member=$matches[1]&tab=$matches[2]&paged=$matches[3]',             $last_pattern => $last_replacement,         );         return $rewrite_rules;     }          add_rewrite_tag('%tab%','([^&]+)');     add_rewrite_tag('%member%','([^&]+)');          function memberpage_rewrite() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     add_action('init','profile_page_rewrite');      First two rules are for default tab when no tabname is passed. Now, www.sitename.com/profile/username/page/2 and www.sitename.com/profile/username/tabname/page/2 work fine when default or /%postname%/ is selected as permalink structure but break on others(numeric, month and name etc). Does anyone have any idea what may be causing this?


title: Separate Out Real Users

text: If I look at               /wp-admin/users.php      I see all the users, but some have given a bogus email and never used their password. Is there some way to see who has used their password at least once? If not, is there a plugin to do this going forward?


title: Programmatically add a Navigation menu and menu items

text: Through API functions, I want to define a new Navigation menu, select it in the current theme, and then insert a few Pages as menu items. This is to be done for instance on a theme activation. Through a (moderately painful) process of reverse engineering the database inserts and updates after manually setting up the Navigation menu and items, I've pieced together the following steps, where 'footer-nav' is the slug ID of the Navigation menu I'm creating:               if (!term_exists('footer-nav', 'nav_menu')) {              $menu = wp_insert_term('Footer nav', 'nav_menu', array('slug' => 'footer-nav'));              // Select this menu in the current theme         update_option('theme_mods_'.get_current_theme(), array("nav_menu_locations" => array("primary" => $menu['term_id'])));              // Insert new page         $page = wp_insert_post(array('post_title' => 'Blog',                                      'post_content' => '',                                      'post_status' => 'publish',                                      'post_type' => 'page'));              // Insert new nav_menu_item         $nav_item = wp_insert_post(array('post_title' => 'News',                                          'post_content' => '',                                          'post_status' => 'publish',                                          'post_type' => 'nav_menu_item'));                   add_post_meta($nav_item, '_menu_item_type', 'post_type');         add_post_meta($nav_item, '_menu_item_menu_item_parent', '0');         add_post_meta($nav_item, '_menu_item_object_id', $page);         add_post_meta($nav_item, '_menu_item_object', 'page');         add_post_meta($nav_item, '_menu_item_target', '');         add_post_meta($nav_item, '_menu_item_classes', 'a:1:{i:0;s:0:"";}');         add_post_meta($nav_item, '_menu_item_xfn', '');         add_post_meta($nav_item, '_menu_item_url', '');              wp_set_object_terms($nav_item, 'footer-nav', 'nav_menu');     }      This seems to work, but:   * is it a robust and elegant way of doing it?   * am I missing something totally obvious that would do all this in one line of code?


title: Replace default Wordpress search behavior with Sphinx

text: I want to implement Sphinx Search in my Wordpress site but I'm not exactly sure how to change Wordpress search behavior to use Sphinx. How do I get Sphinx Search engine to replace whatever Wordpress uses as default? I also want to display search results in a div with animations and search options on a static front page with only the site logo above it. If I use Sphinx, is there a way to use a Wordpress loop to return the search results with query_posts function? Thanks for your help!


title: How to create custom post listing in the admin?

text: I want the defult CPT listing to include not all posts but only some, according to a specific taxonomy. is there a way to do that ?


title: Show values of dynamically created custom meta keys

text: I have a form and date fields in it: "date from" and "date to" (to make a specify a period of availability. There may be several available periods, so I made a button by which you can add more "date from" and "date to" fields. I use custom meta fields to store the values of the entered days and here is the code:               $s = 1;     foreach($_POST['tgt_available_from'] AS $sID => $sValue){        $ads_data['available_dates_from'][$s] = $sValue;        $s++;     }        $s = 1;      foreach($_POST['tgt_available_to'] AS $sID => $sValue){        $ads_data['available_dates_to'][$s] = $sValue;        $s++;     }              $s = 1;      foreach( $ads_data['available_dates_to'] AS $sID => $sValue){                 update_post_meta($postid, 'available_dates_from_'.$s, $ads_data['available_dates_from'][$s]);                 update_post_meta($postid, 'available_dates_to_'.$s, $ads_data['available_dates_to'][$s]);                 $s++;         }      Once post is saved, I get the following meta keys / meta values array:               [available_dates_from_1] => Array         (             [0] => 01/19/2012         )          [available_dates_to_1] => Array         (             [0] => 01/29/2012         )          [available_dates_from_2] => Array         (             [0] => 02/19/2012         )          [available_dates_to_2] => Array         (             [0] => 02/28/2012         )          [available_dates_from_3] => Array         (             [0] => 03/19/2012         )          [available_dates_to_3] => Array         (             [0] => 03/29/2012         )      So the problem that I have is that I don't know how could I now show all the avalable dates (from and to) in theme template. 'available_dates_from_1' and 'available_dates_from_2' are not related so I can't make a foreach loop. I don't know and the total number of entered available days, so i can't use a while loop. Maybe there could be any smarter solution?


title: Can I set a default dashboard layout for all users?

text: I'm creating a multi-author blog, and have recently added the "Dashboard Notepads" plugin. This allows me to add 1 to 3 dashboard widgets which I can write custom notes in, like news or notices. Is there a way I can set that widget to appear at the top by default? I had a look but could only find a plugin which works up to 2.8. Using version 3.0.4. I would much rather do this without the need to change code, although I would consider it as a last resort option. Thanks in advance.


title: WordPress comments just vanished even tho there are about 250+ of them. Where did they go?

text: I manage a wordpress installation that handles quite a bit of traffic. We use WP-Cache and WP Thread Comment and recently, the owner noticed there was 250 comments on 1 post, but only one comment was showing. Here is a screenshot: http://cl.ly/3rtk All the comments can be seen from the control panel of WP. But I think WP Thread Comment doesn't have enough memory to pull all the comments so it just shows the latest one. Anyone have this issue? Thanks in advance.


title: Change management solution for BP-based site?

text: I administer a social networking site that runs on WP, BP, and WP Multisite. Currently I have two servers: development and production, but I plan to move to three: development, staging, and production. Is there some piece of software out there that will allow me to push changes from development to staging, and staging to production, with a single command? Bonus points if it's web based. Also, since it's a social networking site, I can't overwrite any content that the users have generated.


title: Use of CONSTANT in wp_enqueue_script not possible?

text: I got the following setup:   * Parent & Child Theme (Parent contains basic stuff, but no loops, style, etc.)   * inside the functions.php of the Parent Theme i call my init.file, that cares about different stuff   * right at the begging of the parent functions.php file (before the init happens) i call my constants.php file that defines theme version, etc. When i now call `wp_enqueue_script($name, $path, $parent, VERSION_CONSTANT, $footer)` and set `$footer == true;` i would expect to get a) the script loaded in my footer and b) to get the *VERSION_CONSTANT* as my version number. But it doesn't work. Here is my workaround:   * Set `$footer == true;`   * pack it into a function   * add_action that function to a hook on top ...and stupid as it is: it works like a charm and the constant value get's inserted correct. Can anyone confirm this or has some explanation? I would expect to find the cause for this particular problem at where wp_enqueue_script get's loaded. This would explain why it works with the function (loaded later). Thanks!


title: Adding class "current_page_item" for custom post type menu

text: I am using the following to help display a list of posts created in a custom post type.               <?php      $args = array(       'post_type'=>'portfolio',       'title_li'=> __('Portfolio')     );     wp_list_pages( $args );      ?>       However a class is not being added to the list item of the current page (current_page_item). Any ideas of how I could make this happen? Thanks!


title: Get a post content with selected id?

text:
I tried to use this code on a page and woocommerce product page:               <?php         global $wpdb;               $querystr = " SELECT * FROM $wpdb->posts WHERE ID = 2594 AND $wpdb->posts.post_type = 'post' ";         $pagepostsc = $wpdb->get_results($querystr, OBJECT);              if ($pagepostsc):                   global $postcustom;                  foreach ($pagepostsc as $postcustom) :                      setup_postdata($postcustom);     ?>
<?php the_title(); ?>
      <?php                 the_content();                  endforeach;              endif;     ?>      the problem is i get never content from this post id, there is only content from the page repeated or from product, how can i solve this? Needed is only to see content from post with this id. What do i wrong here?