title: How to Sort User list by meta_key and meta_value

text: I am very newbie in wordpress and stuck into a task for many hours and not getting any way to sort out this, Thats why I am here.... I want to display a sort list of user based on meta key and meta value but I dont Know what wrong with me I searched google and did as retrieve... I am trying as:               <?php     $args  = array(         'fields' => 'all_with_meta',         'meta_query' => array(           array(           'key' => 'status', // the meta field (or key) we want to target           'value' => '1'  // the value we want to target (optional)                )       ));            $users = get_users($args);       foreach ($users as $client) {             echo '<li>' . $client->user_email . '</li>';         }     ?>      and in wp meta user table: meta_key=>'status' and meta_value=>'1' for three rows but it showing constant result for any value of meta_value. Please let me know why I am not getting my desire output... thank you


title: Get a Page's attachments in Gallery order

text: Having created a page and a gallery within that page, I would like to retrieve all the images in that gallery in the order they are set when the gallery is created, i.e. the order which I drag them in to in the add media pop-up. I need to retrieve all the image URLs and their captions etc into an array in PHP. I have been using the below code, however it does not account for the order they are set in the gallery.               function get_page_attached_images($page_id) {          $output;     $output_row;          $thumb_ID = get_post_thumbnail_id( $page_id );          if ( $images = get_posts(array(       'post_parent' => $page_id,       'post_type' => 'attachment',       'numberposts' => -1,       'orderby'        => 'menu_order',       'order'           => 'ASC',       'post_mime_type' => 'image',       'exclude' => $thumb_ID,     )))            foreach ( $images as $img ) {              $output_row['url'] = $img->guid;         $output_row['title'] = $img->post_title;         $output_row['caption'] = $img->post_excerpt;         //$output_row['img'] = $img;              $output[] = $output_row;            }          return $output;      } Does anyone know how to preserve the gallery order when retrieving these attachments? I am using Wordpress v3.61.


title: How to fetch the no. of Users dynamically?

text: i am developing a review website of chome plugins.. Here you can see the sample post .. I want the no. of users to be fetched on the real time. In this case from this web store page. For this I have also made a php function which i have put on demo at tech- url.com Please help me in doing this.


title: Custom taxonomy archive not showing posts of certain child taxonomies

text: I have a custom post type that has a custom taxonomy which functions as the main hierarchical structure for this custom post type. I am experiencing some behavior that I can't explain though. This hierarchical structure is 3 levels deep as following: main   -section   --subsection The idea is that every custom post type is added to a subsection so that a book>chapter-like structure forms. I have made several restrictions to the custom post type admin page so that it's only possible to add new custom post types to subsections (and this part is working well). The problem is that for main/sections filters the custom post type that are in certain subsections won't show. This isn't just in my custom frontend archives but also in the WordPress backend, which makes it seem like quite a fundamental problem. For the backend of this custom post type I have also added some pretty standard filters for the taxonomies. When I select the --subsection depth in this filter, the posts that have this --subsection show as expected. But when select the main or -section of the aforementioned --subsection, nothing shows. All of these taxonomies have been added by a user, so I'm not sure what or if he has done something differently with adding these problematic --subsections. Some plugins that could be related and are active:   * WPML Multilingual CMS   * Category Order and Taxonomy Terms Order   * CPT-onomies: Using Custom Post Types as Taxonomies Naturally I've tried disabling them. My CPT registration:               add_action('init', function() {         global $plugin_base_dir;              // Argumenten voor registreer functie         $args = array(             'labels' => array(                 'name' => 'Rules',                 'singular_name' => 'Rule',                 'add_new' => 'New rule',                 'add_new_item' => 'Add new rule',                 'edit_item' => 'Edit rule',                 'new_item' => 'New rule',                 'view_item' => 'View rule',                 'search_items' => 'Search rules',                 'not_found' => 'No rules found',                 'not_found_in_trash' => 'No rules found in trash'             ),             'query_var' => 'rule',             'rewrite' => false,              'taxonomies' => array(                 'rlt_rule_headline',                  'rlt_rule_topic',                 'rlt_rule_year'             ),             'public' => true,             'publicly_queryable' => true,             'menu_icon' => '',             'show_ui' => true,             'hierarchical' => false,             'menu_position' => null,             'supports' => array(                 'title',                 'editor'             )         );         // Registreer de Custom Post Type         register_post_type('rlt_rule', $args);     });      The problematic taxonomy registration:               register_taxonomy(         'rlt_rule_headline',         'rlt_rule',         array(             'labels' => array(                 'name' => 'Headlines',                 'singular_name' => 'Headline',                 'add_new_item' => 'Add headline',                 'new_item_name' => "New headline"             ),         'rewrite' => array(             'slug' => 'headline',             'with_front'=> false,               'feed'=> true              ),         'show_ui' => true,         'show_tagcloud' => false,         'hierarchical' => true         )     );      My added backend filter:               $filter_taxonomy = 'rlt_rule_headline';         wp_dropdown_categories(              array(                 'show_option_all' => 'Show all headlines',                 'taxonomy' => $filter_taxonomy,                 'name' => $filter_taxonomy,                 'orderby' => 'name',                 'selected' => ( isset( $wp_query->query[$filter_taxonomy] ) ? $wp_query->query[$filter_taxonomy] : '' ),                 'hierarchical' => true,                 'depth' => 3,                 'show_count' => false,                 'hide_empty' => true,             )          );      The filter is default. I haven't added a function to catch it and handle anything. So it just adds query_vars and filters like a normal archive. The same goes with the frontend archive.


title: What is short code for following?

text: Here is my code and I want to know what is shortcode of this? Is it `[login_form]` or do we need to add something more? With `[login_form]` there is no output as result               function pippin_login_form() {          if(!is_user_logged_in()) {              global $pippin_load_css;              // set this to true so the CSS is loaded         $pippin_load_css = true;              $output = pippin_login_form_fields();     } else {         // could show some logged in user info here         // $output = 'user info here';     }     return $output;     }     add_shortcode('login_form', 'pippin_login_form');


title: Why doesn't WP_Image_Editor save images using the Filesystem API?

text: I was in the process checking some of my existing plugins for any unsafe filesystem accesses, when I ran across WP_Image_Editor's `save` function, which calls `_save`, which finally calls `make_image` (below). WP_Image_Editor was released in `WP 3.5`, while the `Filesystem API` has been around since `WP 2.6`, so I would presume that the reasoning is related to the specifics of the use-case rather than just not being changed to meet new standards.               protected function make_image( $filename, $function, $arguments ) {         if ( $stream = wp_is_stream( $filename ) ) {             ob_start();         } else {             // The directory containing the original file may no longer exist when using a replication plugin.             wp_mkdir_p( dirname( $filename ) );         }              $result = call_user_func_array( $function, $arguments );              if ( $result && $stream ) {             $contents = ob_get_contents();                  $fp = fopen( $filename, 'w' );                  if ( ! $fp )                 return false;                  fwrite( $fp, $contents );             fclose( $fp );         }              if ( $stream ) {             ob_end_clean();         }              return $result;     }      My question is, what are the reasons for this? According to Otto, directly accessing the filesystem is evil, so what are the exceptions that make it alright in this instance? I want my plugins to behave in the best way possible, but this makes best practices a little difficult to discern.


title: Upgrade Private Plugin without Deleting

text: I've seen numerous questions asking a way to update a private plugin by checking to self-hosted repository, or update plugin from personal API, but my question is quite different. As we all know, if a plugin (by a given name) already exists in the wp- content/plugins directory, then WordPress won't overwrite it. Instead it shows the "Destination folder already exists." error (and plugin install failed). I'm just asking, if anyone can point me out what to deal (or telling me if it's not possible) to let my WordPress site automatically upgrade/overwrite an existing plugin through the upload-plugin page. **Update (Sept, 10th):** Is there any specific function/action that I should implement in my private plugin so when I try to upload (let say) a newer version of that plugin, my WordPress site would handle the deactivation-deletion steps and later install the newly uploaded plugin package?


title: Display oEmbed in the_excerpt

text: I am currently adding               add_filter('the_excerpt', array($wp_embed, 'autoembed'), 9);       to my `functions.php` file to no avail any other suggestions would be great. Also if I add `$content-width` to functions.php the settings are ignored. I have `wp-debug` on with no errors/warnings and no errors are being logged.


title: Spam users registers even when registration is disabled

text: I'm getting a lot of spam users registering on my site, even though I have disabled `All users can register` in the control panel and comments is disabled on all posts. Are anyone else experiencing this, and how can i prevent this?


title: All pages are shown on home page?

text: My all the pages are shown on homepage. I have selected static page. Still it does not appear on home page. Suggest me something.


title: Custom buttons (with icon) disappearing if saved in TinyMCE visual mode

text: I'm using custon social buttons in the latest version of Wordpress. The buttons are based on Bootstrap 3 with Font-Awesome icons. The code for the buttons with icons looks like this:               <button class="btn btn-facebook" type="button"></button>      Adding these to a page works fine if I'm using text mode in the standard TinyMCE editor, but as soon as I switch to the visual tab and press "Update" they disappear. Even when I switch tabs for a second without updating the post they're gone. This doesn't happen if there is no icon in the button. To make it even stranger, I noticed that if I have a row of buttons where only one of them is changed like this:               <button class="btn btn-facebook" type="button">F</button> <button class="btn btn-twitter" type="button"></button> <button class="btn btn-youtube" type="button"></button>      it works just fine. Even though all buttons except the first remain the same. So I'm thinking this has something to do with the icons, what do I need to do to fix this?


title: Plugin not showing in dashboard

text: I've seen other many related questions, but all of them are resolved with just adding the name format at the top of the plugin main PHP file, or/and manually download and extract the plugin, but none of those answers worked for me. I'm talking a about the Wordpress Users Plugin. After download and extract it on `wp-content/plugins/` directory, I can't found it in the dashboard list. I've checked that the main file (`wp-users.php`) is placed at the main path, and it starts with the plugin name:               <?php     /*     Plugin Name: WordPress Users     Plugin URI: http://kempwire.com/wordpress-users-plugin     ...      I'm comfused about what can be happening. Any idea?


title: Multiple domains issue

text: we have a wordpress site that has been blocked in some countries in Middle East. so we bought a new domain and pointed it to the same root folder. the homepage is showing with the new domain but all the pictures, external codes, and link are blocked due to the fact that they are referring to the first domain. so, in short, what i want is:   * when a user visits: [www.firstdomain.com] i want the contents of the page are all referring to the same domain, like [www.firstdomain.com/articles/1253/]   * but when a user visits: [www.seconddomain.com] i want the contents of the page are referring to the second domain, like [www.seconddomain.com/articles/1253] is that possible using wordpress alone? or should i install a caching script in the second domain?


title: Latest post in a specific menu

text: is it possible to show the latest posts only in a specific menu? This is my menu:               register_nav_menus(array(     'primary' => __('Primary Navigation', 'gonzo'),     'mobile' => __('Mobile Navigation', 'gonzo'),     'copyright' => __('Footer Copyright Menu', 'gonzo'),     'toplevel' => __('Top Secondary Menu', 'gonzo')      ));      modifying this code I want to show it only in "primary" menu. Thanks ;)


title: Are there any filters to add additional columns to the list table on edit-comments.php?

text: I'm trying to modify the display of the `edit-comments.php` admin page and I'm not seeing any filters in it comparable to `manage_posts_columns` etc. Is there an easy way to do this? I'm thinking the only real way to go about doing this is to extend **WP_Comments_List_Table** with my own class, overwrite the `get_columns` and other related functions, and just add my own page to the admin menu which uses this new class in the same way that edit- comments.php uses **WP_Comments_List_Table**. Is there an easier way to do this that I'm just not seeing?


title: Custom Taxonomy List, Selection floats to top

text: I have a custom post type called Slide set up:               register_post_type('slide', [         'labels' => [             'name' => __('Slide'),             'singular_name' => __('Slide'),         ],         'public' => true,         'has_archive' => true,         'capability_type' => 'post',         'capabilities' => array(             'create_posts' => false,         ),         'map_meta_cap' => true,         'menu_icon' => 'dashicons-universal-access',     ]);      I then have a custom taxonomy for it, called Group:               $groupLabels = [ ... ];     register_taxonomy('Groups', 'slide', ['hierarchical' => true, 'labels' => $groupLabels]);      This works fine - I can create Groups, nest them, and tag a Slide with them. The problem is when I go into the edit page for a Slide ( /wp- admin/post.php?post=202&action=edit ) and select some Groups then save it, the Groups I selected float to the top of the list, out of hierarchy order. The weird thing is if I go to the Quick Edit (while still on the list page) it displays correctly. Does anyone have ANY idea what's going on? I don't even know where to start looking, and Googling for anything like this just brings back completely unrelated results because it's too specific.


title: Paginate recent posts widget

text:
I've created a clone of the core Recent Posts widget as suggested here Code for Recent Posts Widget, but how would I go about adding pagination to that widget? I intend on using auto-pagination for infinite scroll, but I'm not sure where to start... Using Wordpress 3.9.1 so the most popular widget pagination plugin isn't compatible. I added this:               function my_app_latest_add_query_var() {       global $wp;       $wp->add_query_var('latest_page');     }     add_filter('init', 'my_app_latest_add_query_var');      Then the widget I've got pulls out the posts as I want, but the pagination links don't show:               class MyApp_Widget_Recent_Posts extends WP_Widget {     public function __construct() {         $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site’s most recent Posts.") );         parent::__construct('recent-posts', __('MyApp Recent Posts'), $widget_ops);         $this->alt_option_name = 'widget_recent_entries';         add_action( 'save_post', array($this, 'flush_widget_cache') );         add_action( 'deleted_post', array($this, 'flush_widget_cache') );         add_action( 'switch_theme', array($this, 'flush_widget_cache') );     }     public function widget($args, $instance) {         $cache = array();         if ( ! $this->is_preview() ) {             $cache = wp_cache_get( 'widget_recent_posts', 'widget' );         }         if ( ! is_array( $cache ) ) {             $cache = array();         }         if ( ! isset( $args['widget_id'] ) ) {             $args['widget_id'] = $this->id;         }         if ( isset( $cache[ $args['widget_id'] ] ) ) {             echo $cache[ $args['widget_id'] ];             return;         }         ob_start();         $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'MyApp Recent Posts' );         /** This filter is documented in wp-includes/default-widgets.php */         $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );         $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;         if ( ! $number )             $number = 5;         $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;         $latest_page = ( get_query_var( 'latest_page' ) ) ? absint( get_query_var( 'latest_page' ) ) : 1;         $r = new WP_Query( apply_filters( 'widget_posts_args', array(           'posts_per_page'      => $number,           'paged'               => $latest_page,           'no_found_rows'       => true,           'post_status'         => 'publish',           'ignore_sticky_posts' => true,           'suppress_filters'    => true         ) ) );         if ($r->have_posts()) :         ?>         <?php echo $args['before_widget']; ?>         <?php if ( $title ) {           echo $args['before_title'] . $title . $args['after_title'];         } ?>
           <?php while ( $r->have_posts() ) : $r->the_post(); ?>             <?php get_template_part( 'content-block', get_post_format() ); ?>           <?php endwhile; ?>
         <?php echo $args['after_widget']; ?>         <?php           echo '
';           $args = array(             'base' => '/' . '%_%',             'format' => '?latest_page=%#%',             'current' => $latest_page,             'total' => $r->max_num_pages           );           echo paginate_links( $args );           echo '
'; ?>         <?php // This doesn't seem to work at all... ?>         <?php // echo get_next_posts_link( 'Load more', $r->max_num_pages ); ?>         <?php         // Reset the global $the_post as this query will have stomped on it         wp_reset_postdata();         endif;         if ( ! $this->is_preview() ) {           $cache[ $args['widget_id'] ] = ob_get_flush();           wp_cache_set( 'widget_recent_posts', $cache, 'widget' );         } else {           ob_end_flush();        }     }     }      I also created a function, which works for both i.e. displays posts and pagination links:               function my_app_recent_posts() {       global $post;       $latest_page = (get_query_var('latest_page')) ? get_query_var('latest_page') : 1;       $args = array(           'posts_per_page' => 1,           'order' => 'DESC',           'post_status'         => 'publish',           'ignore_sticky_posts' => true,           'paged' => $latest_page       );       $rposts = new WP_Query($args);       if ( $rposts->have_posts() ) :         while ( $rposts->have_posts() ) : $rposts->the_post();           get_template_part( 'content-block', get_post_format() );         endwhile;         echo '
';         $args = array(             'base' => '/' . '%_%',             'format' => '?latest_page=%#%',             'current' => $latest_page,             'total' => $rposts->max_num_pages         );         echo paginate_links( $args );         // This doesn't work as it just used the 'paged' query param         // echo get_next_posts_link( 'Load more', $rposts->max_num_pages );         wp_reset_postdata();         echo '
';       endif;     }      This doesn't seem right to me - there has got to be a way to just use the widget code surely?


title: Insert Widget option into mark-up with register_sidebar

text:
I have added a custom field to my all widgets in my theme, called "custom- title". I have managed to save the field into the database for each widget, like so:                s:12:"custom-title";s:17:"HELLO TEST ANCHOR"      I want to use this to add a data-attribute "custom-title" to the mark-up for each widget, on the before_widget argument. I want the final mark-up to look like this:
      I want to do it using `register_sidebar()` so that it applies to ALL widgets that have a custom-title saved. Here is the current arguments passed to register_sidebar:                     // Register Sidebar           register_sidebar(               Array(                   'id' => $sidebar_id,                   'name' => $arr_sidebar[0],                   'description' => $arr_sidebar[1],                   'before_widget' => '
',                   'after_widget' => '
',                   'before_title' => '
',                   'after_title' => '
'               )           );      Is it possible to insert my custom-title into the correct place in this mark- up?


title: query by meta value then date and not empty meta value

text: So i have a query like this               function filter_where( $where = '' ) {                         // posts in the last 7 days                         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-3 days')) . "'";                         return $where;                     }                     add_filter( 'posts_where', 'filter_where' );                     $args = array( 'posts_per_page' => 5,                                      'meta_key' => 'homepage_toppost',                                      'orderby' => 'meta_value_num date',                                      'order' => 'DESC'                                       );                     $popularpost = new WP_Query( $args );                     remove_filter( 'posts_where', 'filter_where' );      homepage_toppost is meta key with value from 1 to 5, its just numbers. NOw i need to show posts ordered by this meta key homepage_toppost then by date, but its ignoring my meta key and ordering only by date. What am i doing wrong ? TO UPDATE WITH SOLUTION: (which was to check if meta isnt empty)                       function yoursite_posts_where($where,$query) {               global $wpdb;               $new_where = " TRIM(IFNULL({$wpdb->postmeta}.meta_value,''))<>'' ";               if (empty($where))                 $where = $new_where;               else                 $where = "{$where} AND {$new_where} AND post_date > '" . date('Y-m-d', strtotime('-5 days')) . "'";               return $where;             }      so full code:               function yoursite_posts_where($where,$query) {                       global $wpdb;                       $new_where = " TRIM(IFNULL({$wpdb->postmeta}.meta_value,''))<>'' ";                       if (empty($where))                         $where = $new_where;                       else                         $where = "{$where} AND {$new_where} AND post_date > '" . date('Y-m-d', strtotime('-5 days')) . "'";                       return $where;                     }                     add_filter('posts_where','yoursite_posts_where',10,2);                     $args = array( 'posts_per_page' => 5,                                      'meta_key' => 'homepage_toppost',                                   //  'meta_value' => true,                                     'orderby' => 'meta_value_num date',                                      'order' => 'DESC'                                       );                     $popularpost = new WP_Query( $args );                     var_dump($popularpost->request);                    // remove_filter( 'posts_where', 'filter_where' );                     remove_filter( 'posts_where', 'yoursite_posts_where' );                     $i= 0;                      while ( $popularpost->have_posts() ) : $popularpost->the_post(); $i++;


title: Is wp_is_mobile() effective?

text: I'm going to test the user agent to load a mobile template instead of the desktop theme. There are many mobile detection scripts out there.   * Does `wp_is_mobile()` function work well?   * What is your experience in comparison with other classes like e.g. `mobiledetect.net`?


title: Single Page Wordpress CSS and JS links

text: i got a custom template with blog post in it... In my header.php, inside the `<head>` i have my links like this ...               <link href="http://www.mysite.com/css/design.css" type="text/css" rel="stylesheet" />     <script type="text/javascript" src="http://www.mysite.com/js/myjs.js"></script>      those links are working in my custom template.. by using `<?php get_header(); ?>` All blog post in my custom page are there.. no layout problems. But when i click one of the post. my layout is broken. and when i checked it via Inspect Element. the link is like this               <link href="http://www.mysite.com/blog/css/design.css" type="text/css" rel="stylesheet" />     <script type="text/javascript" src="http://www.mysite.com/blog/js/myjs.js"></script>      *** EDIT *** from the answers below, above is my original question, anyway my problem is still the same. I added this to my functions.php and removed the links on my header.php also i copied the files inside the wordpress folder called links... `/httpdocs/blog/wp-content/themes/myblog/links`                   // Get Links               function theme_scripts_styles() {            wp_enqueue_style( 'my-styles', get_stylesheet_directory_uri() . '/links/design.css', array(), '1.0', 'all' );            wp_enqueue_script( 'my-scripts1', get_stylesheet_directory_uri() . '/links/cufon-yui.js', array(), '1.0', true );            wp_enqueue_script( 'my-scripts2', get_stylesheet_directory_uri() . '/links/232MKSD_200.font.js', array(), '1.0', true );            wp_enqueue_script( 'my-scripts3', get_stylesheet_directory_uri() . '/links/232MKSDB_400.font.js', array(), '1.0', true );            wp_enqueue_script( 'my-scripts4', get_stylesheet_directory_uri() . '/links/fonts.js', array(), '1.0', true );            wp_enqueue_script( 'my-scripts5', get_stylesheet_directory_uri() . '/links/OpenSans_400.font.js', array(), '1.0', true );            wp_enqueue_script( 'my-scripts6', get_stylesheet_directory_uri() . '/links/OpenSansSB_600.font.js', array(), '1.0', true );                    }           add_action( 'wp_enqueue_scripts', 'theme_scripts_styles' );


title: How to display all child/sub pages from all parent pages?

text:
Hi I would like to display all child pages from all parents pages. Not from specific parent! and I would like to display them as random. The code I used currently :               $posts=get_posts('child_of='.$post>ID.'paged=2&posts_per_page=1&sort_column=post_date &sort_order=desc&showposts=3$orderby=rand&post_type=page');      Now if I use random as orderby then it shows all parents and child pages. But what I'm doing now use orderby=post_date and limit the number of posts as 3 so now i'm getting 3 child pages which I wanted, but I add more page as child then it won't appear, because I'm not using random. Haven't found any template tag for child page display. The full code is follows:               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     <?/*php $post=query_posts('showposts=3'); */?>           <?php $post=query_posts('post_type=page&orderby=rand&posts_per_page=3'); ?>          <?/*php $posts =get_posts('paged=2&posts_per_page=1     &orderby=rand&showposts=3&post_type=page'); foreach ($posts as $post) : start_wp(); */?>          <?php $posts = get_posts('child_of='.$post->ID.'       $paged=2&posts_per_page=1&sort_column=post_date &sort_order=desc&showposts=3       $orderby=post_date&post_type=page'); // important          foreach ($posts as $post) : start_wp(); ?>              <?php static $count1 = 0; if ($count1 == "2") { ?>

        <a href="<?php the_permalink() ?>"><img src="<?php get_post_thumbnail(); ?>" />
        <?php $entry = get_post_meta($post->ID, 'additional_text', true); ?>
<?php the_title(); ?> /&nbsp

<?php echo $entry; ?>

                 <?php } elseif ($count1 == "3") { break; } else { ?>

       <a href="<?php the_permalink() ?>"><img src="<?php get_post_thumbnail(); ?>" />
       <?php $entry = get_post_meta($post->ID, 'additional_text', true); ?>
<?php the_title(); ?> /&nbsp

<?php echo $entry; ?>

     <?php $count1++; } ?>     <?php endforeach; ?>      Any help or clue wiill be great favor. Thanks in advance.


title: XML-RPC and Custom Post Types

text: I can't find much documentation on using XML-RPC and custom post types. I have a specific requirement that remote posting and management (the client has an in-house cms) must be used for a custom post type.


title: Changes doesn't show up on blog

text:
I am using wordpress in my magento using Fishpig wordpress extension, i have created a functions in functions.php of my theme (though its full integrated, meaning magento theme is applied to blog) but the following function doesn't seem to have any effort. my function is               add_filter( 'the_excerpt_rss', 'insert_thumbnail_into_feed' );     add_filter( 'the_content_feed', 'insert_thumbnail_into_feed' );     function insert_thumbnail_into_feed() {           global $post;           if ( has_post_thumbnail( $post->ID ) ){             // replace thumbnail with yours             $content = '
' .get_the_post_thumbnail( $post->ID, 'thumbnail' ) .'
';           }                // get post content and replace feed content with           // you can also limit/filter the content to exclude shortcodes and html code etc.           $content .= '
' .get_the_content() .'
';                return $content;         }      is it because feed by default loads the rss and rss doesn't run the mentioned code? Edit: i am using this Fishpig extension


title: custom post scheduler for drafts

text: I have a lot of posts everyday to publish. Now, I am thinking to schedule all those posts which I saved them as drafts. So, I tried to make a custom post scheduler. Here is what I tried,               $time = strtotime('+5 min');            $args = array('post_type' => 'post','post_status' => 'draft');                       $draft_posts = get_posts( $args );          foreach($draft_posts as $posts) {     $my_post = array(           'ID'           => $posts->ID,           'post_date'    => date('Y-m-d H:i:s', $time),           'post_status'  => 'future');     $my_post->edit_date = true;     wp_update_post( $my_post );     $time += 5400;                                   // every 1.5 hr     }      As soon as I run this, all drafts are published instantly at same time, rather than an interval of 1.5 hr. Can anyone please tell where is the problem?


title: Using Wordpress multisite is there a way to force HTTPS on specific subsites and not others?

text: I'm aware of the global variables that allow you to `FORCE_SSL` and `FORCE_SSL_ADMIN`. I am wanting to apply these settings on a per-site basis. For example, forcing SSL browsing and admin for a specific site on the network. How can this be done?


title: Override the wp_siteurl and wp_home not work

text: I created a wordpress site and name hostname as x.co.uk, x.com, x.in... In wp-option table the site and home url as x.co.uk. I want dynamically for loading other host name also. So dynamically set WP_SITEURL, WP_HOME, i override the wp-config as               define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] );     define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME'] );      but when i call home_url() it always return x.co.uk hostname Thanks Advance


title: Does set_transient() overwrite/update transient option with same key?

text: Basically that's the question - I wonder if `set_transient()` overwrites/updates a transient option with the same key?


title: How to set empty search to load homepage template and not index.php

text: When an empty search is submitted, it loads the themes index.php. I'm using a template for the homepage and have set this page under Settings -> Reading -> Static Page. But the empty search still results in the default theme index.php page. How do I fix this? Ben


title: How to import Theme Unit Test on localhost

text: I am a total beginner with WP and struggle to import this xml file. Tools->Import->WordPress and here I am asked for Hostname, FTP Username, FTP Password and Connection Type. I am on local mashine... When I download the plugin and try to do it manually it is the same story. So how can I import this data?


title: How do I link an image to the post it is attached to?

text: I am using an image tagging plugin that creates galleries based on image tags, but does not link back to the original post, which is something I am hoping to do. I found this thread: 'Get the post attached to an image attachment', but it assumes I know the attachment ID. So I guess my question is: If I have a url for an image that is attached to a post (but no attachment ID), is there any way to find out the url of the post it is attached to? * * * **EDIT** : After some additional searching I was able to come across a function to generate the attachment ID here: http://pippinsplugins.com/retrieve-attachment-id-from-image-url/:               // retrieves the attachment ID from the file URL     function pippin_get_image_id($image_url) {         global $wpdb;         $prefix = $wpdb->prefix;         $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts" . " WHERE guid='" . $image_url . "';"));         return $attachment[0];       }      and               $image_url = '{my image url variable}';     $image_id = pippin_get_image_id($image_url);      Then I was able to combine it with another Wordpress Answers thread here: Get the post attached to a image attachment:               $parent = get_post_field( 'post_parent', $image_id);     $link = get_permalink($parent);      Then added:               $my_post_title = get_the_title($parent);      Then output using:               '.$my_post_title.'      Hopefully that makes sense to other people, but I was surprised that I was able to get it all figured out being the novice that I am.


title: Is there a way to have information on one page automatically feed into another?

text: Specifically, I have a page that lists events that happen each week on Tuesdays and Saturdays. I want these events, posted to this page, to then go onto two separate pages - one just showing the events on a Tuesday, and the other events on a Saturday. Is there a way to do this? Thanks in advance.


title: Built-in Method to Extract Embedded Video from Content

text: Is there way to extract embedded video without using a regular expression as seen here? I was hoping that there would be a way to get them using a WordPress function.


title: Get URL Category Name By ID

text: I have this URL:   `http://example.com/?s=&cp_state=0&scat=16&sa=search&refine_search=yes` and this code on `search.php`:               <?php                       $searchTxt = trim( strip_tags( esc_attr( get_search_query() ) ) );     $state_append = '';     $state = $_GET['cp_state'];     if($state != '0')          $state_append = __('', APP_TD).' ' . $state;          $cat_id =  $_GET['scat'];     if ( $searchTxt ==  __('What are you looking for? ', APP_TD) || $searchTxt == __('[All]', APP_TD) )          $searchTxt = '*';             if($searchTxt){         if($searchTxt == '*') {             if($cat = get_term_by('id', $cat_id, 'ad_cat')) {                 printf( __("Ads %s %s ", APP_TD), $cat->name, $state_append, $wp_query->found_posts );              } else {                 printf( __("Ads %s ", APP_TD), $state_append, $wp_query->found_posts );              }         } else {             printf( __("What are you looking for? '%s' %s ", APP_TD), $searchTxt, $state_append,      $wp_query->found_posts );          }     }else{         $searchTxt = trim( strip_tags( esc_attr( get_search_query() ) ) );         printf( __("What are you looking for? '%s' %s ", APP_TD), $searchTxt, $state_append,      $wp_query->found_posts );     }     echo $cat_id;     ?>      I would like to get the category name of the URL. I try to use `echo $cat_id`, but it gives me the number and not the name of the category. How can I "echo" the name of category instead the number?


title: wp_tag_cloud Problem

text: I am getting all the tags under one category by using this script               <?php     $custom_query = new WP_Query('posts_per_page=-1&category_name=female-celebrities');     if ($custom_query->have_posts()) :         while ($custom_query->have_posts()) : $custom_query->the_post();             $posttags = get_the_tags();             if ($posttags) {                 foreach($posttags as $tag) {                     $all_tags[] = $tag->term_id;                 }             }         endwhile;     endif;          $tags_arr = array_unique($all_tags);     $tags_str = implode(",", $tags_arr);          $args = array(     'smallest'  => 12,     'largest'   => 12,     'unit'      => 'px',     'number'    => 0,     'format'    => 'list',     'include'   => $tags_str     );     wp_tag_cloud($args);     ?>      It is printing all the tags But the problem is I have 3 categories Movies, Male Celebrities, Female Celebrities I assigned multiple TAGS to a single wallpapers example. "Harry Potter and the Deathly Hallows - Part 2" and "Matthew Lewis" This two are assigned to a Wallpapers Now when i query by my code it is showing both in the list. Is there any solution for it. Actually I just wanted to build a-z lists for all of Female Celebrties, Movies, and Male Celebrties. The Terms are stored In TAGS Thanks


title: Using composer for dependency management in plugindevelopment

text: I'm new to wordpress plugin development. Normally I would use composer to add thirdparty libs to my code, but I couldn't find any wordpress plugin on github that uses composer for that. I read about wpackagist.org and the way composer can be used to manage dependencies between wordpress plugins. In this case there would be one master composer.json with all infos. But what if I want to develop a single plugin using composer? Would I simply include the autoload in the "plugin root"-file? But what if other plugins would do it the same way and would bring own autloaders and in the worst case have the same dependencies in different versions? Is there a best practice for integrating lib-dependencies into wordpress plugins?


title: Worpress twenty eleven sidebar on Pages

text: I am using 2011 theme, any how I managed to get sidebar on single.php pages by installing child theme, But now I want sidebar on pages, How do I get it?


title: Directory location of new page

text: I see from the WordPress dashboard, I can create many new pages. When I create a new page, can you please tell me where this new page will be created. I mean the `directory location` where this file will be created?


title: Possible to set new user's site time zone at user creation using Gravity Forms?

text: Let's say I have a multisite network running with Buddypress and has Gravity Forms installed with the GF User Registration addon. During new user/site registration, is there ANY way I can have the user set their time zone by selecting from a Gravity Form drop down menu the timezone they want? Basically, I don't want the user to have to login to WP and then go to General settings to change their time zones. Is there any way of achieving this without having to edit any core WP code?


title: How to allow admins to create a sidebar from the admin

text: I'm creating a WordPress theme and I've noticed that a lot of premium themes allow the users to go to Appearance->Sidebars and create a new Sidebar by simply giving it a name. The user can then Go to widgets and assign different widgets to this sidebar and also add custom menus. This I believe is a great feature as it allows users to have different sidebars on different pages. Now I'm familiar with Custom Post Type and Theme options and know how I would let people choose a different sidebar for different pages, but I'm just having problems in creating the first step, which is to allow people to create a sidebar on their own. Do I need to create a CPT for this? or is there some other way? I've searched a lot and the best thing I came across was a plugin, which has a lot of code and does too many things and for which I cannot even find the license info. So please advice how I can create something like this and thank you very much.


title: Why do Metabox use Nonces?

text: Why is it advised for admin panel metaboxes to use nonces? Every example I see of creation and saving metabox data there are nonces involved but aren't nonces a bit unnecessary in this case?


title: specific post is not excluded from the loop

text:
I have registered a CPT and created **archive-myCPT.php** , here I want to exclude a specific post from the main loop. This is my code:               <?php          $query = new WP_Query( array(        'post_type' => 'cpt',        'orderby' => 'date',         'order' => 'DESC',         'posts__not_in' => array( 118 ),        'posts_per_page' => 1     ) );             if( $query->have_posts() ){                  // normal blog layout                     $x = 1;                     while ( $query->have_posts() ){                         $query->the_post();                          if ( 0 === (int) $post->post_parent ) {                         get_template_part( 'inc/post-format/content-debate');                     }       ........................      All the other arguments are working as expected but the `'posts__not_in' => array( 118 ),` is not working, I still see it. What am I doing wrong ? Thanks ! **UPDATE:** This more relevant code which I'm using for the loop:               <?php                   if( have_posts() ){                  // normal blog layout                     $x = 1;                     while ( have_posts() ){                         the_post();                          if ($post->ID != 118) {                         get_template_part( 'inc/post-format/content-debate');                     }                                   // advertising between posts                         if($ad_posts_mode != 'none'){                             // take into account ad frequency                             if (($x % $ad_posts_frequency) == 0){                                      switch ($ad_posts_mode) {                                     case 'image':                                         echo '

';                                     break;                                     case 'html':                                         echo '
'.apply_filters('shortcode_filter',do_shortcode(of_get_option('ad_posts_code'))).'
';                                     break;                                 }                             }                         }                         $x++;                     }                 }


title: Fields in register page is pre-filled out with name and email

text: When I sign out from the forum I'm using and click 'register', it takes me to the register page but some of the fields are already filled out. The name is in the 'email' field and the email address is in the 'password' field. How can I make it so that none of the fields get pre-filled out? Below is a screenshot to give you a better idea of what I mean. http://i.imgur.com/tMzu7.png (I can't post images yet)


title: Query Custom posts of same taxonomy as the post itself

text: I have 2 custom post types: "Services" and "Works" and they both have a same taxonomy 'Genre'. Now the taxonomy 'Genre' has as term called 'novice'. 5 Recent posts under "Works" which has the term 'novice' (under taxonomy 'Genre') has to be queried on the post pages of "Services" which has the term 'novice' (under taxonomy 'Genre'). There will be 50 terms under the taxonomy.


title: Do WordPress Core Filenames Work as Hooks?

text: This is in reference to another answer here on wordpress.stackexchange. The answerer used the filename as the hook to enqueue scripts and styles to certain pages.               add_action( 'admin_print_scripts-post-new.php', 'portfolio_admin_script', 11 );     add_action( 'admin_print_scripts-post.php', 'portfolio_admin_script', 11 );


title: Excerpt keep stripping <a> tags

text:
I have the following function to display my excerpt                 <?php function pietergoosen_custom_wp_trim_excerpt($text) {     global $post;     $raw_excerpt = $text;     if ( '' == $text ) {         $text = get_the_content('');              $text = strip_shortcodes( $text );              $text = apply_filters('the_content', $text);         $text = str_replace(']]>', ']]>', $text);              //Add the allowed HTML tags separated by a comma.         $allowed_tags = '
,,,,,<audio><video>';           $text = strip_tags($text, $allowed_tags);              //Change the excerpt word count.         $excerpt_word_count = 105;          $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);               //Change the excerpt ending.         $excerpt_end = ' ' . '…' . __( 'Read more about this article →', 'pietergoosen' ) . '';          $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);              $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);         if ( count($words) > $excerpt_length ) {             array_pop($words);             $text = implode(' ', $words);             $text = $text . $excerpt_more;         } else {             $text = implode(' ', $words);         }     }         return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);     }          remove_filter('get_the_excerpt', 'wp_trim_excerpt');     add_filter('get_the_excerpt', 'pietergoosen_custom_wp_trim_excerpt'); ?>      My problem is, my `<a>` tags still get stripped. I followed a couple examples, and all suggest adding the `<a>` tag to the `$allowed_tags`, but even that doesn't solve the problem. Any suggestions?


title: Pagination for two loops

text:
I know this has been discussed before but I can't seem to make it work with any of the solution posted in other topics. How can I make pagination to work on a loop like this:
             <?php $my_query = new WP_Query('showposts=5'); ?>             <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
" title="<?php the_title(); ?>"><?php the_title(); ?>
             <?php the_content(" More...",TRUE,''); ?>             <?php endwhile; ?>

             <?php $my_query = new WP_Query('showposts=5&offset=5'); ?>             <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
" title="<?php the_title(); ?>"><?php the_title(); ?>
             <?php the_content(" More...",TRUE,''); ?>             <?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=%#%',         'prev_text' => __('« Previous'),         'next_text' => __('Next »'),         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages     ) );     ?>      I want first page to display 10 unique posts (5 in first loop and 5 in the second), second page the next 10 unique posts ( same as before) and so on. Thank you. UPDATED : Added pagination.


title: one time popup after theme activation

text: I've written a custom theme which does some one-time setup chores after activation - things which I need to do every time I use it on a fresh copy of wordpress, like creating a nav menu and configuring discussion settings. I've automated these things in my theme rather than a plugin because they are directly related to the theme and would have limited use elsewhere. Anyway, what I'd like to do is after my theme is activated for the first time, show a popup box that will give the user a choice of whether or not to perform these actions. The code to do them is already working and written, but I don't have a mechanism for the user to start them off - my only real option here is to run them automatically by hooking into `after_setup_theme`. I've figured out how to tell if it's a first-time activation, using `update_option` to store a boolean that I then check against - here's what I have:               function jp_theme_setup()     {         $installed = get_option('jp_installed');         if (!$installed)         {             update_option('jp_installed', true);             //set up my theme, do stuff involving things                  //how can I ask the user whether or not to do certain actions?         }     }     add_action('after_setup_theme', 'jp_theme_setup');      How can I use a dialogue box to ask the user whether or not to perform these setup tasks?


title: How to manage a URL with pageX in it in order to generate a 404 page?

text: So I have done all this on a brand new WP install to rule out any potential effects from anything else. WP is setup with a static page as the home page. Permalinks are setup as simply %postname% and changes are saved to the .htaccess. When I go to http://example.com the homepage displays as expected. When I go to http://example.com/page88 the homepage again is displayed (no 404 error, a HTTP200 is returned). Note 404 pages are workings. Digging into this using the DEBUG BAR plugin it shows that this is matching a WP rewrite rule:               Request:     page66          Query String:     paged=66          Matched Rewrite Rule:     page/?([0-9]{1,})/?$          Matched Rewrite Query:     &paged=66      This is confirmed by outputting paged as outlined in the Wordpress Codex here. This does show that it is page 88. The question is how best to manage this? Obviously I would like a 404 page to be generated but I'm not clear how best to check that it is applicable. There were a number of related solutions from an old question here however they did not work. Thanks for your help.


title: List Taxonomies: Don't list taxonomy if it has no post - depending on custom post-meta?

text: This might be complicated to explain and I don't know if there is a solution to that!? I have a custom-post-type named "wr_event" and a hierarchical custom-taxonomy named "event_type". The custom-post-type has a meta-box for `event_date` and all posts associated with this post-type are sorted by this `event_date`. I have one special condition in my loop to query if the `event_date` has already taken place - in that case it's not shown but only listed in my archives. Just like you can use `wp_list_categories()` I wrote a custom function that lists all taxonomy-terms exactly the same way. And now my question: When I use my custom `wr_list_taxonomy()` function it lists all taxonomies that have a post associated with it. Just like `wp_list_categories()` lists only the categories that have a post associated with it. If there would be a taxonomy-term that doesn't have posts it wouldn't be listed. I wonder if it's somehow possible to "exclude" a taxonomy-term or simply not list it if all posts associated with it have an `event_date` that has already taken place. Sounds complicated right? So I have this function that works like a charm.               function wr_list_taxonomy($taxonomy, $orderby, $hierarchical) {         $show_count   = 0;         $pad_counts   = 0;         $title        = '';              $args = array(           'taxonomy'     => $taxonomy,           'orderby'      => $orderby,           'show_count'   => $show_count,           'pad_counts'   => $pad_counts,           'hierarchical' => $hierarchical,           'title_li'     => $title         );              return wp_list_categories( $args );     }      It lists all terms and only lists them if posts are in them. However I have posts ("events" in my case) in all taxonomy-terms, but have terms whose events are all over. And if the "events" in a term are all over (and therefore the term-page doesn't list anything as I wrote above because I filter them by todays date) I don't want this function `wr_list_taxonomy()` to print this term. Is that somehow possible?


title: Hide cart when empty

text: Could someone help me with this syntax: At the moment I have a simple link to my shopping cart like this:               <?php if ( is_woocommerce_activated() && isset( $woo_options['woocommerce_header_cart_link'] ) && 'true' ==     $woo_options['woocommerce_header_cart_link'] ) { ?>      And I want to add the condition to show my mini-cart when contents are greater than 0. I found the code below, but I can't figure out where to put this condition in the line above.               <!-- <?php         if ( is_woocommerce_activated() && sizeof( $woocommerce->cart->cart_contents ) !== 0) {             appply_mini_cart();         }         ?> -->      I would appreciate some guidance! Thanks


title: Increase Comment Author Gravatar Size On WordPress Default Comment Function

text: I am new to WordPress theme development. I am designing a new theme and using less codes and file as I am starting from basic. I am adding comments and comment form in my `single.php` using `<?php comments_template(); ?>` only. This one line is showing my blog comments, comment navigation, comment form all things. But its showing my commenters gravatar in `32px` size that I want to increase. I know that if I will use `comments.php` then I can do it but **How To Increase Comment Author Gravatar Size?** in this circumstances.


title: Hiding certain panels in dashboard

text: I want to hide certain panels in the dashboard, for example the `Excerpt` panel. This metabox has an `id` of `postexcerpt`. Is it a good idea to simply add some CSS rule like `#postexcerpt { display: none }` in the admin's CSS? Or may this cause hidden problems down the line?


title: using jquery serialize in ajax operation for plugin

text: I am writing a plugin with dynamic no. of input fields in form. To submit form via ajax, I have used jquery serialize() function.               $(".submit").submit(function( event ) {             event.preventDefault();             var data = {                 action: 'wpaie_ajax_action',                 operation: 'import',                 importData: $(this).serialize()     //do some operation             };             $.post(ajaxurl, data, function(response) {                  });         });      Ajax is working fine and data is also serialized but I am not able understand how to read the form input fields. If I am using `echo $_POST["importData"]`, it is showing me serialized data but what should be the correct way to read that serialized data.


title: Can I use theme options to change two things at once?

text: Possible noob question -- please be nice. I'm doing up a theme options page using the sample from Themeshaper, and one of the options I want to have is to set the width of the sidebar. To do this with the CSS I already have, I need to change class attributes in my HTML in two places (one for the main column width, one for the sidebar). The Themeshaper code is fine for adding little theme option tweaks, but I can't figure out how to get a single option to modify two places in the code at once. Possibly (hopefully!) a simple question, but beyond my current abilities. Any help greatly appreciated. Thanks. **Update:** I should clarify that I'm not a programmer, and I'm already waaay out of my depth. That said, here's what I'm going for... In my theme options page, I want to have a drop-down menu with two options: 'wide sidebar' and 'narrow sidebar'. One of these will be the default. Changing the default needs to modify two CSS classes. I appreciate Rarst's answer below but I simply don't know enough about PHP to be able to get it to work. Is there a simple(r) explanation for how to get this to happen? Again, sorry if this is basic stuff.


title: Different widgets in sidebar on sub-children pages?

text: I'm working on project, where I have different widgets on pages and also different order. Example - on About page I may have **chat widget** , then **e-mail sign-up widget** , then **testimonials widget**. On other page I may have **testimonials widget** only, followed by **chat widget**. I'm using this code to show widgets on pages and children pages               <?php if ( is_front_page() ){  ?>                 <?php }elseif ( is_page('areas-we-service') || $post->post_parent == '16' ){ ?>     Do stuff here        <?php }elseif ( is_page('products') || $post->post_parent == '14' ){ ?>     Do stuff here      <?php }else{ ?> <?php } ?>      and it work. The problem is that it not work on subchildrent pages e.g. Product -> Product 1 -> Product 1.1 On Product 1.1 I don't have widgets. So, my question is, how to change code above to show widgets on subchildren, sub- subchildren etc. pages. Thank you!


title: Hooking in to plugins

text: I'm working on a plugin that would ideally be able to do things when a user does something through a _different_ plugin. I can add custom hooks in those plugins but obviously this wouldn't work well for when I want to distribute my plugin. Is there a good way to add hooks to other people's plugins from my own plugin? Is the only real solution to ask the author to include custom hooks so that other developers can build off of their work? Example: I want to do something in my plugin when someone retweets an article. If there was a custom hook in whatever the popular retweet plugin is that I could hook in to and fire off of, that would be great. There isn't, so I can modify their plugin to include it, but that only works for my copy, and I don't want to try to redistribute that. Do we just need to try and be better plugin developers so that we can all play nice together?


title: Modifying a JS file with data from plugin settings

text: I have a plugin that, among other things, has a javascript file that requires a few user specific settings. What would be the best way to get those settings into javascript from the plugin's settings parameters? In other words, if I make those settings part of the settings page where the user can enter them, how would I best be able to get those values into javascript? Would I have to use something to append some script tags and set them via PHP on every page load? Would setting a cookie be a better way to do this?


title: How to create link to posts in WP-Markdown

text: I am using WP-Markdown plugin for writing posts. In one post I wanted to add a link to another post, but since I am using Markdown editor I had to add the URL (permalink using month and name) of the post manually. This might cause troubles when the date or name of the post changes. I was thinking about writing something like `[1]:[post#51]` and it will result in permalink to post with id 51. Does the plugin support this or should I dig inside and write a code for this? Thanks


title: Load php file with jquery in single.php

text: I implemented in my worpdress theme ios button switch and when someone click the button the script load a php file with the text: on or off Here is the code:                 <script type="text/javascript">          $('#1').iphoneSwitch("<?php echo get_user_meta( $current_user->ID, '_fbpost_status', true); ?>",       function() {        $('#ajax').load('<?php bloginfo( 'template_url' ); ?>/includes/ajaxswitch/on.php');       },       function() {        $('#ajax').load('<?php bloginfo( 'template_url' ); ?>/includes/ajaxswitch/off.php');       },       {         switch_on_container_path: '<?php bloginfo( 'template_url' ); ?>/includes/ajaxswitch/iphone_switch_container_off.png'       });      So on.php have only the "Activated" text and of.php "Stoped" text. The on and off files have not included the wordpress variables. How can I include them? To make a update in db. Or do you know any better method for doing the update?


title: Tags to Post-ID mysql query. Tag Search

text: Im trying to implement a tag-based search. When i specify certain tags, tagged posts will be searched and the post-id will be displayed that matches the searchcriteria. Currently it only works for a single tag.               $query = "SELECT DISTINCT $wpdb->posts.ID FROM $wpdb->terms         LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id)         LEFT JOIN $wpdb->term_relationships ON ($wpdb->terms.term_id = $wpdb->term_relationships.term_taxonomy_id)         LEFT JOIN $wpdb->posts ON ($wpdb->term_relationships.object_id = $wpdb->posts.ID)             WHERE $wpdb->term_taxonomy.taxonomy = 'post_tag' " . $substring;      Substring looks like following:               $substring = "AND $wpdb->terms.slug IN ('tag1','tag2')"      And here is the problem. It does not look for single posts that match all criteria. Instead it 'collects' all posts with all tags searched. For example:               // postid1 -> tag1     // postid2 -> tag2     // postid3 -> tag1, tag2          $substring = "AND $wpdb->terms.slug IN ('tag1')"     //Output: postid1, postid3 - - - CORRECT     $substring = "AND $wpdb->terms.slug IN ('tag1','tag2')"     //Output: postid1, postid2, postid3 - - -WRONG!          //Expected: postid3      So far i have no idea howto solve it in a single mysql query. Maybe im missing something. Thanks for your help in advance.


title: Given multiple admin accounts, how can I make it so that only admin with X username can edit posts

text: My question is pretty much in the title. I have 2 or more administrators, but I only want the admin with X username to edit the title of the posts while others can only view them. Feel free suggesting solutions that involve scripting or the use of plugins. Thanks! Note: This is only for the backend/dashboard.


title: How to display posts from multiple post type in random order in wordpress?

text:
I want to display posts from multiple post types (photo, post), with one post from "photo" post type and another post from "post", in the same loop. Can anyone help me? Here is my code:               <?php     $args = array(         'post_type'=> array('photo', 'post'),         'orderby' => 'date',         'posts_per_page' => 10,         'paged' => get_query_var('paged'),     );     $query=new WP_Query($args);          if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post(); global $post;         $post_type=$post->post_type;         if($post_type=='photo'){ ?>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>

         <?php }           if($post_type=='post'){ ?>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>

         <?php }      endwhile;     ?>


title: using advanced custom field to control css hover color

text:
this is a bit challenging for me: I am using the great Advanced Custom Field plugin on my site to create different color scheme to each of my taxonomy. I created a field called **taxonomy_color** and echoed out the color like so:               <h4 style="color: <?php the_field('taxonomy_color', 'magazine_'. $tax_term->term_id); ?>;">Hello
      *** magazine_ is the name of my taxonomy.** This is fairly easy and it works perfectly, however, everything becomes more complex when I want to change my **hover** and **active** class too. since changing the hover and/or active state requires a reference to the stylesheet I was thinking about creating a dynamic stylesheet called: **style.php** and trying to pass the custom field onto that stylesheet and using this method will allow me to control the hover and active states too. this is the code I generated for my **style.php** :               <?php         header("Content-type: text/css; charset: UTF-8");     ?>     .slider-mag-template .bottom .nav li.activeSlide a,.slider-mag-template .bottom .nav li a:hover { color: <?php the_field('taxonomy_color', 'magazine_'. $tax_term->term_id); ?>;}      I can see in the site that the page is connected to my dynamic style.php but it doesn't read the field **taxonomy_color** from there. can anyone suggest? even using a different method? Thanks a lot


title: How to create a file archive in WordPress?

text: I've installed WordPress for my school's website. I have a task of creating a file archive, an uploader and a file viewer for the website. The file archive would store files on the server, "in the background". The uploader would enable users to upload files and tag them. And a file viewer would allow users to view and download files as per their tags. Both the uploader and the viewer would have to be integrated into the page. If there is a plugin that does something like this, but displays its results in the admin panel - _that would be acceptable as well_. But it would have to be intuitive and easy to use. All registered users of the site should be able to view and download the files. And only the ones with a specific file upload privilege should be able to upload them. I'm not sure whether what I want can be accomplished with the built-in media archive. I don't only want to upload media - but other file types such as documents, programs, etc. Is there a plugin that would enable registered users to upload files without using the admin panel, but just the site itself? All the download links to the files have to be included automatically in the Downloads page too. Some form of a file manager would be great.


title: The problem is that it redirects to 404 page

text: The format of the link is ok, it works. But when I open the post did not lead me to the single-customtypes but the 404 page.               add_action('init', 'tdd_add_rewrite_rules');     add_filter('post_type_link', 'tdd_permalinks', 10, 3);          function tdd_add_rewrite_rules()          {              // Register custom rewrite rules              global $wp_rewrite;         $wp_rewrite->add_rewrite_tag('%pasager%', '([^/]+)', 'pasager=');         $wp_rewrite->add_rewrite_tag('%z_localitatea2%', '([^/]+)', 'z_localitatea2='); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES         $wp_rewrite->add_rewrite_tag('%z_destinatia2%', '([^/]+)', 'z_destinatia2='); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES              $wp_rewrite->add_permastruct('pasager', '/pasager/%z_localitatea2%-%z_destinatia2%-%post_id%.html', false); //[EDIT] TO ADD MORE SLUGS, ADD /%VARIABLE2% BETWEEN %VARIABLE1% & %POST_TYPE%          }          function tdd_permalinks($permalink, $post, $leavename)     {              $no_data = 'no-data';              $post_id = $post->ID;              if($post->post_type != 'pasager' || empty($permalink) || in_array($post->post_status, array('draft', 'pending', 'auto-draft')))                  return $permalink;              $var1 = get_post_meta($post_id, 'z_localitatea2', true); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES         $var2 = get_post_meta($post_id, 'z_destinatia2', true); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES              $var1 = sanitize_title($var1); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES         $var2 = sanitize_title($var2); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES              //[COPY] COPY THE BELOW LINES TO ADD MORE VARIABLES          if(!$var1)                 $var1 = $no_data;              //[COPY] END COPY HERE         if(!$var2)                 $var2 = $no_data;              //[COPY] END COPY HERE         if(!$var3)             $var3 = $post_id;              //[COPY] END COPY HERE              $permalink = str_replace('%z_localitatea2%', $var1, $permalink); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES         $permalink = str_replace('%z_destinatia2%', $var2, $permalink); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES         $permalink = str_replace('%post_id%', $var3, $permalink); //[COPY] COPY THIS LINE TO ADD MORE VARIABLES              return $permalink;          }              add_action( 'init', 'create_post_type' );         function create_post_type() {                 register_post_type( 'pasager',                         array(                                 'labels' => array(                                         'name' => __( 'Pasager' ),                                         'singular_name' => __( 'Pasager' )                                 ),                         'public' => true,                         'has_archive' => true,                         'rewrite' => false,                         )                 );         }             $args = array(              );                  register_post_type( 'pasager', $args );             function post_type_labels( $singular, $plural = '' )     {         if( $plural == '') $plural = $singular .'s';              return array(             'name' => _x( $plural, 'post type general name' ),             'singular_name' => _x( $singular, 'post type singular name' ),             'add_new' => __( 'Add New' ),             'add_new_item' => __( 'Add New '. $singular ),             'edit_item' => __( 'Edit '. $singular ),             'new_item' => __( 'New '. $singular ),             'view_item' => __( 'View '. $singular ),             'search_items' => __( 'Search '. $plural ),             'not_found' =>  __( 'No '. $plural .' found' ),             'not_found_in_trash' => __( 'No '. $plural .' found in Trash' ),             'parent_item_colon' => ''         );     }


title: Array sorting by custom field date

text: I want to order the array by a date field called `date_start` but how do I include a meta key for this if I already have one?               $currentshowid = get_the_ID();     $today = date('Y-m-d');     $args = array(         'meta_key' => 'show_id',         'meta_value' => $currentshowid,         'orderby' => 'meta_value_num',         'order' => ASC,         'meta_query' =>array(             'relation' => 'AND',             array(                 'key' => 'date_end',                 'value' => $today,                 'compare' => '>=',             ),         ),     );


title: WordPress Database Charset/Collate

text: Is there an easy way of getting the charset and collation of the DB tables in WordPress without resorting to SQL queries?


title: Custom image sizes add to metadata

text: I want to put resized files in original file metadata.               //Original file     $aid = wp_insert_attachment($attachment, $file['file'], $post_id);     $a = wp_generate_attachment_metadata($aid, $file['file']);     //Croped images from original     $path_300x200 = path_to_file_300x200.jpg     $path_100x100 = path_to_file_100x100.jpg          crop_image($file['file'], $path_300x200, 300, 200, 85, true);     crop_image($file['file'], $path_100x100, 100, 100, 85, true);          $file1= getimagesize( $path_300x200 );     $info1 = array(     'file' => wp_basename( $path_300x200 ),     'width' => $file1[0],     'height' => $file1[1],     );     $metadata1['sizes']['300x200'] = $info1;     $a_300x200 = wp_generate_attachment_metadata($aid, $metadata1);     wp_update_attachment_metadata($aid, $a_300x200 );          $file2= getimagesize( $path_100x100 );     $info2 = array(     'file' => wp_basename( $path_100x100 ),     'width' => $file2[0],     'height' => $file2[1],     );     $metadata2['sizes']['100x100'] = $info2;     $a_200x200 = wp_generate_attachment_metadata($aid, $metadata2);     wp_update_attachment_metadata($aid, $a_100x100 );      I get in database: _wp_attachment_metadata a:2:{s:5:"width";N;s:6:"height";N;} What I am doing wrong? UPDATE:               //Original file     $aid = wp_insert_attachment($attachment, $file['file'], $post_id);     $a = wp_generate_attachment_metadata($aid, $file['file']);     //Croped images from original     $path_300x200 = path_to_file_300x200.jpg     $path_100x100 = path_to_file_100x100.jpg          crop_image($file['file'], $path_300x200, 300, 200, 85, true);     crop_image($file['file'], $path_100x100, 100, 100, 85, true);          $file1= getimagesize( $path_300x200 );     $info1 = array(     'file' => wp_basename( $path_300x200 ),     'width' => $file1[0],     'height' => $file1[1],     );     $metadata['sizes']['300x200'] = $info1;               $file2= getimagesize( $path_100x100 );     $info2 = array(     'file' => wp_basename( $path_100x100 ),     'width' => $file2[0],     'height' => $file2[1],     );     $metadata['sizes']['100x100'] = $info2;          $a['sizes']=$metadata;      //$a is generated original file metadata, and I added value to the key "sizes".          wp_update_attachment_metadata($aid, $a );      Is it right solution ? The problem is that when I want to delete original photo it only deletes original photo, but not resized... any thoughts ?


title: Post content in another div on the same page

text: Im am trying to build a wordpress site that contains a sliding div that comes from above. So on the home page you see the post and normaly when you click the title of that post, you go to that page, but i want it to open the div and slides down. If you look at my example and press X the div comes down, an should give you the content. If you click the link CENTRE FOR URBAN POTENTIAL ROTTERDAM, NEDERLAND ARCHITECTUUR you will see a blank page, but with a X if you click that one the div comes down with the content. I was play arround in the single.php that managed me to get some content. But i dont know how to go further..., i tried the WP-ShowHide and Slide Div , but wont get me anywhere .. is it even possible todo in Wordpress? Regards, Marcel


title: How to get WordPress to save upload file beyond web root

text: I am using nginx on a multisite install. I am trying to get WordPress to save uploads to a folder beyond the webroot :               /home/mydomain/file_secure      as opposed to               /home/mydomain/public_html/wp-content/uploads      I have successfully moved the uploads directory around inside the webroot with the following filter:               add_filter('upload_dir', 'my_upload_dir');     $upload = wp_upload_dir();     //remove_filter('upload_dir', 'my_upload_dir');          function my_upload_dir($upload) {         global $blog_id;         $upload['basedir'] = '/home/mydomain/file_secure/'.$blog_id;         $upload['subdir'] = '';         $upload['path'] = $upload['basedir'] . $upload['subdir'];         $upload['url']  = $upload['baseurl'] . $upload['subdir'] . '/file_secure.php?file=';                   return $upload;     }      This path is writable. It even creates the directories `file_secure` and `25` ($blog_id)               $upload['basedir'] = '/home/mydomain/file_secure/'.$blog_id;      I have looked through the core code in WordPress 3.9 `wordpress/wp- includes/functions.php` at the function wp_upload_dir() and noticed that the function description states that               * Checks the 'upload_path' option, which should be from the web root folder,      * and if it isn't empty it will be used.      I assumed that when it found my path to be outside the webroot that it should have thrown an error, but I can't find where. Needless to say, the upload did not make it to the wanted directory. On a side note, I plan to access the uploaded files from a script in the front end that will serve up the content. `file_secure.php` Any help / direction here would be much appreciated. I would really hate to find out that I need to hack the WP core in order to make this possible; but maybe it could become available in a future release. I would much rather all of the wp-content be located outside of the webroot. UPDATE: all I seem to be able to do when changing the upload path from the `upload_dir` filter is create the folder where I want the file to go; but it does not actually save the file there. It reverts back to the default settings. ANOTHER UPDATE: WordPress seems to think that the file exists because it creates an attachment post, but there is no file in the intended directory and the URL on the attachment simply has the default URL structure and not the one that I set above. So now I am trying to investigate what is going on during the attachment post creation. If anyone can spot what I may be doing wrong, please let me know.


title: What are trackbacks?

text: I was wondering what are trackbacks. I found this to be an option in Wordpress, and I am wondering if I should add them to pages and posts. Thank you for your help and support!


title: Displaying Custom Taxonomy without a hyperlink

text:
I would love some help on how I can best display the custom taxonomy of a post as text only (and not as link within an tag). I have a small template file that is called by a few other pages, and the job of that template file is to render a citation for an article - here's the complete code:

<?php the_category(' | '); ?>
        <?php the_terms( get_the_ID(), 'ehp_volumes' ); ?>        <?php the_field('ehp_citation'); ?>
      This portion of that php file:               <?php the_terms( get_the_ID(), 'ehp_volumes' ); ?>      Does its job in displaying the taxonomy - but it is wrapped in a hyperlink. Is there an attribute that will just return the text of taxonomy? Do I need to use a variable instead?


title: how to set Gallery Setting default Media File

text: When i create Gallery default is: Attachment page how to change default is media file or remove Attachment page . I don't want select is. ![enter image description here](http://i.stack.imgur.com/eSSFG.png)


title: Internet Explorer ignore my css

text: I am creating my personal blog, but Internet explorer are _*_ * me. About 5 hours I am trying to figure out what I am doing wrong, well what is my problem ? Well, I created breadcrumb for my website, only for specific custom types - reviews. All browsers are ok with this, but internet explorer (I have IE 10) are pushing my sidebar away. If you open for example this my review http://milanchymcak.com/reviews/fix- redirect-virus-review - if you open it in firefox or chrome, its ok. But in Internet explorer my sidebar is gone. I don't know what to do. So I was looking for answer on google and everybody is telling that this will fix that               <!--[if IE 6]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->     <!--[if IE 7]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->     <!--[if IE 8]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->     <!--[if IE 9]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->     <!--[if IE 10]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->        But this doesnt work at all. Internet Explorer ignores this too. I will be very happy for any help.


title: Using the WordPress 3.5 Media Uploader window as a modal popup

text: I have a general question: is it possible to use the new WordPress 3.5 Media Uploader window for other purposes (i.e., as a modal popup window for content)? I would like to do this and have spent a lot of time trying to figure out if/how to do it but have had NO luck. I'm basically looking to replace the Thickbox popup as the way my shortcode panel is presented in the admin panel. Has anyone done this or something similar? Can anyone point me to something that covers this or some variation on the theme? Many thanks, Andrew.


title: Featured images disappear after DB export/import?

text: I'm upgrading my blog right now from 3.2.1 to 3.5.2. However, for one section the featured images have seem to disappeared. The database is identical since I just did a dump/restore a few minutes ago. Other sections are fine, but for this one I am no longer receiving an array when I do `wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');` even though all the parameters are correct. I checked my edit post page on wp-admin and there is no longer an image under `Featured Images` as there was before. Is there a way to recover these images without having to upload them one by one? I'm pretty sure it's not a permalink issue, since I did the settings > permalink > save thing already.


title: single post navigation order (NOT chronological)

text: in my main loop i show only posts of the 'artworks' post type, orderby=rand. when i view a single artwork and use the next / prev nav, it disregards the main query and goes by chronological order - as described in the codex: http://codex.wordpress.org/Template_Tags/next_post_link how can i store and use the random order generated at first to alter the post navigation order? any ideas? the order would be randomized upon the reload of the home page, but within each session each 'random order' should be consistent. so, for example: 1- home page i see posts in a random order (4,7,1,8,6,3). i click on post 8. 2- on the single view of post 8, the 'next' post would be 6, and the previous would be 1. etc.. 3- i should be able to go through back and forth and the order would be consistent. 4- if i click on the title of the website or reload it again (not just history>back, but an actual reload). then there should be a new random order.


title: How to set a default one (i.e. Uncategorized) in Custom Taxonomy?

text: I'm using Custom Post Type and Custom Taxonomy in a project of mine. Just before delivering the site I found a serious bug. I used a simple `WP_Query()` with the following arguments:                         new WP_Query( array(                                   'post_type' => 'feeds',                                   'meta_key' => 'feed_arena',                                   'meta_value' => 1,                                   'order'=> 'DESC',                                   'posts_per_page' => 30,                                   'post_status' => 'publish'                               ) );      But if I delete all my custom Taxonomies (my Custom Taxonomy is "feed- categories"), it generates a fatal error, because all the posts under Feeds (CPT) become null-categorized ( **not** Uncategorized). As we can see that, in WordPress Default Post Categories there is an `Uncategorized` category that can't be deleted and is the default one, where's other categories have a "delete" button. ![Uncategorized Category - no delete button](http://i.stack.imgur.com/JDMjF.png)   ![Other Categories - there's a delete button](http://i.stack.imgur.com/blusY.png) Is there a way, we can assign a Default One for Custom taxonomy too?   So that, if all the other categories deleted, at least there'd be a default.


title: Which database table does "Featured images" save under?

text: I'm having an issue while upgrading WP from 3.2.1 to 3.5.2, where one section's Featured images have all been deleted. When I visit that section's edit post pages, the featured image thumbnails that were once there are no longer there. Is this a database issue? I just dumped/restored my database an hour ago. I'm wondering if the WP database upgrade deleted my data. Which table do the featured images data go under? I'm wondering if I could just dump/restore that table again, but I don't know which one it is. My images are still there, but the links to them don't seem to exist in the database.


title: Wordpress widget in custom theme

text:
I created a custom theme and writing a basic widget for my wordpress based website. If I paste the code in functions.php the code works fine, however if I paste the code in a separate file and keep it in the plugins directory, it doesn't show up in the admin > appearance > widgets. The problem to keep the widget code in functions.php is it collides with some plugins I care. I tried wp_register_widget as a wild guess but to no avail. Here is the widget code (You can remove the 'include' line to test the code)               class Similar_Apps_Widget extends WP_Widget {              public function __construct() {                 parent::__construct(             'Similar_Apps_Widget', // Base ID             __('Similar Apps', 'text_domain'), // Name             array( 'description' => __( 'Similar Apps Widget', 'text_domain' ), )              );         }              public function form( $instance ) {              }              public function update( $new_instance, $old_instance ) {              }              public function widget( $args, $instance ) {                   ?>
Similar Apps
 <?php              include (TEMPLATEPATH . '/include/' . get_field('similarapps'). '-similar-products.php');              }     }     register_widget( 'Similar_Apps_Widget' );      and here is the functions.php code where I define the widgets placement               <?php           if (function_exists('register_sidebar')) {          register_sidebar(array(         'name' => 'Widgetized Area',         'id'   => 'widgetized-area',         'description'   => 'This is a widgetized area.',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
'     ));          register_sidebar(array(         'name' => 'Page Widget',         'id'   => 'page-widget',         'description'   => 'Page Widgets.',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
'     ));          }               ?>      and here is where it is inserted into the theme
              <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('page-widget')) :     else : ?>         <?php endif; ?>


title: How do I batch create revisions of all posts?

text: I cleaned up an old-site from pasted tags, manually created lists, etc, and I'd like to keep the old posts as "revisions", so we can easily "compare" with the old posts and retrieve/revert the original content if needed. So I should either injecting the revision rows in the new DB or just naturally create them in the old WP installation, by batch-updating all the posts… …or starting from the new cleaned-up dev installation and injecting the revisions. The problem is the old site didn't even use revisions (version 1.6 or 2 or so), so before I even try anything, I should MAKE wordpress to generate the right revisions itself (so the injections just adds content in existing rows, not whole rows with missing references etc) I know there are several places where the revisions and actual posts are linked/related/referenced so the process should be mostly done by wp functions and the fewer manual DB manipulations. Thanks.


title: How to list posts with disabled/closed comments, with pagination?

text: i'm interested how to display all posts (from all categories) that have closed/disabled comments? I have tried using the comments_open() function inside the loop, that works, i don't know how to enable pagination on it, and here's why: wp query - here's the query that displays all posts, i set here how many per page should be displayed if (!comments are open) i list the posts so, the problem here is that i want to show 10 posts per page -the loop actually goes through 10 posts, and displays any post of the given 10 that has closed comments, and then creates a second page with 10 posts and does the same etc... I need a filter inside the loop itself, so i display 10 posts with disabled comments PER PAGE. Pls, can anyone help with this?


title: passing multiple parents value into a shortcode

text:
I need to pass a few values into the parent attribute of the wp_query. However I'm using a shortcode, so, If I pass a single value works perfect, but if I need to send multiple values it breaks, would be a great holiday gift if some1 could help me with it. By default, it works with the current post ID $thePostID, however If I need to retrieve the parent I'm using the parent attribute. Take a look at my code.                function andrew_child_loop_shortcode_new ( $atts ) {           global $post; $thePostID = $post->ID;           extract ( shortcode_atts (array (             'posts' => 20,             'parent' => $thePostID,             'exclude' => array(0)           ), $atts ) );           ///////$atts[ 'parent' ] = explode( "," $atts[ 'parent' ] );           ///////extract( $atts );           $output = '

';              $args = array(                 'orderby' =>  'menu_order',                 'order' => 'ASC',                 'post_parent' => $parent,                 'post_type' => 'page',                 'post__not_in' =>  array($exclude),                 'posts_per_page' => $posts                );           wp_reset_query();           $i=0;           $andrew3_query = new  WP_Query( $args );             $output .= '
';           while (  $andrew3_query->have_posts()) { $i++ ; $andrew3_query->the_post();             $output .= '
';             if(has_post_thumbnail()):;             $output .= ''.                         get_the_post_thumbnail(get_the_ID(), 'blog-post-carousel').                         '';             else :;             $output .= ''.                           ' ';                  endif;             $output .=                         '
'.                    get_the_title().                    '
'.                    '
'.                    get_the_excerpt().                    '
'.                    '
';                }           wp_reset_query();           $output .= '
';           return $output;         }         add_shortcode('display_childs_multiple', 'andrew_child_loop_shortcode_new');        I'm calling the parent this way [display_childs_multiple parent="10,15,20"]


title: advice on creating a 'related posts' query like the one used on stackexchange

text: One of the things that I most enjoy about the stackexchange website is the 'related questions' that show up on the sidebar when I am viewing a question (or show up as I am typing my question). It is readily apparent to me that the logic being used there is much more advanced than 'normal' wp functionality. I know this would be a very proprietary kind of question, but is there any available documentation on the functions being used to generate the list? I am looking for something a bit more advanced than simply using tags for relating posts. *I was going to use YARPP but after reading a number of comments on how that plugin can bring a site to its knees, I figured it would be best to ask first.


title: Fixing category count

text: Somehow my post counts are incorrect due to inserting rows via php. I have the following code to update the count, is it correct?               global $wpdb;     $result = mysql_query("SELECT term_id,term_taxonomy_id FROM $wpdb->term_taxonomy where taxonomy = 'category'");     while ($row = mysql_fetch_array($result)) {       $term_taxonomy_id = $row['term_taxonomy_id'];             $countresult = mysql_query("SELECT object_id FROM $wpdb->term_relationships WHERE object_id IN (SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish') AND term_taxonomy_id = '$term_taxonomy_id'");       $count = mysql_num_rows($countresult);       mysql_query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term_taxonomy_id'");             }


title: Remove a script from a template file using wp_dequeue_script

text: I thought I had read it was possible to use `wp_enqueue_script()` and `wp_dequeue_script()` directly in individual template files. However, when I add                 wp_dequeue_script( 'myscript' );      to the top of page.php, `myscript` still gets loaded. Is it possible to do what I'm trying to do?


title: Delete all Tag Links from Posts

text: We're working on this site: http://granthammond.staging.wpengine.com/ which will no longer be using tags, i need a way to strip / remove all the tag links in the post content, for example: any hyperlinks containing `/tag/` need to go, in their entirety,               Tagged with: Nashville Real Estate      i need to remove the whole `<a>` element. for all tags, across all posts. as usual, any and all assistance is appreciated.


title: Using source control with WordPress

text: I just recovered from a pretty bad crash using Server 2008 Shadow copy. Ultimatly I didn't lose more than a few hours of work but a loss is a loss. I've decided to move to version control to prevent this from happening again. What I'm interested in knowing is how does one handle the mysql directory? And how do you handle a development site and a live site (trunk and branch) running at the same time? I assume you wouldn't be able to move a development database to production with the posts being consistently updated. Any thoughts would be appreciated.


title: What is the best practice to get a site from local to online?

text: I develop my sites on a local xamp setup. When I´m done I need to get the site to my customer´s domain. Can I use vault press or backupbuddy for this, or is there a better process ?


title: What would causes search to return incorrect results?

text: Recently our site began no longer returning correct search results. When searching it returns one result that's unrelated to the inquiry. I've turned off all plugins and reverted back to a day when I thought it was working properly to no avail. What could possibly cause this to occur? You can see in the image below that the result is not related to the inquiry. ![enter image description here](http://i.stack.imgur.com/0j4Mo.png) Here's an example of a page with the title and terms related to the inquiry. ![enter image description here](http://i.stack.imgur.com/1DmCn.png) The front end also returns inaccurate results![enter image description here](http://i.stack.imgur.com/1O7qd.png)


title: Ideal WP multisite server setup for up to 1000 sites?

text: I plan to host up to 1000 sites for a large non-profit. Each site could get quite a bit of traffic. What is the ideal setup? VPS, *ngix, mem-cache etc?


title: How do I use the control callback when creating a simple dashboard plugin

text: On this page: http://codex.wordpress.org/Function_Reference/wp_add_dashboard_widget The function **wp_add_dashboard_widget** is described. It states:               wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = null)      How do you use the $control_callback, properly? I am completeley stuck, as I have defined it but cannot use it. I need to create a form within this widget which is why I am using the control_callback. **EDIT:** as a side note I am using Wordpress 3 and Multisite


title: Extending body classes in front- and backend

text: I want to extend both body classes for the front-end as well as for the admin area. I have seen some snippets floating around, which led me to the following               add_filter('body_class','add_custom_body_classes');     add_filter('admin_body_class', 'add_custom_body_classes');      Now it seems to me, that I do have to do a type check like the following, because in the case of the backend extension the variable is a string and not an array.               function add_custom_body_classes($classes) {         $someClassA = 'someText';         $someClassB = 'someText';              if (is_array($classes)) {             $classes[] = $someClassA;             $classes[] = $someClassB;         }         else {             $classes .= ' ' . $someClassA;             $classes .= ' ' . $someClassB;         }         return $classes;     }      Is this correct or what is it I am missing?


title: Custom post type category not displaying in custom post type

text: I've created a new custom post type (lets call it "Reviews") on the backend of my Wordpress. It works fine for the most part but the Categories I create within that Custom Post Type are not displaying on the meta box. For example, in a normal post, it should say "In Category X". In the custom post type, that field is empty. Here are two examples: Working properly: http://gamingsirs.com/?p=1 Not working: http://gamingsirs.com/?reviews=test               <?php $category_list = get_the_category_list( __( ', ', 'standard' ) ); ?>     <?php if( $category_list ) { ?>     <?php printf( '' . __( '%1$s', 'standard' ) . '', $category_list ); ?>     <?php } // end if ?>      You can see the category area is blank. Any suggestions on how to make it show would be greatly appreciated.


title: Menu items id's - are they 100% unique?

text: With regards the menu item id's WP generates such as `menu-item-814`, are these 100% unique in nature? I know they are unique at the time, but are they always unique? Meaning that if I was to delete something that had the id of 814, is it possible that some other menu item could now be assigned this ID? ...or if WordPress was updated do they still keep the same ID's? I ask because I want to assign something to a certain menu button via JavaScript but on the off chance the button is removed I don't want to be applied to a new button that has now been assigned that ID.


title: Rewrite rules for varying nested terms of custom taxonomy

text: I've searched the net an the only working solution to this seems to be this post by Jeff which does everything except handle nested terms. Does anybody know how to change the rewrite based on the term depth? Thanks in advance


title: Get list of all Grandchild Pages

text: I have the following page hierarchy, all of which are under a top page (TOP) with ID = 1:   * mid1      * gc1     * gc2   * mid2      * gc3     * gc4 I would like to make submit `WP_Query` query that will return random pages that are grandchildren of TOP - in this example, I want to randomly select from gc1, gc2, gc3 and gc4, but exclude mid1 and mid2. What is the best way to do this?