title: WooCommerce customer account multiple emails

text: Is there a function to have more than one email address for a user account? basically a customer who makes an order also gets sent a copy of the order to a different email address (cc/bcc)


title: Customizing wp-activate.php

text: Does anyone know how I can customise wp-activate.php? It wraps the content in `<div id="content" class="widecolumn">`, however in my theme the main wrapper is `<div id="main">` Presumably, I could just style `div#content.widecolumn` to be identical to `div#main`. But I am curious if anyone knows how to customise this file without editing it.


title: jQuery .change() Event Bubbling in WP Admin

text: Experiencing some very odd behaviour in WP Admin, specifically on widgets.php. I'm creating a custom widget, and am writing some simple JS. This is the hook I'm using to enqueue my JS:               /**      * Enqeue the admin-side JS.      */     function ni_list_products_scripts( $hook ) {         if( $hook == 'widgets.php' ) {             wp_enqueue_script( 'list_products_scripts', get_template_directory_uri() . '/assets/js/widget-list-products.js', 'jquery' );         }     }     add_action( 'admin_enqueue_scripts', 'ni_list_products_scripts' );      And the actual JS file (simplified just to show the issue):               jQuery(document).ready(function($) {         $("#ni_list_products_search").on('change', function(e) {             console.log('change');         });     });      My end goal is to filter a list of posts, based on the text inputs value, but the .change() event doesn't seem to fire at all. I've tried using .change() as well to no avail. I'm totally stumped. I know the selector is right, and I know the script is being run. In my debugging I tried to do some basic stuff to #ni_list_products_search, and `$("#ni_list_products_search").remove();` does nothing as well. Just so I cover all the bases, the input I'm trying to target: `<input class="widefat" id="ni_list_products_search" type="text">`. I have no idea where to go from here. Any help is greatly appreciated!


title: Disable a plugin's widget

text: I wonder if possible to disable a widget that belongs to a plugin that is currently active w/o touching the plugin code. For sample, I normally use a code like this to disable wordpress widgets,                unregister_widget('WP_Widget_Text');      Now, I want to also deactivate let's say for sample the widget called "The other Widget" is that possible? Thanks in advanced.


title: language support in a custom urdu theme

text: I am planning to start work on an urdu (language in pakistan) website theme. basically, it will be a newspaper themed website. Can anyone tell me how can i add urdu support in my theme. I dont want to change Admin UI language. Just whatever posts/pages I will insert should be in my native language. Any positive ideas will be appreciated. Thanks


title: Auto-remove custom field with no value on publish

text: I got some plugins that auto-generates custom fields. Does anyone know how to automatically remove empty custom fields from post when I press "publish"? A check I can put in my `functions.php` that does a check and removes the custom field if there is no value?


title: Custom Fields and W3 Total Cache

text: I've successfully setup WP + W3TC + Amazon s3 and everything is working fine except a little thing. I've a custom post type with about 10 custom fields with images/audio/video there. All attachments, css, js are being loaded from CDN but not custom field values. In case of attachments, I didn't have to do anything. Can you please if I miss any step? How can I solve the issue? Thanks.


title: Store comments that can be searchable and displayed

text: I am using a theme and plugin that allows you to create a listing of a business and then users can review it like Yelp. The review function works off the comments section and allows users to add a star rating. I was wondering if it's possible to be able to organize these comments on a separate page and have an ability to search them and filter through them? Essentially treating the comments like custom post types and organizing them in a taxonomy. Has anyone seen or heard of an implementation like that before?


title: Show only first child in dropdown

text: I have a dropdown showing a custom taxonomy with multiple levels (children). Below is the code for it. Can someone please explain how I can limit the children shown? For instance, at the moment it shows: > Parent -> Child -> Child of Child I only want it to show: > Parent -> Child Thanks! :)               function my_dropdown_categories( $taxonomy, $current_selected = '', $include = null ) {     // Get all terms of the chosen taxonomy     $terms = get_terms($taxonomy, array('orderby' => 'name'));          // our content variable     $list_of_terms = '<select id="location" data-placeholder="Choose your area..."  class="selectboxSingle" name="location">';          if ( ! is_wp_error( $terms ) ) foreach($terms as $term){              // If include array set, exclude unless in array.         if ( is_array( $include ) && ! in_array( $term->slug, $include ) ) continue;              $select = ($current_selected == $term->slug) ? "selected" : ""; // Note: ==              if ($term->parent == 0 ) {                  // get children of current parent.             $tchildren = get_term_children($term->term_id, $taxonomy);                  $children = array();             foreach ($tchildren as $child) {                 $cterm = get_term_by( 'id', $child, $taxonomy );                 // If include array set, exclude unless in array.                 if ( is_array( $include ) && ! in_array( $cterm->slug, $include ) ) continue;                 $children[$cterm->name] = $cterm;             }             ksort($children);                  // OPTGROUP FOR PARENTS             if (count($children) > 0 ) {             //     $list_of_terms .= '<optgroup label="'. $term->name .'">';                  if ($term->count > 0)                           $list_of_terms .= '<option class ="group-result" value="'.$term->slug.'" '.$select.'>' . $term->name .' </option>';             } else                 $list_of_terms .= '<option value="'.$term->slug.'" '.$select.'>'. $term->name .' </option>';             //$i++;                  // now the CHILDREN.                  foreach($children as $child) {               //   $select = ($current_selected == $child->slug) ? "selected" : ""; // Note: child, not cterm                  $list_of_terms .= '<option value="'.$child->slug.'" '.$select.'>'. $child->name.' </option>';             } //end foreach                  if (count($children) > 0 ) {                 $list_of_terms .= "</optgroup>";             }         }     }          $list_of_terms .= '</select>';          return $list_of_terms;     }


title: Escape current post from loop

text: I'm creating a search widget and for that I use a secondary loop via new WP_Query();               $query = new WP_Query('s=searchTerm');     if ($query->have_posts()){         while ($query->have_posts()){             $query->the_post();             //echo the post         }         wp_reset_postdata();     }     else {         echo 'No results';         die();     }      The problem is that the search query returns the posts that have the search term in their title or content + the current post/page I'm viewing. How can I avoid that ?


title: Best way to integrate existing php application into Wordpress

text: A client of ours has a web application written in PHP, but has commissioned us to develop the front end for the website but wants us to integrate the current PHP web application (a package tracking system) into the Wordpress site (our cohoice). What's the best practice to do this? Making the existing application into a plugin is that an approach? .. Right now the existing web application , requires login and then establishes a session with the user. Can this web app co-exist within Wordpress or do we just need to it in or just link to it as a separate app. are there any best practices for this sort of thing?


title: Submit Custom Postypes from frontend

text:
I am attempting to create a form that submits data and creates a post with custom fields filled. What I would like to do in step form. 1) Create a custom posttype function called "pickups" (I do not know how to do this) 2) Inside Pickups I need a function to created 5 separate columns which will be populated from the post types custom field. 3) Build a Form that will populate those 5 columns as a new postype( _not sure if that is the correct term_ ) 4) Then I need to output this data I am assuming with short code to a page. Here is some code I have found, however parts of it will need to be modified and the postype function will still need to be built. **pickup.php**
     <form id="new_post" name="new_post" method="post" action="">
Name
     <input type="text" id="name" value="" tabindex="1" size="20" name="name" />

Address
     <input type="text" id="address" value="" tabindex="1" size="20" name="address" />

Phone
     <input type="text" id="Phone" value="" tabindex="1" size="20" name="Phone" />
     <?php wp_nonce_field( 'new-post' ); //Apparently needed for security ?>      </form>
          <?     if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {              // Do some minor form validation to make sure there is content         if (isset ($_POST['name'])) {             $name =  $_POST['name'];         } else {             echo 'Please enter a name';         }         // Repeat this for each input field                   // Add the content of the form to $post as an array         $post = array(             'post_name' => $name,             'post_address'  => $address,             'post_phone'    => $phone,              );         wp_insert_post($post);  // Pass  the value of $post to WordPress the insert function                                 // http://codex.wordpress.org/Function_Reference/wp_insert_post         wp_redirect( home_url() );     } // end IF          // Do the wp_insert_post action to insert it     do_action('wp_insert_post', 'wp_insert_post');           ?>


title: How to find taxonomy parent id from child taxonomy page?

text:
This site is in beta at: beta2.dixiestarkhome.com , the page for context is: http://beta2.dixiestarkhome.com/taxon/upholstery/sofas-settees/ my custom taxonomy is "taxon", sofas is a child of upholstery. I want to find the parent taxon, and then do a wp_list_categories on that parent. This is the code that runs the taxon listing:
      <?php      //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)          $taxonomy     = 'taxon';     $orderby      = 'name';      $show_count   = 0;      // 1 for yes, 0 for no     $pad_counts   = 0;      // 1 for yes, 0 for no     $hierarchical = 1;      // 1 for yes, 0 for no     $title        = '';          $args = array(       'taxonomy'     => $taxonomy,       'orderby'      => $orderby,       'show_count'   => $show_count,       'pad_counts'   => $pad_counts,       'hierarchical' => $hierarchical,       'title_li'     => $title,       'depth'        => '1'     );     ?>
     <?php wp_list_categories( $args ); ?>
                <?php      $term = $wp_query->queried_object;     //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)     $args2 = array(       'taxonomy'     => $taxonomy,       'orderby'      => $orderby,       'show_count'   => $show_count,       'pad_counts'   => $pad_counts,       'hierarchical' => $hierarchical,       'title_li'     => $title,       'depth'        => '1',       'child_of'     => $term->term_id          );     ?>
     <?php wp_list_categories( $args2 ); ?>
      If I am on the Uphostery page it works fine and shows the children. If I am on the sofa's page it just says "No Categories" To recap, I need to find the taxon parent and then list the child taxons... Ideas?


title: Shortcode Attribute

text:
I want to assign a title to my column shortcode. Essentially, [column title="nameofcolumn"]content[/columntitle]. But I'm not quite sure what to do after the "=>" or after my div class of title. I've looked for tutorials but I can't find anything specific enough for me to understand.               function column_shortcode( $atts, $content = null ) {         extract(shortcode_atts(array(             'title' => 'WHAT DO I ENTER HERE',         ), $atts));        return '

DO I NEED SOME TEXT HERE?

' . $content . '
';     }          add_shortcode('one_third', 'column_shortcode');      EDIT: Also I'd like to set my 1/3 columns under a row div so I can clear: both. How can I accommodate that?


title: Setting a Master Menu on a Custom Post Type

text:
I am currently developing a site for a car dealership to list their inventory. I have setup the car up as a custom post type. Each post will have children (gallery, features, accessories, etc). I want to have a nav on all of the pages like so:

Gallery
Features
Accessories
      It would be nice to just create a single template like single-car.php and then have the menu in there. The question is, how do I replace the first part of the menu (/ford-escape-lt) with the current page we are on? Is there any way to add classes to the current page item?


title: Display custom post counts for author , not default posts

text:
<?php         global $wp_query;         $curauth = $wp_query->get_queried_object();         $post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type =     photoshop_tutorial' AND post_status = 'publish'");         ?>
Post Count: <?php echo $post_count; ?>
      I've tried with this codes & it shows the whole `photoshop_tutorial` posts count, but what I want is to display for individual author's posts, because I want to add it in author page. For example: > Smith posted `<?php $post_count; ?>` photoshop tutorials How can I do that?


title: Replace title column in post list with post meta value

text: I have created custom post type called booking. It have a meta `booking_first_name`, `booking_last_name`, `booking_email`, `booking_phone`, `booking_phone_contact`. Currently, I succeeded displaying email, phone and mobile phone. ![enter image description here](http://i.stack.imgur.com/VRpf8.png) However, i want to display my post title as `booking_first_name` \+ `booking_last_name`. How could I do that? Here is my current syntax :               <?php     /**      * Register custom admin field      */     add_filter('manage_booking_posts_columns', 'booking_table_head');     function booking_table_head( $defaults ) {         $defaults['booking_email']          = 'Email';         $defaults['booking_contact_phone']  = 'Contact Phone';         $defaults['booking_mobile_phone']   = 'Mobile Phone';         return $defaults;     }          /**      * Fill custom field value      */     add_action('manage_booking_posts_custom_column', 'booking_table_content', 10, 2);     function booking_table_content( $column_name, $post_id ) {            switch ($column_name) {         case 'title':           $first_name = get_post_meta( $post_id, 'booking_first_name', true );           $last_name = get_post_meta( $post_id, 'booking_last_name', true );           echo $first_name . ' ' . $last_name;           break;              case 'booking_email':           $email = get_post_meta( $post_id, 'booking_email', true );           echo $email;           break;              case 'booking_contact_phone':           $contact_phone = get_post_meta( $post_id, 'booking_phone', true );           echo $contact_phone;           break;              case 'booking_mobile_phone':           $mobile_phone = get_post_meta( $post_id, 'booking_phone_mobile', true );           echo $mobile_phone;           break;       }     }


title: Filtering more than one term in a taxonomy in WP

text: i have a custom post type called 'events', it has a taxonomy named 'category' structured this way:      hotels (parent)   -1 star (child)   -2 stars (child)   -3 stars (child)      location (parent)   -loc1 (child)   -loc2 (child)   -loc3 (child)      how do i filter, for example, only the events that belong to 1 star and, at the same time, to loc1 (basically the intersection of 1 star and loc1)?


title: Manage theme related custom posts

text: I want to manage some custom posts and custom fields that have been created by the theme I've installed. In particular I want to change the permalink they are using. There is a way to do so? For example letting WP Types to recognise already existing custom posts?


title: Activate short codes for all post queries?

text: I need to use shortcodes on widgets and various plugins. For widgets I simply used:               add_filter('widget_title', 'do_shortcode');     add_filter('widget_text', 'do_shortcode');      However I cannot figure out how to activate shortcodes for plugins. I noticed all of them get posts with WP_Query and then $post->post_content. Maybe there is a way to filter post queries? How can I activate shortcodes for all post echoes?


title: Return XML of Post Metadata

text: All of my posts in one category (i.e. Location) have two custom fields: latitude and longitude. I would like to return an XML or JSON of all those posts (title, latitude, longitude) for use as Google Maps markers. I can't simply call out to a stand-alone php file to return my data as I would like to access my data through $wpdb. What is the best solution?


title: How to specify width and height in the_content for image attachments

text: When the_content print attachment images (attachment template) it automatocally displays the picture. Is there a hook to specify the width and height of the image displayed?


title: Set Custom Post Type title to the Post's Date

text: I have a custom post type, called 'status' and I have disabled 'title' in the post type. Right now it's setting all posts to have the title "Auto Draft". I want to set up a way to set the title to be the post's date. I think I should be using 'wp_insert_post_data". Right now I am using the following code but it is not working:               function status_title_filter( $data , $postarr )     {          if ($postarr['post_type'] == 'status'){         $date = $data['post_date'];         $data['post_title'] = $date;     }     return $data;     }          add_filter( 'wp_insert_post_data' , 'status_title_filter' , '99' );      Thanks in advance for solving my simple problem. I'm a sort of novice when it comes to this kind of things.


title: Sidebar not visible after changing to new domain

text: I made a change of my existing domain to new domain. I took the backup of the database from old site and imported it into new database Used the search and replace widget to replace the old url with new url But i cant seem to see the sidebar widgets. I can see them on the admin panel but they are not visible on site. Any pointers on what could be the cause. I changed the theme to twentyten and the sidebar is visible


title: Using fallback language with polylang and using pagination in different language leads to page not found

text: Following scenario I am using this in my archive.php to fall back to german in case there are no translations: `if (is_category()) { $categories = get_the_category(); $category_id = $categories[0]->cat_ID; $deCatId = pll_get_term($category_id, "de"); query_posts(array_merge($wp_query->query, array('post_type' => 'post', 'lang' => 'de', 'cat'=>$deCatId))); echo var_dump(query_posts(array_merge($wp_query->query, array('post_type' => 'post', 'lang' => 'de', 'cat' => $deCatId)))); }` Now there are hundreds of posts in the default language which is german (de) but only like 3 posts in english. Now when I want to use pagination to the next page, when using english, I get a "Page Not Found" error. Obviously, because the system thinks there is no page 2 in english, since there are only 3 posts the system thinks there is only the main category page. But since I am using german as a fallback language, there is in fact, a page 2. Just with registered posts in german. Is there a way around this problem?


title: Author ID mismatch from database

text: The author->ID for one particular author is returning a different value than what exists in the database. The database has the author's id as 2, but when I query author->ID, it returns the value 11. So, if I try to use the author's id for any purpose, I get the wrong results. Other functions related to this author work fine. For all other authors, everything works absolutely fine. I am using the coauthors plus plugin.               foreach ( $coauthors as $coauthor ) {     $id = $coauthor->ID;     // some code to fetch author details using $id     }      Here the $id that I get is 11, though it should be 2. For all other authors, I get the right results. And when I add this author to a post, even at that time the dropdown(in the field that coauthor plugin uses to add authors) shows the id as 11. This is what I get with var_dump($coauthors);               array(1) {        [0]=> object(stdClass)#318 (14) {          ["ID"]=> string(2) "11"          ["display_name"]=> string(4) "User1"          ["first_name"]=> string(0) ""          ["last_name"]=> string(0) ""          ["user_login"]=> string(4) "user1"          ["user_email"]=> string(17) "email@gmail.com"          ["website"]=> string(0) ""          ["aim"]=> string(0) ""          ["yahooim"]=> string(0) ""          ["jabber"]=> string(0) ""          ["description"]=> string(0) ""          ["user_nicename"]=> string(4) "user1"          ["type"]=> string(12) "guest-author"      }       Here all values except the ID are correct. I could go ahead and delete this particular user and create a new one. But I have to be sure that it won't happen again. So I am trying to understand what could have caused this. I know this is a very vague question but any help would be great.


title: filter single_cat_title avoiding the breadcrumbs

text:
I'm developing a simple plug in and I need to filter single_cat_title in category page adding some html in every category page. Just doing this:               function subtitleCategory ($title) {         return $title."

TEST1

";     }          add_filter('single_cat_title', 'subtitleCategory');      I get what I need. But I noticed that this filter also apply to the breadcrumbs (there is a call in `breadcrumbs.php`) and this means twice in the same page (not what I need). Do you know if there is a condition that can be applied to filter just the title and not the breadcrumbs? I tried `in_the_loop`, `is_category`, `is_archive`, `is_tax` etc etc without success. \--edit-- Yes, breadcrumbs.php is a theme file and you should not take it in consideration. I'm trying to achieve an admin panel where your can put some text (with html) for every category and this text will be displayed just after the title in the category page. I'm trying to do this with a plug in and, for this reason, this can't be coupled with any theme dependency.


title: Custom meta boxes in RSS feed

text: I've got a few custom meta fields I'd like to be displayed in RSS feeds. Right now they do not because they are not part of `the_content` I reckon. If anyone has any tips for getting this to happen, please let me know! Thanks!


title: WP / Facebook integration - recently read articles

text: Over the last few months I've seen stories popping up in my timeline from various newspapers and websites where people have read certain articles, for example somebody has read a story on yahoo or guardian etc... ( examples here ) Is there a WP plugin to achieve this or is this a standalone FB app that would have to be developed?


title: add meta box - custom field : which to choose?

text: i've just find out about the custom field, which makes it possible to add something near a post, but what is the difference between "add_meta_box" and "custom field"? Custom field is inside the "supports" line, when we register a post type, so : isn't it easier to create a custom field than a add meta box? or are there many differences between both?


title: Create own Wordpress shortcode gallery

text: How I can handle this shortcode:   [my_gallery]   img01.jpg   img02.jpg   img03.jpg   img04.jpg   [/my_gallery] I can't understand how to write a function, to handle image files name.


title: How to divide and display categories into two columns

text: I am using custom taxonomies. I have multiple categories and each category has multiple children. I would like to display the categories in two columns on my homepage similar to linkcentre.com. I tried using wp_list_categories but could not split its output into two columns. I tried this solution but it only works when there are no subcategories. Thanks


title: add featured image dialog box disappear

text: I have a test site here (with WordPress 3.2.1) Since I activate the multisite support, the **add featured image** disappear. I try to deactivate all the plugin and activate the **default theme** (twenty eleven with has add_theme_support ('post-thumbnail') by default) but nothing change. The post thumbnail show up normaly on the **front** but I can't edit them without this dialog box. Of course, I checked on the "option" tab and nothing appear too for the post thumbnail feature. * * * **When I use WP_DEBUG, I get:** Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /home/patricet/public_html/wp- testsite/academie-sophro-v2/wp-includes/functions.php on line 3382 Notice: has_cap is called with an argument which is deprecated since version 2.0! The use of levels of user extensions and themes now prohibited. Use roles and capabilities in place. in / home/patricet/public_html/wp- testsite/academie-sophro-v2/wp-includes/functions.php on line 3466 **In console (with Firebug) for .js I get:** The use of the property "nodeValue" of an attribute is deprecated. Use "value" instead * * * **I can create an editor account if you need** Do you have a solution, an idea? Thanks!


title: How do I escape a ']' in a short code?

text: How do I escape a right bracket in a short code? I'm working on a Google Map plugin that has encoded points. Sometimes the polygons have the ] in it, which makes WP think that it's the end of the shortcode. For example:               [my_shortcode latitude='36.93'  longitude='-72.98' encoded_points='ortlF~g]tM?cZEH`z]}|@DQfi]' ]      I've tried `]` which is isn't causing a problem for WP, but it is causing a problem for my Google map code. I could use Regex to replace ], but maybe there is a simpler way. Does shortcode have an escape character?


title: Exclude one item from wp_list_pages( $args );

text: I have a menu that is currently shown with `wp_list_pages( 'title_li=' );` This shows all the sub pages from all the pages in the menu. I want to exclude a page with id 56 from displaying its sub items. When I use `wp_list_pages( 'exclude=56&title_li=' );` the menu becomes huge and all over the page. When I use wp_list_pages( 'exclude=56' ); the menu gets messed up (vertical instead of horizontal (no li) and all of them are displayed. How can I fix this?


title: See some statistics about the comments

text: Is there a way or a plugin so that I can see statistics for may comments and commenters? Like top commenters, most commented post, etc. Thanks, Alex


title: AddThis Sharing Bar Not Displaying on Custom Page Template - JS conflict?

text: http://www.headcount.org/a-real-whodunnit-the-oil-spill-blame-game/ \- on the single posts the sharing bar displays. http://www.headcount.org/blog/ \- on the blog archive page it doesn't (even after choosing archive, category, index as options within the AddThis option, though I have not chosen excerpts at this point because that's not what we want). This page uses the_content, not get_the_content, and when I view the source, I can SEE the bar in the source below the post meta, but it's just not displaying. Any thoughts as to why it's not showing on this particular page? I've deactivated all the plugins and that didn't fix it. AddThis support suggests that it's then an issue with the JS in the theme itself, but javascript isn't in my strong skill set - I need help sorting that out. I've just started working with this client so I'm still learning my way around their installation.


title: Setting post_id for single.php based on URL without a redirect

text: I'm migrating a Joomla! database to Wordpress and the website has to remain exact regarding URLs. The Joomla site has its posts with .html extensions, and the importer I created maps the Joomla file URL to the Wordpress post_name as such: joomla-site.com/Title-of-Joomla-Content.html -> Wordpress DB::post_name title- of-joomla-content I can access right-out-of-the-box the post on the Wordpress install by of course: wordpress-site.com/Title-of-Joomla-Content But I need to change how the permalink system responds. I don't want to use a redirect (which shows in headers), so I'm trying to hook in a function that will select the post ID differently if the URL ends with .html. Since Wordpress only is activated when a file is not found, real .html files are unaffected. So having a blanket check and change function for any .html files isn't a problem. I've attempted this:               function custom_redirect() {      global $post_id,$wpdb;      if (substr($_SERVER['REQUEST_URI'],-5) == '.html') {         $check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name=%s AND post_status = 'publish'",substr(basename($_SERVER['REQUEST_URI']),0,-5)));         if ($check > 0) $post_id = $check;         // Need to set the post ID for the wp_query here.      }     }          if (!is_admin()) add_action( 'init', 'custom_redirect' );      The above code correctly selects the post ID correctly, but I'm not sure what function or hook to use to force the post (single.php) to display it. I was able to use the following to set the post ID for every archive.php run, but this doesn't affect the single.php file which simply calls the function the_post.               function force_ID($query) {      $query->set('post_id', '96');     }     add_action('pre_get_posts','force_ID');      I have a feeling it might be something simple like changing a global instance of $wp_query, but I'm not sure the best way to do this. Using an init hook probably is too high in the order of execution too.


title: Passing postid of Testimonial Custom Post in Shortcode Parameter

text:
I am trying to create Testimonial custom post and display using shortcode               function create_post_type() {         register_post_type(             'testimonials',//new post type             array(                 'labels' => array(                     'name' => __( 'Testimonials' ),                     'singular_name' => __( 'Testimonial' )                 ),                 'public' => true,                 'supports' => array('title','editor','thumbnail','custom_fields'),                 'hierarchical' => false             )         );       }     add_action( 'init', 'create_post_type' );          //adding the URL meta box field     function add_custom_metabox() {         add_meta_box( 'custom-metabox', __( 'Link' ), 'url_custom_metabox', 'testimonials', 'side', 'low' );     }     add_action( 'admin_init', 'add_custom_metabox' );          // HTML for the admin area     function url_custom_metabox() {         global $post;         $urllink = get_post_meta( $post->ID, 'urllink', true );              //validating!         if ( ! preg_match( "/http(s?):\/\//", $urllink ) && $urllink != "") {             $errors = "This URL isn't valid";             $urllink = "http://";         }               // output invlid url message and add the http:// to the input field         if( isset($errors) ) { echo $errors; }     ?>
         URL:
             <input id="siteurl" size="37" name="siteurl" value="<?php if( isset($urllink) ) { echo $urllink; } ?>" />
     <?php     }          //saves custom field data     function save_custom_url( $post_id ) {         global $post;                 if( isset($_POST['siteurl']) ) {             update_post_meta( $post->ID, 'urllink', $_POST['siteurl'] );         }     }     add_action( 'save_post', 'save_custom_url' );          //return URL for a post     function get_url($post) {         $urllink = get_post_meta( $post->ID, 'urllink', true );              return $urllink;     }          //registering the shortcode to show testimonials     function load_testimonials($a){              $args = array(             "post_type" => "testimonials",             "id"       =>  $post->ID         );              if( isset( $a['rand'] ) && $a['rand'] == true ) {             $args['orderby'] = 'rand';         }         if( isset( $a['max'] ) ) {             $args['posts_per_page'] =(int) $a['max'];         }         if( $a['id'] ) {         $posts_in = array_map( 'intval', explode( ',',$a['id'] ) );         $args['post__in'] = $posts_in;         }         //getting all testimonials         $posts = get_posts($args);              echo '
';             echo '
';                  foreach($posts as $post)             {                      $url_thumb = wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID));                 $link = get_url($post);                 echo '
';                 echo '
';                     if ( ! empty( $url_thumb ) ) { echo ''; }                     if ( ! empty( $post->post_content ) ) { echo '
'.$post->post_content.'
'; }                     echo '
'.$post->post_title.'
';                     if ( ! empty( $link ) ) { echo 'Visit Site
'; }                 echo '
';                 echo '
';             }                  echo '
';         echo '
';     }     add_shortcode("testimonials","load_testimonials");          add_filter('widget_text', 'do_shortcode');      and the shortcode for display i used is               <?php echo do_shortcode('[testimonials id=3751]'); ?>      I want to pass post id in shortcode and display that particular post id in my page. I am trying to do this but it not showing any output please suggest me where i am wrong your suggestions help me a lot.


title: Static Page > Post Page displays data from latest blog post instead of the page details

text:
Background I have created a Page called Blog. I have selected "A Static Page" > Post Page > Blog In the "home.php" I am displaying all post with `while(have_post())` This is working fine. It is displaying all post. The issue I am having is when I return the page title with `<?php the_title(); ?>` is returns the most recent post's title which is "Post 6" instead of "Blog" the name of the page. I am also displaying the content of the "blog" page as well but again it is displaying the content of the most recent post. So how do I display the page content of the page blog?               <?php get_header(); ?>          <?php the_title(); ?>

     <?php if ( have_posts() )  { ?>
             <?php                  while ( have_posts() ) {                 the_post();             ?>
                      <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">                     <?php if ( has_post_thumbnail() ) { ?>                         <?php echo get_the_post_thumbnail(); ?>                     <?php } ?>
<?php the_title(); ?>
                     <?php the_excerpt(); ?>
                  <?php } ?>
              <?php } else { ?>         No Post         <?php } ?>

         <?php get_sidebar(); ?>

           <?php get_footer(); ?>      **ANSWER** This did the trick $news_page = get_queried_object(); echo $news_page->post_title;


title: How To Download WordPress Audio Attachments

text: I've been searching high and low trying to figure out how to create download links for audio files uploaded to a post. I know how to display the audio url directly into the theme template, but when it's clicked, it just starts to stream the audio right in the browser. I need a way to prompt the file to download once clicked. Looking for more of a snippet for the functions.php file than a plugin.


title: Trouble using wordpress functions in a pop-up modal form

text: I'm working on a plugin and I've added a button to the tinymce editor that pops up a modal form, with options for the shortcode, and then inserts the shortcode with the selected options in to the post. The modal pops up a php file with an html form and some javascript in it. I'd like to use wp_dropdown_categories() inside of the form instead of having a text input for cats. Here's a snippet. I have the original textbox I was using for category commented out and I was trying to stick that wp function in instead but it's not working. WHat am I missing here? I can't figure out if there's something I need to be calling like a class or some global variable.                   <?php          ?>             <head>         <title>Box Shortcode</title>               ...Some more html and some js...                          <input type="radio" name="tax" value="category" id="selcat">              <?php wp_dropdown_categories(); ?> //This doesn't work                   <!--<div class="input-append">             <input type="text" name="category" id="catselection" class="categorynamebox" placeholder="Category" value="" disabled="disabled" />         </div>-->         <label for="randomcat">         <input type="checkbox" id="randomcat" disabled="disabled" >         Use a random category         </label>              ..some more html and js...              </body>         <?php              ?>


title: Drop Down Filter with CPT as Options for Search Form

text: I am trying to figure out how to create a drop down to use as a filter with the search form. I would like the options to be the different post types. I've seen on other sites that -               <select name="posttype">             <option name="product" value="product" style="color: #000;">Legal Documents</option>             <option name="videos" value="videos">Legal Advice - Videos</option>     <option value="link">Legal Advice - Links</option>     <option value="text">Legal Advice - Articles</option>              <option value="post_type_c">An Attorney</option>         </select>      What do I have to change or add to the search results page so that then correct post types are shown and filtere?


title: How to integrate noimage picture in this code

text: How can i integrate a image if there is no attached image? I'm using this code with success to integrate no-image picture if is no picture is attached to post.               <?php     if ( ! $img = get_field('img_actor', $post_object->ID ) )         $img = '/wp-content/uploads/noimage1.jpg';     ?>     <img class="actor_img" src="/scripts/timthumb.php?src=<?php echo urlencode($img); ?>&h=70&w=50&zc=1"      Ok for this, but how can I integrate this code into my GD Star Rating code. Gd Star Rating is a plugin that rate's the posts - GD Star Rating               foreach ($all_rows as $row) {         if ($widget["image_from"] == "content") {          $row->image = gdFunctionsGDSR::get_image_from_text($row->post_content);         }      else if ($widget["image_from"] == "custom") {          $post_custom_id = get_post_meta($row->post_id, $widget["image_custom"], true);     $row->image = get_bloginfo('url')."/scripts/timthumb.php?src=".get_bloginfo('url')."/wp-content/uploads/".get_post_meta($post_custom_id,"_wp_attached_file",true)."&h=70&w=55&zc=1";              }                                 }      The link for full code https://github.com/MaineLearning/MaineLearning/blob/master/wp- content/plugins/gd-star-rating/code/t2/render.php How i add in a page to display the count of posts.               <?php      wp_gdsr_render_rating_results(array('template_id' => 48, 'rows' => 1, 'select' => 'persoane', 'min_votes' => 0, 'min_count' => 0, 'excerpt_words' => 0, 'image_from' => 'custom', 'image_custom' => 'img_actor', 'image_resize_x' => 55, 'image_resize_y' => 70, 'publish_days' => 1, 'rating_size' => '12', 'review_size' => '12', 'rating_thumb_size' => '12'));     ?>


title: Show posts from two or more custom taxonomy terms

text: I want to show posts which are filed 2 or more custom taxonomy terms. For example, I want to show the posts from custom post type "Classified" and filed under Books _and_ House terms. The code below show posts which are marked in _either_ of the terms. I want only the posts marked in _both_ the terms:               $args = array(         'posts_per_page' => 10,  // Number of posts per page         'post_type' => 'classifieds',   // Custom Post Type like Movies         'tax_query' => array(             array(                 'taxonomy' => 'classifieds_tags',   //Custom Taxonomy Name like Genre                 'field' => 'slug',                 'terms' => array(                     'books',    //Tags or Categories like Drama or Comedy                     'houses'                 )             )         )     );


title: Return value of add_menu_page

text: I've read this on codex and seem some themes use it but never understood how it worked. > `(string) $hookname` used internally to track menu page callbacks for > outputting the page inside the `global $menu` array I can't seem to understand the codex's explanation. Can some one enlighten me on how can we use the return value and what are the uses of it?


title: WP-PageNavi gives me a 404 when using WP Query

text:
I see that there are a lot of similar questions here at WPSE, and I've tried many of the suggestions mentioned trying to solve my problem but with no success. I have a category called News. In this category I want to run a custom query using WP Query to fetch and display articles, spread out through multiple pages using the plugin WP-PageNavi. I manage to get the plugin to display the links (go back/forward or to a particular page) but when I click on either one I end up with a 404 page. My permalink settings is "category/post-name/", for example I have "x.com/news/sample-news/. When trying to access let's say "x.com/news/page/2/" it gives me a 404. Here's the code -               <?php $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $news = new WP_Query( array('category' => 3, 'paged' => $paged, 'posts_per_page' => 4, 'orderby' => 'date', 'order' => 'DESC') );     while ($news->have_posts()) : $news->the_post(); ?>
     <?php the_post_thumbnail( array(466,9999), true ) ?>
<?php the_title() ?>

<?php the_date() ?>
     <?php the_content() ?>
          <?php endwhile; if($news->max_num_pages>1)      if(function_exists('wp_pagenavi'))     wp_pagenavi( array('query' => $news) );?>      Using these plugins: Advanced Custom Fields, WP-PageNavi


title: No HTML/Visual mode option in admin panel (New Post)

text: There is no option for switching html to visual mode in add new post page of my admin panel there is no js error in console reinstalled WP from WP updates admin panel too, and there are no 404 on any js file either home page url is http://bankpo.in couldnt upload image so giving a link for screenshot http://img641.imageshack.us/img641/3476/clipboard02lr.jpg


title: why does twenty eleven theme mix up the css measurement units?

text: I'm wondering why does WordPress's default theme mix up the css measurement units? For example:               .one-column.singular #author-info {     margin: 2.2em -8.8% 0;     padding: 20px 8.8%;}      Wouldn't be easier to understand and to work if all them were pixel based? Thanks


title: Give users a maximum upload capacity; limit the number of files a user can upload OR limit the number of files per upload

text: I'm using the Media Library on the front end of my website and I'd like to stop users from being able to spam my server by uploading an unlimited number of files. As such, I'd like to do one or maybe all of the below:   1. Give users a maximum upload capacity; i.e. users can upload up to 10 megabytes of files.   2. Limit the number of files a user can upload on a per-post basis   3. Limit the number of files a user can upload when they click the "Insert" button, i.e. the Flash uploader and Classic uploader will only let you upload, for instance, 2 files at a time. None of these are bullet-proof but they'd hopefully make such "spamming" a difficulty. Thanks in advance,


title: Exclude plugins on Main site on Multisite installation?

text: I am using wordpress Multisite installation . 1)I want to run my website faster .Especially the main site.There are near about 50 plugins .I want to exclude many of these plugins on Main site and activate to other sub-sites.Could any body tell me how to do it? I have other three questions related to plugins on multisite installation: 2)Is there any chance for too much load on server or trouble loading pages if I Use 50 + plugins? 3)For two months I installed many plugins and un-installed them .Now i doubt that if the traces of these deleted plugins affect the server load. Is that true? If so how can I get rid of them ? 4)Some of the plugins would be activated on some sub-sites and active on some other sub-sites.So does the plugins on the sub-sites which are not active affect the server load? Thanks in Advance !


title: Trying to hide buttons from Attachment window

text: To simplify the Media Library layout to users when uploading an image, sometimes i hide the following fields:               function myAttachmentFields($form_fields, $post) {              if ( substr($post->post_mime_type, 0, 5) == 'image' ) {                $form_fields['image_alt']['value'] = '';      $form_fields['image_alt']['input'] = 'hidden';           $form_fields['post_excerpt']['value'] = '';      $form_fields['post_excerpt']['input'] = 'hidden';           $form_fields['post_content']['value'] = '';      $form_fields['post_content']['input'] = 'hidden';           $form_fields['url']['value'] = '';      $form_fields['url']['input'] = 'hidden';           $form_fields['align']['value'] = 'aligncenter';      $form_fields['align']['input'] = 'hidden';           $form_fields['image-size']['value'] = 'thumbnail';      $form_fields['image-size']['input'] = 'hidden';           $form_fields['image-caption']['value'] = 'caption';      $form_fields['image-caption']['input'] = 'hidden';              }              return $form_fields;          }          add_filter('attachment_fields_to_edit', 'myAttachmentFields');      Question: How do I hide the Insert into post button and the Set image text link. Thanks in advance


title: Making a wordpress page the index on the site?

text: Is it possible to make a "page, not a blog post" the main entry on your site? I'd like to be able to create a summary of the latest content as the first page the user visits on my site. I'm using Wordpress 3.0.3


title: Include latest author posts with pagination in single template?

text:
I've inserted a `WP_Query` in my single.php template to show the last 12 posts of an author. Everything works ok, the 12 posts are being shown. Now, I want to have it paginated. So the user can see more than 12 posts. Here is my `WP_Query` and pagination code:               <?php                      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;                      $args = array(                     'author'=> get_the_author_meta( 'ID' ),                       'posts_per_page' => 12,                       'paged'          => $paged,                       'order'    => 'DESC',                          'post_type' => 'post',                          );                     $query1 = new WP_Query( $args );                          // The Loop                      while ( $query1->have_posts() ) : $query1->the_post();                           get_template_part( 'content', get_post_format() );                      endwhile;            ?>
<?php _e( 'Post navigation', 'twentytwelve' ); ?>

<?php next_posts_link( __( '← Older posts', 'twentytwelve' ), $query1->max_num_pages ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'twentytwelve' ) ); ?>
               <?php wp_reset_postdata(); ?>      Nothing is shown for page 2.


title: Connecting Wordpress gallery to custom categories (taxonomy)

text:
I want to use the Wordpress gallery to show all pictures of one category in a gallery (on a fixed page), which I do not have to update all the time by inserting the pictures manually. So I added the category feature into media with this function:               function is_add_categories_to_attachments() {     register_taxonomy_for_object_type( 'category', 'attachment' );     }     add_action( 'init' , 'is_add_categories_to_attachments' );      Great, that worked. In the media menu I can add as many categories I want to now. In my case I made three of them, named alpha, beta and gamma. Then I wanted to post a gallery on a fixed page with one category:               [gallery type="squares" category="alpha" order="DESC" orderby="ID" link="file"]      But that did not work and I had to use the post_gallery filter in my child's functions.php, so that I can change the code there, but I have absolutely NO CLUE how to enter the category recognisation into that gallery_shortcut:               function is_gallery($output, $attr) {     $post = get_post();          static $instance = 0;     $instance++;          if ( ! empty( $attr['ids'] ) ) {         // 'ids' is explicitly ordered, unless you specify otherwise.         if ( empty( $attr['orderby'] ) )             $attr['orderby'] = 'post__in';         $attr['include'] = $attr['ids'];     }          // Allow plugins/themes to override the default gallery template.     $output = apply_filters('post_gallery', '', $attr);     if ( $output != '' )         return $output;          // We're trusting author input, so let's at least make sure it looks like a valid orderby statement     if ( isset( $attr['orderby'] ) ) {         $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );         if ( !$attr['orderby'] )             unset( $attr['orderby'] );     }          extract(shortcode_atts(array(         'order'      => 'ASC',         'orderby'    => 'menu_order ID',         'id'         => $post ? $post->ID : 0,         'itemtag'    => 'dl',         'icontag'    => 'dt',         'captiontag' => 'dd',         'columns'    => 3,         'size'       => 'thumbnail',         'include'    => '',         'exclude'    => '',         'link'       => ''     ), $attr, 'gallery'));          $id = intval($id);     if ( 'RAND' == $order )         $orderby = 'none';          if ( !empty($include) ) {         $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );              $attachments = array();         foreach ( $_attachments as $key => $val ) {             $attachments[$val->ID] = $_attachments[$key];         }     } elseif ( !empty($exclude) ) {         $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     } else {         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     }          if ( empty($attachments) )         return '';          if ( is_feed() ) {         $output = "\n";         foreach ( $attachments as $att_id => $attachment )             $output .= wp_get_attachment_link($att_id, $size, true) . "\n";         return $output;     }          $itemtag = tag_escape($itemtag);     $captiontag = tag_escape($captiontag);     $icontag = tag_escape($icontag);     $valid_tags = wp_kses_allowed_html( 'post' );     if ( ! isset( $valid_tags[ $itemtag ] ) )         $itemtag = 'dl';     if ( ! isset( $valid_tags[ $captiontag ] ) )         $captiontag = 'dd';     if ( ! isset( $valid_tags[ $icontag ] ) )         $icontag = 'dt';          $columns = intval($columns);     $itemwidth = $columns > 0 ? floor(100/$columns) : 100;     $float = is_rtl() ? 'right' : 'left';          $selector = "gallery-{$instance}";          $gallery_style = $gallery_div = '';     if ( apply_filters( 'use_default_gallery_style', true ) )         $gallery_style = "         ";     $size_class = sanitize_html_class( $size );     $gallery_div = "
";     $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );          $i = 0;     foreach ( $attachments as $id => $attachment ) {         if ( ! empty( $link ) && 'file' === $link )             $image_output = wp_get_attachment_link( $id, $size, false, false );         elseif ( ! empty( $link ) && 'none' === $link )             $image_output = wp_get_attachment_image( $id, $size, false );         else             $image_output = wp_get_attachment_link( $id, $size, true, false );              $image_meta  = wp_get_attachment_metadata( $id );              $orientation = '';         if ( isset( $image_meta['height'], $image_meta['width'] ) )             $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';              $output .= "<{$itemtag} class='gallery-item'>";         $output .= "             <{$icontag} class='gallery-icon {$orientation}'>                 $image_output             </{$icontag}>";         if ( $captiontag && trim($attachment->post_excerpt) ) {             $output .= "                 <{$captiontag} class='wp-caption-text gallery-caption'>                 " . wptexturize($attachment->post_excerpt) . "                 </{$captiontag}>";         }         $output .= "</{$itemtag}>";         if ( $columns > 0 && ++$i % $columns == 0 )             $output .= '
';     }          $output .= "

\n";          return $output;     }     add_filter("post_gallery", "is_gallery",10,2);      Can you show me how to insert the category feature into the galley_shortcode? Thank you in advance. * * * Would that be correct then?               function is_gallery($output, $attr) {     $post = get_post();          static $instance = 0;     $instance++;          if ( ! empty( $attr['ids'] ) ) {     // 'ids' is explicitly ordered, unless you specify otherwise.     if ( empty( $attr['orderby'] ) )         $attr['orderby'] = 'post__in';     $attr['include'] = $attr['ids'];     }          // Allow plugins/themes to override the default gallery template.     $output = apply_filters('post_gallery', '', $attr);     if ( $output != '' )     return $output;          // We're trusting author input, so let's at least make sure it looks like a valid     orderby statement     if ( isset( $attr['orderby'] ) ) {     $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );     if ( !$attr['orderby'] )         unset( $attr['orderby'] );     }          extract(shortcode_atts(array(     'order'      => 'ASC',     'orderby'    => 'menu_order ID',     'id'         => $post ? $post->ID : 0,     'itemtag'    => 'dl',     'icontag'    => 'dt',     'captiontag' => 'dd',     'columns'    => 3,     'size'       => 'thumbnail',     'include'    => '',     'exclude'    => '',     'link'       => ''     ), $attr, 'gallery'));          $id = intval($id);     if ( 'RAND' == $order )     $orderby = 'none';          $beta_attachments = new WP_Query( array(     'post_type' => 'attachment',     'post_status' => 'inherit',     'posts_per_page' => 0,     'category_name' => 'beta', // note: use category SLUG     ) );          $beta_id_array = array();     foreach ( $beta_attachments as $beta ) {     $beta_id_array[] = $beta->ID;     }     $beta_ids = implode( ',', $beta_id_array );          $gamma_attachments = new WP_Query( array(     'post_type' => 'attachment',     'post_status' => 'inherit',     'posts_per_page' => 0,     'category_name' => 'gamma', // note: use category SLUG     ) );          $gamma_id_array = array();     foreach ( $gamma_attachments as $gamma ) {     $gamma_id_array[] = $gamma->ID;     }     $gamma_ids = implode( ',', $gamma_id_array );          $alpha_attachments = new WP_Query( array(     'post_type' => 'attachment',     'post_status' => 'inherit',     'posts_per_page' => 0,     'category_name' => 'alpha', // note: use category SLUG     ) );          $alpha_id_array = array();     foreach ( $alpha_attachments as $alpha ) {     $alpha_id_array[] = $alpha->ID;     }     $alpha_ids = implode( ',', $alpha_id_array );          if ( !empty($include) ) {     $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );          $attachments = array();     foreach ( $_attachments as $key => $val ) {         $attachments[$val->ID] = $_attachments[$key];     }     } elseif ( !empty($exclude) ) {     $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     } else {     $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     }          if ( empty($attachments) )     return '';          if ( is_feed() ) {     $output = "\n";     foreach ( $attachments as $att_id => $attachment )         $output .= wp_get_attachment_link($att_id, $size, true) . "\n";     return $output;     }          $itemtag = tag_escape($itemtag);     $captiontag = tag_escape($captiontag);     $icontag = tag_escape($icontag);     $valid_tags = wp_kses_allowed_html( 'post' );     if ( ! isset( $valid_tags[ $itemtag ] ) )     $itemtag = 'dl';     if ( ! isset( $valid_tags[ $captiontag ] ) )     $captiontag = 'dd';     if ( ! isset( $valid_tags[ $icontag ] ) )     $icontag = 'dt';          $columns = intval($columns);     $itemwidth = $columns > 0 ? floor(100/$columns) : 100;     $float = is_rtl() ? 'right' : 'left';          $selector = "gallery-{$instance}";          $gallery_style = $gallery_div = '';     if ( apply_filters( 'use_default_gallery_style', true ) )     $gallery_style = "     ";     $size_class = sanitize_html_class( $size );     $gallery_div = "
";     $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );          $i = 0;     foreach ( $attachments as $id => $attachment ) {     if ( ! empty( $link ) && 'file' === $link )         $image_output = wp_get_attachment_link( $id, $size, false, false );     elseif ( ! empty( $link ) && 'none' === $link )         $image_output = wp_get_attachment_image( $id, $size, false );     else         $image_output = wp_get_attachment_link( $id, $size, true, false );          $image_meta  = wp_get_attachment_metadata( $id );          $orientation = '';     if ( isset( $image_meta['height'], $image_meta['width'] ) )         $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';          $output .= "<{$itemtag} class='gallery-item'>";     $output .= "         <{$icontag} class='gallery-icon {$orientation}'>             $image_output         </{$icontag}>";     if ( $captiontag && trim($attachment->post_excerpt) ) {         $output .= "             <{$captiontag} class='wp-caption-text gallery-caption'>             " . wptexturize($attachment->post_excerpt) . "             </{$captiontag}>";     }     $output .= "</{$itemtag}>";     if ( $columns > 0 && ++$i % $columns == 0 )         $output .= '
';     }          $output .= "

\n";          return $output;     }     add_filter("post_gallery", "is_gallery",10,2);      ## Update hi Chip, I understood your idea/solution now and tried it (well, copied it over thanks to you). I think the logic is working, but in practise use it does not. I used the code like that and it does not "see" the categories. Therefore it just shows an empty content (below navigation, of course). people.php:                <?php      /**      * Template Name: People Gallery      */           get_header(); ?>          <?php          $people_attachments = new WP_Query( array(     'post_type' => 'attachment',     'post_status' => 'inherit',     'posts_per_page' => 0,     'category_name' => 'people', // note: use category SLUG     ) );          $people_id_array = array();          if ( $people_attachments->have_posts() ) : while ( $people_attachments->have_posts() ) : $people_attachments->the_post();          $people_id_array[] = get_the_ID();          endwhile; endif;     // Important!     wp_reset_postdata();          $people_ids = implode( ',', $people_id_array );          echo do_shortcode( '[gallery link="file" columns="5" order="DESC" orderby="ID" include="' . $people_ids . '"]' );          ?>          <?php var_dump( $people_id_array ); ?>          <?php // get_sidebar(); ?>          <?php get_footer(); ?>      Working now


title: Limit roles displayed in users.php depending on custom role

text: I have setup my WordPress installation with a custom role called **'regional_manager'** I have given this role the capability to add_users and managed to create a custom snippet for my functions.php file which only lists subscribers in the Role drop down. This means that the regional_manager role can only create new users with a role of subscriber. Now I would like to prevent them from seeing all other users when they go to               www.mydomain.com/wp-admin/users.php      Is there a simple way to do this and does anyone have an example of something similar they can point me in the direction of?


title: Remove last comma from this query

text: I'm having trouble fixing this for working in ie8, i find out thats last comma is problem, but dont know how to fix it. this is current code.               <?php $args = array( 'post_type' => 'katalog', 'posts_per_page' => 999 );     $loop = new WP_Query( $args );      if ($loop->have_posts()) :      while ($loop->have_posts()) : $loop->the_post(); ?>          <?php global $post; $thumb=wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full'); $thumb2=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium'); $url = rwmb_meta( 'smb_katalozi' ); ?>     {image : "<?php echo $thumb[0] ?> ", title : "<?php echo get_the_title() ?>", url : "<?php echo post_permalink( $url ); ?>"},          <?php endwhile; else: endif; ?>      and the output is this               {image : "img url", title : "title", url : "url"},     {image : "img url", title : "title", url : "url"},      and i want it to be               {image : "img url", title : "title", url : "url"},     {image : "img url", title : "title", url : "url"}      so, its different just by last comma. * * * Got it to work with this code               <?php         $args = array( 'post_type' => 'katalog', 'posts_per_page' => 999 );         $loop = new WP_Query( $args );          $post_count = 0;         $te = $loop->post_count;         $total = $te-1;         if ($loop->have_posts()) :          while ($loop->have_posts()) : $loop->the_post();          global $post;  $thumb=wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full'); $thumb2=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium'); $url = rwmb_meta( 'smb_katalozi' );         if ($post_count == 0 || $post_count !== $total) { ?>             {image : "<?php echo $thumb[0] ?> ", title : "<?php echo get_the_title() ?>", url : "<?php echo post_permalink( $url ); ?>"},         <?php } if ($post_count == $total) { ?>             {image : "<?php echo $thumb[0] ?> ", title : "<?php echo get_the_title() ?>", url : "<?php echo post_permalink( $url ); ?>"}         <?php }         $post_count++;         endwhile; else: endif;         ?>


title: How to check "From Email" via WordPress before an email is sent

text: Is it possible to check an email from email via WordPress before an email is sent? I'm working on a phpmailer plugin to send WordPress email via Amazon SES (which requires all emails to be verified). I'm using WordPress multisite and would like to set a different verified email per site. So I would like to know if it is possible to get the variable that contains the from email to accomplish something similar to the following.               if(fromEmailVaribale == 'info@example.com'){      //Set from email       $phpmailer->SetFrom('info@example.com', 'Example.com');     }else{      //Set from email       $phpmailer->SetFrom('services@example.com', 'Services Example.com');     }


title: Handling embedded videos in excerpts

text:
Background: I have a multisite install, where users have their own blogs. I'm working on a page for the main site which will list the most recently updated blogs and excerpts from the first three (WIP version here: http://threemix.co.uk/blog-network/ ) One of my users runs a video blog. Unfortunately, this messes up the excerpts when his is one of the most recent three updated blogs: more specifically, neither the excerpt nor a link to the post show (his blog is "Greg Does Reading" on the link above).
         <?php         $thisblogid = get_current_blog_id();         $blogs = get_last_updated('', 1, 12);         $blogno = 1;               foreach ($blogs as $blog) :              switch_to_blog($blog['blog_id']);              global $post;              $myposts = get_posts(array('numberposts'=>1));          ?>              <?php if ($blogno == 1) { ?>
         <?php } if ($blogno >= 1 && $blogno <= 3) { ?>             <li class="fresh col-<?php echo (($blogno % 3)); ?> <?php if (count($myposts) == 0) : echo('no-posts'); endif;?>">
<hgroup>             <a href="<?php bloginfo('url'); ?>">
<?php bloginfo('title'); ?>
             </hgroup>
             <?php $i = 0; foreach ($myposts as $post) : setup_postdata($post); ?>
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                 <?php echo get_my_excerpt(15); ?>
             <?php $i++; endforeach; ?>

         <?php } if ($blogno == 3) { ?>
         <?php } if ($blogno > 3) {              // if not one of the first three posts ?>                 //ommitted for brevity                      <?php } $blogno++?>          <?php endforeach; ?>          <?php switch_to_blog($thisblogid) ; ?>
      The first three posts are generated in the inner tags. I am switching to each blog in order, taking the $post object of the most recent post, and using it in a custom loop. Two questions:   1. Why is the post's title not showing up? I can understand why the excerpt isn't, but not the post title.   2. How can I change my get_my_excerpt() function (which at the moment, just changes the length of the excerpt), to include embedded YouTube videos?


title: Shouldn't this be easy?! Custom post type/custom taxonomy permalink

text: So this is driving me absolutely insane. I've spend days trying to fix this and I can't work out why this is so difficult as surely this is a very common permalink structure! I looked through hundreds of answers and posts and none of them seem to solve the problem. I simply want this structure:               mysite.com/custom-post-type/custom-taxonomy-term/post-name      So I achieve the following:               mysite.com/literature - all literature posts     mysite.com/literature/fiction - all literature posts with 'fiction' term     mysite.com/literature/fiction/mybook - the post      Every time I try something I get 404 errors or the pagnination doesn't work. I don't understand why this is so hard! Any help really appreciated! Thank you ====================================================== ================== **ADDITIONAL INFORMATION** ================== Currently I'm registering the post type and taxonomy as follows:               register_post_type('literature',$args);     'rewrite' => array('slug' => 'literature/books','with_front' => false),          register_taxonomy('literature_category',array('literature'), array(     'rewrite' => array( 'slug' => 'literature','with_front' => false ),      If I register both as 'literature' I get a 404 on the mysite.com/literature page but this displays my permalink as: `mysite.com/literature/books/mybook` After following the advice on this question - Custom post types, taxonomies, and permalinks I've added this to my functions:               function filter_post_type_link($link, $post) {         if ($post->post_type != 'literature')             return $link;              if ($cats = get_the_terms($post->ID, 'literature_category'))             $link = str_replace('%literature_category%', array_pop($cats)->slug, $link);         return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);      And changed my post type to `'slug' => 'literature/%literature_category%'` And changed my taxonomy to `'slug' => 'literature'` This works great except that on `mysite.com/literature` pagination doesn't work so I get a 404 error on the following url: `mysite.com/literature/page/2/`


title: Recommended way to drop a pending query (in pre_get_posts)?

text: It looks like an e-commerce plugin's core query will be of no use to me in one particular template so I would like to discard it completely in favor of my own WP_Query loops in the template. It's not the main query, but a secondary loop query_posts() call that I'm trying to discard downstream. wp remove query has some good no-op pure SQL suggestions, but what would be a recommended way to stick one of those into that specific $query in pre_get_posts?


title: get page templates

text: I have this issue where I need to get all page templates. I know there are ways to get them based on their name. I know that I can include a page template but I am trying to include them in the loop on the index page. I just installed the 2012 theme, modified the header to include my scripts. I used a function that Milo offered from this site to load all posts and pages into the homepage which is working. Now I need to include all templates even those that I don't know their name. looking in the codex, I found a function called get_page_templates() that doesn't appear to be valid anymore. it gave this snippet                <?php          $templates = get_page_templates();         foreach ( $templates as $template_name => $template_filename ) {         echo "$template_name ($template_filename)<br />";         }      ?>      This code snippet should have done the trick but it gave me an invalid function error. I messed around with get_page_template() but all it would return for me is page.php Looking in the database in the _wp_post_meta, I see the field _wp_page_template and I can see that it holds all the template names that I need to include. I am just not sure how to get those names out of that field. I tried this               $template = get_post_meta($post->ID,'_wp_page_template',true);      but when I checked the value of $template, I found nothing. can you help?


title: Wordpress database error - Error in SQL syntax - I can't identify any error?

text: I am trying to write function that checks whether an email address is stored in my database or not. I've written the following PHP code::               function check_my_users( $email_address ) {          global $wpdb;          $my_table_name = $wpdb->prefix . 'my_users';               $result = $wpdb->get_var( $wpdb->prepare( 'SELECT email FROM %s WHERE email = %s', $my_table_name, $email_address ) );               if( $result !== NULL )              return true;               return false;      }      The function always returns false. Additionally, the following query is printed after calling the function: `SELECT email FROM 'wp_my_users' WHERE email = 'mail@example.com'`. Additionally, the following is written to the debug log:               WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wp_my_users' WHERE email = 'mail@example.com'' at line 1 for query SELECT email FROM 'wp_my_users' WHERE email = 'mail@example.com' made by […]      (I added the elipsis) What is wrong with my function, why do I get that error? To me, everything looks good.


title: Will it make any different if I have CDN on the same host but just different directory?

text: I have read an article about CND or " Content Delivery Network " which this is really telling myself that if I host a wordpress self-hosting and having a load of traffic I should at least have CDN which will help me improve my loading speed or performance of my site. Come to my question, should CDN be hosted in a different host or if it is in different directory will still make my site load faster than what the default wp-content is? I'm currently hosting my wordpress on a MAC OS X Server with 16GB of ram everything running fine except some people saying that it does take a bit of time for completion of site downloaded. [upto 5 seconds] I'm having issue with w3 cache really can't use it because it makes my site messed in a way that it will only show one post randomly but once I deactivate it then everything worked fine. please if you can share your opinion about this. Thank


title: WordPress Authors not showing with User Submitted Posts plugin

text: I'm using the User Submitted Post plugin to allow people to post to my blog. However when i run `<?php wp_list_authors(); ?>` I see none of the authors listed on the posts page in the dashboard. Are these not users? How can i list the authors that submitted all my posts through this plugin?


title: Should I global $wpdb outside of any of my plugin's functions scope?

text: I know that the general advice to global variables is to not use them at all. Still, when doing something with the Wordpress database, it is required to do `global $wpdb;` to access the methods Wordpress provides for interacting with the database. Now I've written a small plugin that introduces several functions that need to interact with the Wordpress database. That means, in every function I have written `global $wpdb;`. After that, I build the table names needed dynamically: `$wpdb->prefix . 'my_table_name';`. This is a lot of redundant code in my opinion that even can produce a lot more work. For example, I changed the table names a few times during development and had to change it in every function of my plugin where I do `$wpdb->prefix . 'my_table_name';`. Now my question is: Is it a good idea to just `global` `$wpdb` outside of any function scope and then assign the tables names to global variables?   That way, everything would be a lot more flexible regarding table names (and maybe even performance?)


title: Apache rewrite rules and wordpress problem

text: I tried to fix my problem by using wordpress rewrite rules but sadly it took me so long I tried this approach. I got it working for one of my simpler problems but now I can't get it to work for my two variable rewrite.               # START Custom rules.     RewriteEngine On          RewriteRule ^examentraining/vak/([^/]+)/([^/]+)/?$ index.php?p=1316&vakname=$1&level=$2 [L]     RewriteRule ^examentraining/training/([^/]+)/?$ index.php?pagename=examentraining/training&trainingid=$1 [L]          # FIN customrules          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      The second rule rewrites `index.php?pagename=examentraining/training$trainingid=VAKID => /examentraining/training/VAKID/`. This one works and has been tested. I would like my first example to also work, this one needs to rewrite `/index.php?p=1316&vakname=VAKNAME&level=LEVELNAME => /examentraining/vak/VAKNAME/LEVELNAME/`. `LEVELNAME` and `VAKNAME` are both strings that should be able to contain A-Z,a-z,_,&. I have tested this rewrite rule on multiple online tester but when I use it with wordpress it keeps failing. I enabled logging for .htaccess and I can see that the rewrite is functioning correctly but I can't follow it afterwards. The log: https://gist.github.com/ITWarrior/9292036 I hope somebody can help me, I have to get this done and I have tried al sorts of ways. EDIT 1 I added `remove_filter('template_redirect', 'redirect_canonical');` to my plugin. Now requesting /examentraining/vak/natuurkunde/vwo gets me to /examentraining/vak/natuurkunde/vwo but with an 404 not found wordpress error. The log of this request: https://gist.github.com/ITWarrior/9294435 The rewrite works fine and entering the url after the first rewrite actually gets me to the correct page (/index.php?p=1316&vakname=aardrijkskunde&level=vwo).


title: Combine category AND custom taxonomy in permalink structure

text: It seems like this question has been asked not infrequently, but I still can't make heads of it. I followed the Rewrite API Guide to look at how to merge, but I want something like this: Category = categories, built in. Food = custom taxonomy. When I enter http://mysite.com/food/category to find all posts in that category and that foot type, similar to http://mysite.com/index.php?category=category&food=food I'll also have pages, which aren't attached to a "food" or category, and the permalink fails if i simply put %foood%/%category%/ into the permalink settings. Does anyone have any recommendations?


title: Change menu with language?

text:
My problem is that I have used a plugin called polylang and now it doesnät work with another more importent plugin so I need to find a solution. I use WPML on other sites and that is not an option here so you know. I allready have all posts and pages translated and I just want to use one menu in Swedish and one in English. No changes in permalinks what so ever. I found a solution in this post How to change menu according to the language? but I can't get it to work. Not sure that post is still active or the solution works with WP 3.6 so I ask again for any help. This is the menu code from the halifax theme from the header               <?php wp_nav_menu( array( 'container_id' => 'submenu', 'theme_location' => 'primary','menu_id'=>'web2feel' ,'menu_class'=>'sfmenu','fallback_cb'=> 'fallbackmenu' ) ); ?>      code from the functions.php                   register_nav_menus( array(             'primary' => __( 'Primary Navigation', '' ),         ) );          function fallbackmenu(){ ?>

 Go to Adminpanel > Appearance > Menus to create your menu. You should have WP 3.0+ version for custom menus to work.


title: Automatic publishing after some fixed intervals?

text: Is it possible to publish "pending posts" automatically after some interval around the clock, using WP Cron or something else? I receive over 2000 posts daily, submitted by visitors, and they all go to pending status. I cannot edit and schedule each post. Just looking for a way to auto-post the pending posts with some intervals. E.g. Publishing 20 posts after every 15 mins.


title: php code for image fetching

text:
<?php       mysql_connect("localhost", "xxxxxx", "xxxxx") or die(mysql_error());       mysql_select_db("xxxxx") or die(mysql_error());       $data = mysql_query("SELECT         p1.*,         wm2.meta_value     FROM         xxxxx_posts p1     LEFT JOIN         xxxxxx_postmeta wm1         ON (             wm1.post_id = p1.id             AND wm1.meta_value IS NOT NULL             AND wm1.meta_key = '_thumbnail_id'         )     LEFT JOIN         xxxxx_postmeta wm2         ON (             wm1.meta_value = wm2.post_id             AND wm2.meta_key = '_xxxxxx_attached_file'             AND wm2.meta_value IS NOT NULL         )     WHERE         p1.post_status='publish'         AND p1.post_type='post'     ORDER BY         p1.post_date DESC")       or die(mysql_error());            Print "
";      while($info = mysql_fetch_array( $data ))       {                 Print "

";          Print $info['post_title'];     Print "

 ";            }       Print "
";      ?>       How to fetch the featured image in wordpress post //////


title: Multiplicate entry on update_post_meta

text:
I have a metabox with an array of input:               <input type="text" name="activite_dates[]" size="30" />
     <input type="text" name="activite_dates[]" size="30" />
     <input type="text" name="activite_dates[]" size="30" />
     ...      And i'm saving it like this               update_post_meta( $post_id, "dates", $_POST['activite_dates'] );      The problem is that when i'm retrieving it I have to make a ugly function to read multiple dimension array               Array      (     [0] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99         )          [1] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99         )          [2] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99         )      ) And when I'm saving it, it's only add to append to existent array               Array      (     [0] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99             [4] => DATA1             [5] => DATA2             [6] => DATA3             [7] => DATA99         )          [1] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99             [4] => DATA1             [5] => DATA2             [6] => DATA3             [7] => DATA99                  )          [2] => Array         (             [0] => DATA1             [1] => DATA2             [2] => DATA3             [3] => DATA99             [4] => DATA1             [5] => DATA2             [6] => DATA3             [7] => DATA99         )          )      So first, why do I have 3 value at the first level then my array is multiplied inside of the second level ? For information here is my code for the view :               $dates_gf = get_post_meta( $object->ID, 'dates', false );     foreach ($dates_gf as $date_gf) {         if (is_array($date_gf)){             foreach ($date_gf as $arr_date_gf) {                 ?> <input type="text" name="activite_dates_gf[]" value="<?php echo $arr_date_gf; ?>" size="30" />
 <?php             }         } else {             ?> <input type="text" name="activite_dates_gf[]" value="<?php echo $date_gf; ?>" size="30" />
 <?php         }     } ?>      Thank you very much !


title: Overwrite URL on blog posts

text: I would like to overwrite my URL on single blog posts. At the moment my posts are displaying as www.mydomain.co.uk/post-title, however I would like them to be as www.mydomain.co.uk/blog/post-title so /blog/ always displays before post item, I've tried to do that from permalink level but when I put /blog in Post name box it works, however all my single Custom posts are displaying as /blog/custom-post-item which is not what I'm after as I would only like that to happen for blog posts and not for custom post types. Any tips. Many thanks


title: TwentyTwelve, where is the excerpt box in add new?

text: When i try to add a new post, the is no excerpt box. Does anyone know a way to enable this?


title: How to fork a plugin?

text: I want to start giving back to the community, but writing a plugin from scratch is currently slightly beyond my skill level and creativity level (meaning, I don't know what kind of problem I can solve with a plugin! every time I think of something, I find a plugin or 6 that have already been written!). However, I have recently identified a very simple plugin that looks to be abandoned since WP 2.8, and I think I can modify it to be 3.1 compatible. I've asked, and it seems that the best way to update this plugin may be to simply fork it. So now my question: how do I do that? I'm new to SVN, so I'm totally uncertain as to where to go, how to start, etc etc. Can anyone guide me? :)


title: How can I tell which of my pages are single-view pages?

text: I am trying to understand what the `is_singular()` function does. And I found this definition:               is_singular() tag enables you to target single-view pages, regular page pages, and attachment pages       But the problem is that I am not sure how to determine which are single-view pages, regular pages, and category pages. What I really need to do is determine if a page is a category page. Thanks, Alex


title: Why are my paginated result links not working?

text: I've developed a custom post type for WordPress that has quite a few entries that require pagination. I used the *paginate_links* function and it creates the pagination appropriately, rendering links that look like this: http://mysite.com/people/page/5/ But whenever one of the links is clicked on it returns a 404 message error. I suspect this has something to do with permalinks and my .htaccess file, but the permalinks for my posts and pages work just fine, so I'm confused. Can anybody help me with this? Thank you! **EDIT** : Here is my query:               query_posts('post_type=peoplemanager&meta_key=people_lastname&orderby=meta_value&order=ASC&paged=' . get_query_var('paged'));      The name of the page where the output is displayed is "people."


title: How to integrate custom database table in Wordpress and using Wordpress functions

text: I'm on `Wordpress 3.0.4` and I'm having a hard time deciding which way to go. The following is my problem: I have a `mysql` database table `widgets`, with about 10 `properties` like _id, size, color_ etc. Now I'd like to integrate this table into `Wordpress`, preferably in such a way that I can get paginated lists of the `widgets`, show information on a single widget and have a flexible layout. Preferably, I would like the ability to change a custom template in such a way that I can change the position of each property on the page (So maybe I'd like to put e.g. the _size-property_ on top of the page on the left, later I might want to put it on the right bottom). What would be the best way to store the `widgets`, retrieve them by using as much `Wordpress` build-in functions and how can I get this flexible layout as well? I've written my own plugins before, so I have more than basic knowlegde on `Wordpress/PHP/MySQL`.


title: Sorting problem with 'query_posts' funcion in wordpress. Sort by custom field not working

text: 0 down vote favorite Hi, I am working with wordpress where i have a event listing system. There is a custom field in my post called starting_time which is unix timestamp. Now i want to short all posts by starting_time by this query_post command:               query_posts(array(                    'post_type' => 'event',                    'meta_key' => 'end_time',                    'meta_compare' =>'>=',                    'meta_value'=>time(),                    'order_by' => 'start_date',                  'order' => 'ASC'     ));      But it not working. Here is the site http://citystir.com/events/. I am echoing the start_time in unix before the time remaining so you can see the value. And also my pagination is not working. May be i did something wrong in the query_post command. Please someone response. \--------------------- Update ----------------- i have found a wonderful post here **kovshenin.com/archives/customize-posts- order-in-wordpress-via-custom-fields** but i didn't get it worked. May be for lack of my knowledge. Please take a look at it and let me know if you have any suggestions. I will continue working on that. \-------------------- Resolved ----------------- Changed order_by to orderby. And also i came to know that we can use meta key multiple times if we want it will not conflict. Here is the final code:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts(array(     'post_type' => 'event',     'meta_key' => 'end_time',     'meta_compare' =>'>=',     'meta_value'=>time(),     'meta_key' => 'start_time',     'orderby' => 'meta_value_num',     'post_per_page' => '-1',     'order' => 'ASC',     'paged' => $paged     ));      Thanks for all your hard work!


title: How to auto set screen option defaults

text: I want to make a function in my theme, which sets some things in the screen options tab on by default if you select my theme. This remains same for all users in the admin area. I don't care about their order, basically I just want to make sure custom fields and excerpt are ticked by default on the new/edit posts page. I've looked around alot but everything goes over my head and isn't working, I'm kind of new to wordpress so sorry if I didn't use the proper terms.


title: $_GET['updated'] does not work in Wordpress 3.1?

text:
I tried the Satoshi Theme in Wordpress 3.1 and when the Theme Options are saved, they do get saved but the "Satoshi Options Saved." message is not displayed. (the message is displayed in Wordpress 3.0.4). **functions.php:**               /* -- Theme Options Page -- */     function theme_options_admin() {         $option_fields = array();         if ( $_GET['updated'] ) echo '

Satoshi Options Saved.

';         echo '<link rel="stylesheet" href="'.get_bloginfo('template_url').'/styles/functions.css" />';     ?>

Satoshi Options

                  <form method="post" action="options.php">                 <?php wp_nonce_field('update-options'); ?>

                         <?php                             include("options/custom-logo.php");                             include("options/custom-intro.php");                             include("options/frontpage-headline.php");                             include("options/featured-project.php");                         ?>

                         <?php                             include("options/contact-details.php");                             include("options/footer-text.php");                             include("options/google-analytics.php");                         ?>

                      <input type="hidden" name="action" value="update" />                 <input type="hidden" name="page_options" value="<?php echo implode(",", $option_fields); ?>" />                  </form>

     <?php     }     add_action('admin_menu', "theme_options_admin_init");     function theme_options_admin_init()     {         add_theme_page( "Satoshi Theme Options", "Theme Options", 8, __FILE__, 'theme_options_admin');     }


title: How to remove notice inside search.php when no results are found?

text:
I have created search.php from Twenty Eleven theme search template. Search template works fine but i am having a problem when **no results are found**.      I am getting this PHP Notice: **_Notice: Trying to get property of non-object wp-includes/post-template.php on line 29_** Post-template line 29 looks like this:               function get_the_ID() {     return get_post()->ID;<-this is the source of the problem      }      I am assuming that this happens because `get_post()->ID` is not set (when no results are displayed) because inside my search template i have put this code:               <?php if ( !isset ($post->ID)) {     echo 'not set';<- this will echo "not set" if NO results are found and                     PHP notice will be displayed:(                    }     else{     echo 'set';<- this will echo "set" if results ARE found and                     PHP notice will NOT be displayed       }     ?>      So my question is how to SET `$post->ID` (if it is not set) in order to remove PHP Notice?   Any help is massively appreciated Thank You!! Search php code:               <?php           get_header(); ?>      <?php get_sidebar(); ?>      <?php get_sidebar('secondary'); ?>      <?php if ( !isset ($post->ID )) {       echo 'not set';        }        else{        echo 'set';        }        ?>

<?php printf( __( 'Search Results for: %s' ,'your-override' ), '' . get_search_query() . '' ); ?>
         <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>              <div <?php post_class();?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                     <?php the_post_thumbnail();           echo '
' . get_post(get_post_thumbnail_id())->post_excerpt . '
';?>
             <?php  // let's enable more link on pages...             global $more;             $more = 0;             ?>                 <?php the_content(); ?>

<?php the_meta(); ?>

                      <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
<?php the_tags('Tags:', ', ', '
'); ?>                 <?php _e('Posted on: '); ?><?php the_time('l, F jS, Y'); ?>
                                <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

      <?php endwhile; ?>
         <?php         global $wp_query;              $big = 999999999; // need an unlikely integer              echo paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'current' => max( 1, $paged ),         'total' => $wp_query->max_num_pages         ) );          ?>
     <?php else : ?>

<?php _e( 'Nothing Found'); ?>

<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.'); ?>
                     <?php get_search_form(); ?>

                   <?php endif; ?>

                <?php get_footer(); ?>


title: What's the best way to include php code in to pages?

text: I'm currently creating a bunch of (empty) pages and performing conditionals such as is_page('Blabla') on it, which increases my page.php significantly. I'm already using require_once for different content, but is there a cleaner way of doing this?


title: Strange Cached File in Super Cache

text: I installed super on one of my blogs recently and it has been working fine but I have noticed that it is caching this http://www.mydomain.com/.needs-rebuild which i believe is part of super cache what is the deal? Cheers


title: Create a custom taxonomy template that loops through child categories in term order?

text: We're building a site that sells Biking Gear We're using the Genesis Theme Framework, and developing a custom child theme. It has a Custom Post Type for Products, made with the "Custom Post Type UI Plugin". It also has a custom taxonomy for product-categories, we've created a template for the custom post type taxonomy archive : `taxonomy-products-category.php` The template needs to be able to loop through all the Posts in the product categories, but sort through them in term_order. For Example, `/product-categories/cycling/` needs to loop trough the child categories of 'Cycling' in the order we've set them up ( term_order, I think ) Also, if it's a child category, as seen in the menu on the left, the template just loops through that category, so if a user clicks on 'cycling', the template displays all the posts in the cycling category, grouped by sub- category ( jerseys, shorts, vests... ) and outputs the archive headline above each, I'm at a loss for how to cleanly so this, I've tried cobbling together a number of snippets that has resulted in failure, and am turning to the community for advice.


title: Using wp_enqueue_script on shortcode function handler

text:
I have this code               function this_is_my_shortcode(){         wp_register_script('per-pas-belanja-online', plugins_url('js/per-pas-belanja-online.js', __FILE__), array('jquery'), '1.0.0');         wp_enqueue_script('per-pas-belanja-online');         return '
Blah
';     }     add_shortcode('bubba', 'this_is_my_shortcode');      The div is appear on the page, but the script is not. What mistake i have done ?


title: Customizing Comments

text: Hi I want to customize the text with the arrows pointed at at the image I have uploaded. I have managed to customize some but I cannot find the file to customize the rest.![enter image description here](http://i.stack.imgur.com/eXlKt.jpg) Many thanks its on local host, and it is a custom theme.