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

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?


WordPress fetches the archive page instead of my custom template

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?


Display images in attched gallery of custom post type

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


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

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)


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

_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.


XML RPC post produces immediate revision with odd post_date_gmt

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?


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

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.


Wordpress Permlinks 404 Not Found

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)


Password Protected Page Redirects To Dashboard on Submit

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' );


right_now_content_table_end function not working?

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.


get_permalink returning first letter

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();     }


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

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?


Unable to select image with custom field

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.


Multiple Taxonomies Using Custom SQL Query

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?


Displaying div from custom-post-type in Fancy Box

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


Show more than 20 items in pages or posts edit table

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?


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

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');


Child Theme CSS Not Overriding Parent Theme In MultiSite Site

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!


Changing layout of defaul gallery output to masonry

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.


Show Custom Taxonomy Slug(s)?

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 :)


Show buddypress profile fields in a multsite blog

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!!


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

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?


Saving custom profile fields

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.


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

**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?


Form doesn't submit on second submit call

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.


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

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.


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

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!


WordPress MultiSite Link Cloaking/Redirect Solution?

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?


Boldy Theme - Tweak PHP for 2nd Logo?

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.


How to Add Custom Taxonomy To Woocommerce Plugin

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 );          }     ?>


update_post_meta frontend

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


Humanmade CMB | How to use checkboxes and radio buttons

**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.


Need To Deregister Scripts Via Functions.Php

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.


Set conditional query fetching posts of custom taxonomy term

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.


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

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?


Get list of available wordpress actions

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. **:)**


ASC and DESC separately from orderby

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?


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

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..._


Building large multi-section pages with Advanced Custom Fields

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?


Creating Sections for Post Types

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.


tag__in does not return posts

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?


get all page IDs from wp_list_pages

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.


Undefined function wp_set_password

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


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

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.


Remove Wordpress Scripts

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.


How to configure site for automatic upgrades

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?


Site stuck in "Database Update Required" loop

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?


How to prevent duplicate slugs for wp_insert_post?

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?


Register google jquery gets overwritten by plugin

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!


Find and replace weird characters in the_content

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?


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

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();


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

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


WP Query - duplicated posts once including tags in search results

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.**


How to get lowest price from custom fields of posts

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; ?>


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

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?


Get the_content with ajax

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.


How to disable special characters in usernames?

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


How to add custom Types to navigation menu

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 ?


wordpress update multiple posts post meta

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?


Show content only if member left a comment

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?


URL Rewrite breaks pagination on some permalink structures

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?


Separate Out Real Users

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?


Programmatically add a Navigation menu and menu items

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?


Replace default Wordpress search behavior with Sphinx

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!


How to create custom post listing in the admin?

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 ?


Show values of dynamically created custom meta keys

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?


Can I set a default dashboard layout for all users?

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.


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

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.


Change management solution for BP-based site?

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.


Use of CONSTANT in wp_enqueue_script not possible?

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!


Adding class "current_page_item" for custom post type menu

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!


Get a post content with selected id?

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?


Dynamic Stylesheet loads but doesn't finish

I am creating a website for an architect with large images being a main feature of the site. Given the potential size of the images I wanted to have a way to create responsive image sizing (and of course I thought of css and background images. I thought I could use CSS to build the small image as the default and as screen width increases use media queries to add larger background images). My thought was to use a separate dynamic stylesheet (sliders.php) and write a script that looped through the images to create a slide show. A few notes: I'm using flexslider as an image slider and Advanced Custom Fields and Custom Post Types to create "architectural projects" with featured images to create the slideshow and using my functions.php file to auto create multiple sizes for the background images. My wordpress image slider on the front end is created with the following loop:
              <?php               $the_query = new WP_Query(array(             'post_type' => 'projects'            ));         ?>              <div class="RMA-slider slider-main slider-<?php echo the_ID(); ?>">
                      <?php                     $slideNumber = 0;     // Set Slide numbering to 0                          while (has_sub_field('project_slider_images')) :                          $slideNumber++;                 ?>
                     <div class="slider-image slide-<?php echo $slideNumber ?>">

                      <?php endwhile; ?>                 <?php wp_reset_postdata(); ?>

      Having run some tests, I'm fairly certain the problem is in the sliders.php file which is only used to set-up the sliders. I have two stylesheets:   1. screen.css (my non-dynamic stylesheet)   2. style.php - A dynamic stylesheet that pulls images from the wordpress database and puts them into the dynamic stylesheet as background images. The problem is that the loop doesn't run for every project and I can't figure out why? I've enqueued the stylesheets with the dynamic stylesheet getting precedent, but no change. The entire dynamic stylesheet is below. I have 3 different sliders running and therefore there are 3 slider loops created:               <?php     header('Content-type: text/css');     header("Cache-Control: must-revalidate");     $offset = 100;     $ExpStr = "Expires" . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";     header($ExpStr);          $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );     $url = $parse_uri[0];          require_once($url . 'wp-load.php' );     require_once($url . 'wp-includes/post.php');     require_once($url . 'wp-content/plugins/advanced-custom-fields/acf.php');     require_once($url . 'wp-content/plugins/custom-post-type-ui/custom-post-type-ui.php');          ?>               /* ___________MAIN SLIDER IMAGE SET-UP______________________________________________ */          //THIS WORKS AS IT SHOULD          <?php            $the_query = new WP_Query(array(         'post_type' => 'slides',         'posts_per_page' => -1         ));             $sliderTitle = get_the_title();            $slideNumber = 0;            while ($the_query->have_posts()) :         $the_query->the_post();            $slideNumber++;            $attachment_id = get_field('slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }          @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }          <?php wp_reset_postdata(); ?>     <?php endwhile; ?>                                   /* ___________PROJECT SLIDER IMAGE SET-UP________________________________________ */           //THIS IS THE PROBLEM. ONLY LOOPS THROUGH A FEW PROJECTS. THERE WILL BE UPWARDS OF 15 PROJECTS ON THE SITE AND ONLY 4-5 OF THEM WORK TO SHOW IMAGES          <?php            $the_query = new WP_Query(array(         'post_type' => 'projects'       ));                 while ( $the_query->have_posts() ) :         $the_query->the_post();                 $slideNumber = 0;            while (has_sub_field('project_slider_images')) :            $slideNumber++;            $attachment_id = get_sub_field('project_slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }          @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }          <?php wp_reset_postdata(); ?>     <?php endwhile; ?>     <?php endwhile; ?>                              /* ___________PRACTICE SLIDER IMAGE SET-UP____________________________________ */                          //THIS WORKS AS IT SHOULD          <?php            $the_query = new WP_Query(array(         'post_type' => 'practice_slides',         'posts_per_page' => -1         ));             $sliderTitle = get_the_title();            $slideNumber = 0;            while ($the_query->have_posts()) :         $the_query->the_post();            $slideNumber++;            $attachment_id = get_field('practice_slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }     @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }     <?php wp_reset_postdata(); ?>     <?php endwhile; ?>        * An example of a project that shows all images   * An example that's not working


Touch Punch and JQuery Accordion Menu Widget

I have been trying to figure out a way to enable touch events for the JQuery Accordion Menu Widget plugin (http://wordpress.org/support/plugin/jquery- vertical-accordion-menu); i.e. on a mobile device, touching the parent menu the first time should expand the menu to reveal the children, while a second tap would actually take you to the corresponding page. There seems to be a hack that should in theory allow this; see here: http://touchpunch.furf.com/ I am not sure, however, how to implement this. Adding the scripts is easy enough, but I believe some modifications to the plugin itself might be required. Does anyone know how to go about implementing this? Any tips would be very appreciated.


Managing WP Core & Plugin Updates for Clients

I'd like to know how you go about managing WP Core & Plugin updates for clients? It's a service my web company would like to start offering but we are unsure of the best solution. Let me provide some details:   1. The sites we build are under Version Control (Git/Github)   2. Our process typically involves 3 environments: Local Dev, Staging/Testing, Production   3. Deployment is handled through Github & DeployHQ   4. Databases are Sync'd using the excellent WP Migrate DB Pro Plugin   5. Sites are hosted on a VPS By default we disable automatic updates in WP. We are looking for a solution which fits within our workflow and wonder if anyone else uses a similar workflow? We do not want to simply login to a clients production site and update the core and/or plugins through the admin. This would mean code under Version Control would be "out-of-date" and this could potentially break the live site. We will soon be managing code & db backups with CodeGuard. Any suggestions would be much appreciated.


Adding custom field values to wp_list_pages

I am trying to pull in a custom field vales for each page while using wp_list_pages. For example I want to list out each portfolio item in my sidebar but also show why type of work it is by pulling in a custom field value so it would look like this:   * Portfolio Item 1 Type: Web Design   * Portfolio Item 2 Type: Web Development Here is the code I am using to pull in custom post types and this works perfectly, I just have no idea how to have it pull custom field values as well:               function wp_list_post_types( $args ) {     $defaults = array(         'numberposts'  => -1,         'offset'       => 0,         'orderby'      => 'menu_order, post_title',         'post_type'    => 'our-work',         'depth'        => 0,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '',         'include'      => '',         'title_li'     => __(''),         'echo'         => 1,         'link_before'  => '',         'link_after'   => '',         'exclude_tree' => '' );          $r = wp_parse_args( $args, $defaults );     extract( $r, EXTR_SKIP );          $output = '';     $current_page = 0;          // sanitize, mostly to keep spaces out     $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);          // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)     $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();     $r['exclude'] = implode( ',', apply_filters('wp_list_post_types_excludes', $exclude_array) );          // Query pages.     $r['hierarchical'] = 0;     $pages = get_posts($r);          if ( !empty($pages) ) {         if ( $r['title_li'] )             $output .= '
' . $r['title_li'] . '
';              global $wp_query;         if ( ($r['post_type'] == get_query_var('post_type')) || is_attachment() )             $current_page = $wp_query->get_queried_object_id();         $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);              if ( $r['title_li'] )             $output .= '

';     }          $output = apply_filters('wp_list_pages', $output, $r);          if ( $r['echo'] )         echo $output;     else         return $output;      }


wp_term_relationships has term_relationship_id of 0, causing issues with backup

After bulk tagging posts via mysql, I may have inserted a bunch of rows into my `wp_term_relationships` table that have a `term_taxonomy_id` of `0`. I believe this causing issues when i try to backup the database (the error is akin to "`duplicate id for primary key`") **Question:** Is it safe for me to delete all rows from where `term_taxonomy_id = 0`? Am I correct in thinking that such an term does not exist thus is causing issues?


How to remove Tags: text from the_tags?

The function `the_tags();` gives output as: `Tags: tag1, tag2`. But I want to get the tags only without the text `Tags:`. How can I use the function so that it does not out the text`? Thanks.


Add links widget to self-hosted blog?

http://en.support.wordpress.com/widgets/links-widget/ discusses a Links widget that makes it easy to create a blogroll in your sidebar. I'm not seeing this widget in my blog by default, and searching the plugins available is not turning it up. Is this feature available to self-hosted blogs? How, if so? Or is this one of those features only available to wordpress.com sites and I'll just have to find another similar widget?


Query unique author ids with published post of type job

I'm trying to come up with a simple query to return an array of unique author IDs that have a post_status of 'publish' and a post_type of 'job'. I know I can query using:               $args = array(     'post_type' => 'job',     'post_status' => 'publish'     );     $published_jobs = new WP_Query( $args );      But this seems horribly inefficient to iterate through the results when all I want is an array of unique author IDs. At most we will have 30 or so authors, but could have thousands of job posts. Any suggestions? Thanks!


Media Library Image search goes to No items found

I have a wordpress site, It contains several images in media library, Those images are uploaded by vary users with admin access, The issue is if try to search image while insert image to post, It will be goes to 'No items Found'., Please help in this. thanks in advance.


How to display subcategory articles in the category view?

I have the wordpress category widget installed on my website that lists all categories/subcategories on my site and their hierachy:               Watch Accessories (1)      - Straps (1)     Watch Glossary (5)     Watch Guides (1)      - Maintenance (1)     Watch News (2)      - New Releases (2)     Watch Reviews (7)      - Christopher Ward (1)      - Hamilton (1)      - Seiko (2)      - Tissot (2)      - Vostok (1)      I am using the following permalink structure:               /%category%/%postname%/      When I click on the parent categories > >     http://www.domain.com/watch-reviews/ >   it shows the category view and lists all articles in that category. But when I click on a subcategory > >     http://www.domain.com/watch-reviews/seiko/ >   it doesn't show the category view, it doesn't list all the articles in the subcategory. Instead it redirects to the first article in the sub category. How can I get Wordpress to display all articles in a subcategory?


Proper use of Output Buffer

I'm attempting to use actions to override function calls I currently have throughout a template (to make updating certain replicated sections easier). For example, in `archives.php` I have the following:               <?php get_header(); ?>              <?php roots_content_before(); ?>         <?php $page_for_posts = get_option( 'page_for_posts' ); if ($page_for_posts) { echo '<h1>' . get_the_title($page_for_posts) . '</h1>'; } ?>         <h3>             <?php                 $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));                 if ($term) {                     echo $term->name;                 } elseif (is_day()) {                     printf(__('Daily Archives: %s', 'roots'), get_the_date());                 } elseif (is_month()) {                     printf(__('Monthly Archives: %s', 'roots'), get_the_date('F Y'));                 } elseif (is_year()) {                     printf(__('Yearly Archives: %s', 'roots'), get_the_date('Y'));                 } elseif (is_author()) {                     global $post;                     $author_id = $post->post_author;                     printf(__('Author Archives: %s', 'roots'), get_the_author_meta('user_nicename', $author_id));                 } else {                     single_cat_title();                 }             ?>         </h3>         <?php echo category_description(); ?>         <?php roots_loop_before(); ?>         <?php get_template_part('loop', 'category'); ?>         <?php roots_loop_after(); ?>         <?php roots_content_after(); ?>          <?php get_footer(); ?>      You can see a few of the functions, like `roots_content_before();` In a separate file, I have the following: `function roots_content_before() { do_action('roots_content_before'); }` and use it as follows:               <?php              add_action('roots_content_before', 'roots_bootstrap_content_before');              function roots_bootstrap_content_before() { ?>                  this is some text              <?php }          ?>      From what I've read, especially if I'm going to have large chunks of code, I should be using the output buffer, but when I try to do this, I'm getting diddly squat:               <?php              add_action('roots_content_before', 'roots_bootstrap_content_before');              function roots_bootstrap_content_before() { ob_start(); ?>                   this is some text                 <?php return ob_get_clean();              }          ?>      Am I thinking of this completely wrong? I am still learning, but have been trying for a bit without any success. Any pointers in the right direction would really be appreciated. Thanks!


Change url tag name

I need to change this url from:               http://www.mydomain.ext/tag/mytag/      to               http://www.mydomain.ext/article/mytag/      Is it possible? Thanks!


how do I display a featured image in a post type?

I have a single-posttype.php and I'm trying to figure out how to display the image


Buddypress send email notification only if user is not logged in

When a member send a message to another member, the recipient receive a message in buddypress and also an email. I want to change that because if you receive many messages, you have too much mail in your mailbox even if you are logged in : I want to receive mail only if I am not logged in buddybress. I have find where adding the code but I don't know how to hooks (add_action or add_filter) The file is : wp-content/plugins/buddypress/bp-messages/bp- messages-notifications.php and the modification is at the end of file, just adding the if test before sending email :               if (!is_user_online($recipient->user_id)) {          wp_mail( $email_to, $email_subject, $email_content );     }      How I can do this without change the core file of buddypress ?


How to have 2 posting pages on a blog

It is possible to have 2 posting pages on a page? I have a static home page and I want to create 2 more pages for my blog which are "News" and "Recent Projects".


Why isn't my if/elseif/else working correctly here?

I am using a simple if/elseif/else bit of code to generate a header image for my page, I can't seem to understand why it isn't working properly. It determines the category of the page being displayed and displays a header accordingly. Here's the code in my header.php:               <?php if (is_category('dino run') || has_category('dino run')) { ?>

Dino Run

                <?php } elseif (is_category('potatoman') || has_category('potatoman')) { ?>
Potatoman Seeks the Troof
     <?php } elseif (is_category('glorkian' || 'glork') || has_category('glorkian' || 'glork')) { ?>
Glorkian Warrior
     <?php } else { ?>
The Pixeljam Octology
     <?php } ?>      The problem I'm having is I click on a post that has a category "Dino Run" and it displays fine... but when I click on a post that doesn't have any of the above 3 defined categories it doesn't fall through to the else statement, it actually displays the third header "Glorkian Warrior". Any ideas what I did wrong here?