title: Display one post in different formats conditionally

text: I think I just coded myself into a corner. I am setting up a page with an image. The image is an imagemap with lots of links. When you click on the link, it opens a post in a colorbox. So far I have managed to get this part working using a combination of the Lightbox Plus and Post Template plugins. Unfortunately this involves assigning each post to a specific template. The template simply removes the title/image/menu. But this permanently alters the post display. I need to post to still show the full header if it is accessed through the normal menu or from a Google search. How can I display a post differently based on how it is accessed? OR - how can I insert just the post content into the colorbox window without using a custom page or post template?


title: what's the meaning of the field wp_capabilities in table wp_usermeta

text: I am new to wordpress, in table `wp_usermeta` I notice that we have a row               meta_key                meta_value     wp_capabilities       a:1:{s:13:"administrator";b:1;}      First, what's the meaning of meta_value `a:1:{s:13:"administrator";b:1;}` , where can I found the exactly explanation of this filed ? Or I what to know all about the `role` `user` `Capabilities` , where can I get these information. Second, how can I create new roles via `wordpress's API` by code Thanks in advanced.


title: Custom Post Type and Taxonomy URL rewrite

text: I'm creating custom theme for my personal website using Wordpress 3.5.1. I have problem with the WordPress custom post type and taxonomy, here's the detail:   * custom post type name: `articles`   * taxonomy name: `article-categories`   * rewrite slug: `articles` (same with my cpt) Currently my URL is like this:   * `example.com/articles` --> `archive-articles.php` (it works)   * `example.com/articles/taxo-parent` --> `taxonomy.php` (it works)   * `example.com/articles/taxo-child` --> `taxonomy.php` (it works)   * `example.com/articles/post-title` --> I use `single-articles.php`, it doesn't work I want my URL to be like this:   * `example.com/articles`   * `example.com/articles/taxo-parent`   * `example.com/articles/taxo-parent/taxo-child`   * `example.com/articles/taxo-parent/taxo-child/post-title` It's been a week working with this case and search / reading post from google but still have no luck, really appreciate if you guys could help me. Thanks EDIT: I use WP Custom Post Type UI plugin to create custom post type and custom taxonomy


title: How to display custom post type only on a certain page?

text: I have created a custom post type called 'project'. But how do I get the custom post types to display only on my main template? It's a one page website and I don't want it to direct the visitor to a second page. Wordpress v. 3.5.1                <?php          function my_custom_post_project() {     $labels = array(         'name'               => _x( 'Projects', 'post type general name' ),         'singular_name'      => _x( 'Project', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'project' ),         'add_new_item'       => __( 'Add New Project' ),         'edit_item'          => __( 'Edit Project' ),         'new_item'           => __( 'New Project' ),         'all_items'          => __( 'All Projects' ),         'view_item'          => __( 'View Project' ),         'search_items'       => __( 'Search Projects' ),         'not_found'          => __( 'No projects found' ),         'not_found_in_trash' => __( 'No projects found in the Trash' ),         'parent_item_colon'  => '',         'menu_name'          => 'Projects'     );          $args = array(         'labels'        => $labels,         'description'   => 'Holds my projects and project specific data',         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title','editor', 'excerpt'),         'has_archive'   => false,                 'rewrite' => array('slug'=>'/','with_front'=>false),     );     register_post_type( 'project', $args );     }          add_action( 'init', 'my_custom_post_project' );          function my_taxonomies_project() {     $labels = array(         'name'              => _x( 'Project Categories', 'taxonomy general name'    ),         'singular_name'     => _x( 'Project Category', 'taxonomy singular name' ),         'search_items'      => __( 'Search Project Categories' ),         'all_items'         => __( 'All Project Categories' ),         'parent_item'       => __( 'Parent Project Category' ),         'parent_item_colon' => __( 'Parent Project Category:' ),         'edit_item'         => __( 'Edit Project Category' ),         'update_item'       => __( 'Update Project Category' ),         'add_new_item'      => __( 'Add New Project Category' ),         'new_item_name'     => __( 'New Project Category' ),         'menu_name'         => __( 'Project Categories' ),     );     $args = array(         'labels' => $labels,         'hierarchical' => true,     );     register_taxonomy( 'product_category', 'project', $args );      }      add_action( 'init', 'my_taxonomies_project', 0 );      I now changed the code in index.php:                  <?php get_header(); ?>                   <div id="posts" class="row isotope ">          <!-- Start Project -->         <?php                $args = array(        'post_type' => 'project'        );        $projects = new WP_Query($args);        if ($projects->have_posts()) {        while ($projects->have_posts()) {        $projects->the_post();        the_title();         get_the_content();          }        }              ?>        </div>              <?php get_sidebar(); ?>         <?php get_footer(); ?>      The title is brought in but for some reason with a height of 0px. Is this related to the code or is it a completely different matter? Also the content from the editors metabox is not showing.


title: Edit php files in subdirs in a child theme

text: I want to change a php file in a subdir of my theme folder. The path to that specific file is:   `/includes/sf-content-display/sf-post-formats.php` I copied the file within the subdirs in my child theme and made the changes. It seems, if I read some articles, that I have to hook a selfmade function in a file _functions.php_ in the child theme. I did the folowing:               function require_once_child() {         require_once('includes/sf-content-display/sf-post-formats.php');         }          function require_once_child() {         remove_action( 'init', 'require_once' );         add_action( 'init', 'require_once_child' );     }     add_action( 'init', 'require_once_child' );      Result is an error: > Fatal error: Cannot redeclare require_once_child() (previously declared in > /www/htdocs/keltenwo/wp/wp-content/themes/flexform-child/functions.php:3) in > /www/htdocs/keltenwo/wp/wp-content/themes/flexform-child/functions.php on > line 9 Any suggestions?


title: Sidebar Thumbs Squished?

text:
My Thumbnails seem squished for some reason even though I copied the code from some thumbnails I have that seem to be working fine. The code that works: in index.php               <a href="<?php the_permalink(); ?>">     <?php the_post_thumbnail( 'category-thumb',array('title' => "")); ?>           in functions.php               //Main Thumbnail Size     if ( function_exists( 'add_image_size' ) ) {         add_image_size( 'category-thumb', 192, 134 );     }      The thumbs above work fine, resizing the main image to 192x134 without a problem. The code below does not work. in sidebar.php
         <a class="sidebar-thumb" href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'sidebar-thumb',array('title' => "")); ?>                <a class="sidebar-link" href="<?php the_permalink(); ?>"><?php the_title(); ?>
      in functions.php               //Sidebar Thumbnail Size     if ( function_exists( 'add_image_size' ) ) {         add_image_size( 'sidebar-thumb', 47, 47 );     }      What did I do incorrectly?


title: how do I add role and capability after I create a new user

text: I have a simple requirement:               1. create a user     2. create a role for the user     3. add capability for the role      First, create a new user               $uid = wp_insert_user($userdata);      Second & Third, create a new role and adding capability on it               add_role( $role, $display_name, $capabilities )      How can I make the relationship between the role and the user ?


title: How to count number of functions attached to an action hook?

text:
I have some actions like this                   function simple_notification() {         echo '
This is a notification
';         }         add_action( 'site_notices', 'simple_notification' );              function simple_notification2() {         echo '
This is a notification
';         }         add_action( 'site_notices', 'simple_notification2' );              function simple_notification3() {         echo '
This is a notification
';         }         add_action( 'site_notices', 'simple_notification3' );      Now i'm displaying those action by calling `do_action` in my template               <?php do_action('site_notices'); ?>      I would like to display notice count near a menu link called `notifications` Can anyone tell me how to calculate it? ## Update: As you can see, three notices displayed when i use `do_action('site_notices');` So I want to display in the menu like `notifications (3)`


title: Creating custom field with drop down on new post page

text: I Am trying to create a default custom field drop down with pre populated values from the DB to be shown while creating a new Post or editing a existing post. I am aware about how to add a single custom field and have added few as follows               add_action('wp_insert_post', 'set_default_custom_fields');      function set_default_custom_fields($post_id) {     if ( $_GET['post_type'] != 'page' ) {     add_post_meta($post_id, 'email', 'xyz@mail.com', true);     }     }      This is working fine for me and i am able to see custom field with default value but i am not sure how to add a drop down in place of single text field, i tried something like this but seems like its not working.                add_action('wp_insert_post', 'set_default_custom_fields');        function set_default_custom_fields($post_id) {         if ( $_GET['post_type'] != 'page' ) {     <select name="voodoo_dropdown" id="voodoo_dropdown">             <option<?php selected( add_post_meta($post->ID, 'voodoo_dropdown', true), 'USA' ); ?>>USA</option>             <option<?php selected( add_post_meta($post->ID, 'voodoo_dropdown', true), 'Canada' ); ?>>Canada</option>             <option<?php selected( add_post_meta($post->ID, 'voodoo_dropdown', true), 'Mexico' ); ?>>Mexico</option>             </select>     }     return ;     }      Due to my lack of knowledge i am not sure where i am doing wrong or what needs to be done to accomplish this task


title: The use of including upgrade.php when building custom queries

text: I started building a plugin in which I need to build some custom queries with `wpdb` object. It's the first time I use it. So I checked out how to use it. I watched some examples and there is something which is messing up my mind : `upgrade.php` Actually when I create a custom query, this one only works when I include `upgrade.php` this way :               require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );     $custom_posts = $wpdb->get_results( 'SELECT * FROM ' . self::TABLE . '', OBJECT_K );     $wpdb->show_errors();     echo $wpdb->last_query;     return $custom_posts;      This is just one of the method's example I can privide. What is the use of `upgrade.php` ? I mean, if I don't put it, the query doesn't work. Could someone explain, please, cause there's nothing in the codex concerning that. Am I really oblidged to use it ? why ? How ? Thanks UPDATE : Here is the complete code.               /**      * On activate or uninstall plugin      */     register_activation_hook( __FILE__, array( 'Cpt', 'init' ) );     register_deactivation_hook( __FILE__, array( 'Cpt', 'uninit' ) );     register_uninstall_hook( __FILE__, array( 'Cpt', 'uninit' ) );          global $wpdb;          class Cpt     {              CONST TABLE = 'cpt';              /**          * Constructor          */         public function init()         {             /**              * Creation table for cpt              */             $sql = "CREATE TABLE IF NOT EXISTS `" . self::TABLE . "` (               id mediumint(9) NOT NULL AUTO_INCREMENT,               time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,               name tinytext NOT NULL,               UNIQUE KEY id (id)             );";             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $wpdb->query($sql);                  self::convert_to('post', 'custom');         }              public function uninit() {             /**              * Delete table for cpt              */             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             //$wpdb->query("DROP TABLE IF EXISTS `cpt`;");             //$this->delete_cpt("Custom post 1");         }              /**          * Add a custom post type          */         public function add_cpt($name) {             /**              * Add a single data              */             $time = (string)date('dmY');             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $wpdb->insert(                  self::TABLE,                  array(                     'time'=>$time,                      'name'=>$name                 )              );             /*$wpdb->show_errors();             echo $wpdb->last_query;             die();*/         }              /**          * Delete a custom post type          */         public function delete_cpt($name) {             /**              * delete a single data              */             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $wpdb->delete(                  self::TABLE,                  array(                      'name'=>$name                  )              );             $wpdb->show_errors();             echo $wpdb->last_query;             die();         }              /**          * Get all custom post types          */         public static function get_ctps() {             /**              * delete a single data              */             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $custom_posts = $wpdb->get_results( 'SELECT * FROM ' . self::TABLE . '', OBJECT_K );             $wpdb->show_errors();             echo $wpdb->last_query;             return $custom_posts;         }              /**          * Get a single custom post type          */         public function get_ctp($name) {             /**              * get a single data              */             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $custom_post = $wpdb->get_results( 'SELECT name FROM ' . self::TABLE . ' WHERE name = $name', OBJECT_K );             $wpdb->show_errors();             echo $wpdb->last_query;             print_r($custom_post);             //return $custom_post;         }              /**          * Post type conversion          */         public static function convert_to($from, $to) {                  // Get the posts of the type $from             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $wpdb->update( 'wp_posts', array('post_type'=>$to), array('post_type'=>$from) );             $wpdb->show_errors();             echo $wpdb->last_query;         }              /**          * Generate admin menu with all custom post types          */         public function generate_menu() {                  $custom_posts = self::get_ctps();          }     }


title: Making featured image to show on home page

text: I am working on twenty twelve theme. Whenever I post an image gallery, it shows all of images including featured image on front page same as it looks inside. I wanted it to just show featured image on home page instead of showing all. I tried but no success. Any help appreciated!! Thanks


title: How to bypass the Easy Digital Downloads checkout process?

text: I've decided to use Easy Digital Downloads as a base to create a secure download area for a client. The client will be uploading general files such as .pdf's and word documents for their members. What I'd like to do is bypass the checkout process of Easy Digital Downloads so users can download a file straight away, without having to first add a download to their cart, checking out, and then receiving the email with the download link. Is anyone familiar with EDD and how this can be achieved?


title: How would I remove an inline googleAPI font script in the the parent theme header.php?

text: Is there any way to remove the function call to the googlefontapi font in the parent header.php file besides copying the parent header.php file to the child theme and then overriding it and delete the line of codes? I was searching for a way to dequeue the call but it doesn't have a handle and it's an inline script in the parent theme header.php file.               (function() {         var wf = document.createElement('script');         wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +           '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';         wf.type = 'text/javascript';         wf.async = 'true';         var s = document.getElementsByTagName('script')[0];         s.parentNode.insertBefore(wf, s);     })();      Thanks in advance.


title: get_posts from a category id doesn't work

text: I use the following code to get portfolio type posts from category id, but it doesn't work.               $args = array( 'numberposts' => $items, 'post_type'=>'portfolio','orderby' => 'date','order'=>'DESC','category' => 5 );     $posts = get_posts($args);     foreach($posts as $post){         setup_postdata($post);         $return_html='......';     }      however,if I leave the category id empty, it' fine and will show all categories posts. I'm sure that there are many posts under category 5. Thanks in advance.


title: How do I delete element from a serialized array upon deletion of a post?

text: I want to delete an element (post id) from a serialized array associated with a specific meta_key. The following screenshot tells the whole story. ![enter image description here](http://i.stack.imgur.com/XVPTX.png) What you're seeing are, post ids saved in a serialized array. Upon deletion of any post the id of the post should be removed from meta_value where meta_key is "whatever". I want to wrap unset for elements (both key and value) inside a function as shown below. Sounds complex to me.               add_action('before_delete_post', 'upon_deleting_post');     function upon_deleting_post($post_id){     ....     };


title: Normal page, can select named page template, but page.php used instead

text:
In other words, for some pages, I set the named template and update, and the change carries through to the front-end. For other pages, wp-admin shows the changed template name, but that template is not shown but instead the default page.php. select * from wp_postmeta where meta_key = '_wp_page_template' and post_id=756               meta_id post_id meta_key    meta_value     38002   756 _wp_page_template   page-map.php      In header.php, it seems to fall back on page.php instead of reading the template file name:
     <?php         echo '';         if (is_front_page()) echo 'front page. ';         if (is_page()) echo 'page. ';             echo 'template: '.basename(get_page_template()).'.';         $page_object = get_queried_object();         $page_id     = get_queried_object_id();         echo 'page id: '.$page_id.'.';         echo 'post id: '.$post->ID.'.';         echo '';     ?>      The printout from this echo is:               template: page.php.page id: 0.post id: 6863.      In other words (since the front page and page checks give empty string), it doesn't consider it a page at all, even though it's under Pages in wp-admin. Also, the post id is wrong, it should be 756 and not 6863 which is the post id of the last post in the loop. It does execute content.php but not index.php. Also, it displays archived posts, and it does execute archive.php. I have yet to find out if it used any template at all, unless archive.php is a template. It obviously exists as a page in the database, and the permalink is correct for the page. But somehow WP doesn't think it's a page at all. There is a post_type named the same as the permalink slug. Does that take precedence and if so how do I make it not take precedence?


title: Get permalink to page?

text:
I know this is going to be simple but I can't work it out. I want to create a nav in the footer listing each page and it's child pages. It will look something like this

Parent

Child One

Child Two

Child Three

        I'm using this code to do it.
             <?php             $args = array(                 'sort_column' => 'menu_order',                 'parent' => 0,                 );             $pages = get_pages($args);             foreach($pages as $page){                 ?>

                             <a href="<?php echo $page->permalink; ?>"><?php echo $page->post_title;?>
                     <?php                       wp_list_pages('title_li=&depth=1&child_of='.$page->ID.'');                     ?>
                 <?php                 }             ?>
      My problem is getting the permalink to the parent page.                   <a href="<?php echo $page->permalink; ?>"><?php echo $page->post_title;?>        How do I get the permalink in this situation?


title: How do I make archives.php for one category only?

text: I have a basic archives.php file. I was trying to get it to display only posts from category 1. When I do query_posts('cat=1'), the URL is then ignored and all posts in category 1 are displayed. For example, lets say I have one post in category 1: it's called "testing post" and is dated November, 1, 2012. Lets say I have another post in category 5 dated April 2, 2012. With the current archives.php (using the query posts for cat 1) the URL: http://testing.com/2012/04 resolves to show all posts within category 1. No good, since the post is dated November, and the URL is querying for April (04). The archives.php will resolve http://testing.com/2012/04 and http://testing.com/2012/11 as each of those months have a post in them (albeit not from category 1), it will not however resolve http://testing.com/2012/09 as that month doesn't have any posts (category 1 or otherwise) How can I make the archives.php file query for the current month (whatever is in the URL) but only display posts in category 1? Asked another way, how can I make http://testing.com/2012/04 come up with a "sorry there are no posts here" message, like in http://testing.com/2012/09 while http://testing.com/2012/11 still displays the one post from category 1?


title: How to sort Custom Fields by a value

text: i use below code in home page for show a table of custom fields. but i don't know how sort this table by duration value.               <table>     <?php while(have_posts()): the_post() ; ?>     <?php if (get_post_meta($post->ID, 'duration', true)>'1') :  { ?>     <tr>    <?php global $wp_query; $postid = $wp_query->post->ID; ?>         <td>    <?php echo get_post_meta($postid, 'target', true); ?> </td>         <td>    <?php echo get_post_meta($postid, 'price', true); ?> </td>         <td>    <?php echo get_post_meta($postid, 'duration', true); ?> </td>         <?php wp_reset_query(); ?> </tr>     <?php } ?>     <?php endif; ?>     <?php endwhile; ?>        </table>


title: How to number the posts (ie #1, #2, #3) in a wp_query?

text: What is the best way to display the appearance number of a post in a query? For example, if a post is the first listed print #1. If it is third, print #3. Any direction is appreciated!


title: WP-Markdown treating java generics like HTML tags

text: With some Java generic code in a code block, ie:               List<Integer> l = new ArrayList<Integer>();      WP-Markdown was treating as HTML, and no matter what I did, the code above got turned into something like               List<Integer> l = new ArrayList</Integer><Integer>();</Integer>      Is there any way to get WP Markdown to behave better with this kind of code? Gist and (clearly) Stackexchange don't have this problem.


title: register_post_type exclude_from_search argument not working

text: I have a post type registered with this code, however `'exclude_from_search' => true` seems to have no effect as I still find output in the search page. Am I making some mistake?               add_action('init', 'abundant_life_slides_register');     function abundant_life_slides_register() {         $args = array(             'label' => 'Slides',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'show_in_nav_menus' => true,             'has_archive' => false,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array('slug' => 'slides'),             'query_var' => true,             'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),             'labels' => array (             'name' => 'Slides',             'singular_name' => 'Slide',             'menu_name' => 'Slides',             'add_new' => 'Add Slide',             'add_new_item' => 'Add New Slide',             'edit' => 'Edit',             'edit_item' => 'Edit Slide',             'new_item' => 'New Slide',             'view' => 'View Slide',             'view_item' => 'View Slide',             'search_items' => 'Search Slides',             'not_found' => 'No Slides Found',             'not_found_in_trash' => 'No Slides Found in Trash',             'parent' => 'Parent Slide',             'exclude_from_search' => true,     ));          register_post_type('slides', $args);     }


title: Display WP posts in 3 responsive columns

text:
I'm trying to display 6 random WordPress posts in 3 responsive columns, 2 rows, by using:               <?php $the_query = new WP_Query("showposts=6&cat=1&orderby=rand");?>      For example,

             Random Post 1

             Random Post 2

             Random Post 3

             Random Post 4

             Random Post 5

             Random Post 6

      I'm using WP Bootstrap. Any help would be much appreciated.


title: restore_current_blog() vs. multiple switch_to_blog() followed by removing $GLOBALS['_wp_switched_stack']

text:
Related to this answer, which states > After every instance of `switch_to_blog()` you **need** to call > `restore_current_blog()` otherwise WP will think it is in a "switched" mode > and can potentially return incorrect data. I've done some testing, and can confirm that this is an issue. (It also answers a question I've had at work regarding file upload URLs, so two big thumbs up for that.) In my testing (detailed below) I found that there were two ways to proceed:   1. Always pair `switch_to_blog()` with `restore_current_blog()`   2. Use a chain of `switch_to_blog()`, with the last one switching back to the blog where you started from, and then `unset( $GLOBALS['_wp_switched_stack'] );` at the end. My question: Is method #2 in keeping with WordPress development best practices, or is it an ugly hack? ### My Testing I added the following code to `functions.php` on one of my WordPress Multisite installations:               add_action( 'shutdown', 'pj_stb_test' );     function pj_stb_test() {         if( ! current_user_can( 'update_core' ) )             return;              $home = get_current_blog_id();         $checklist = array(             'constants' => array( 'UPLOADS', 'MULTISITE', 'BLOGUPLOADDIR' ),             'functions' => array( 'ms_is_switched', 'wp_upload_dir' ),         );         $site_ids = array( 1, 2, 3 );              echo( "switch_to_blog() chain:
" );         foreach( $site_ids as $id ) {             switch_to_blog( $id );         }         switch_to_blog( $home );         _pj_dump( $checklist );              echo( 'switch_to_blog() chain followed by                 unset( $GLOBALS[\'_wp_switched_stack\'] )
' );         foreach( $site_ids as $id ) {             switch_to_blog( $id );         }         switch_to_blog( $home );         unset( $GLOBALS['_wp_switched_stack'] );         _pj_dump( $checklist );              echo( 'switch_to_blog() / restore_current_blog() pairings
' );         foreach( $site_ids as $id ) {             switch_to_blog( $id );             restore_current_blog();         }         _pj_dump( $checklist );          function _pj_dump( $checklist ) {         $constants = $checklist['constants'];         $functions = $checklist['functions'];         echo( "
Constants:
" );         echo( "
\n" );         foreach( $constants as $c ) {             echo( $c . ': ' );             var_dump( constant( $c ) );             echo( "\n" );         }         foreach( $functions as $f ) {             echo( $f . ': ' );             var_dump( call_user_func( $f ) );             echo( "\n" );         }     }      The output that was returned on an arbitrary site in my network:               switch_to_blog() chain:     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(true)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(74) "http://example.com/my-site/wp-content/blogs.dir/94/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(66) "http://example.com/my-site/wp-content/blogs.dir/94/files"       ["error"]=>       bool(false)     }           switch_to_blog() chain followed by unset( $GLOBALS['_wp_switched_stack'] )     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(false)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(50) "http://example.com/my-site/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(42) "http://example.com/my-site/files"       ["error"]=>       bool(false)     }           switch_to_blog() / restore_current_blog() pairings     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(false)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(50) "http://example.com/my-site/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(42) "http://example.com/my-site/files"       ["error"]=>       bool(false)     }      Sorry for the verbosity, but I wanted to make sure I had everything in here.


title: Using wp_cron with wp_mail to send bulk email

text:
I am working on a custom plugin to send recurring invoices on the 1st of every month. So far, the plugin is working pretty well. It creates new invoices for each user based on their order and does send 1 email. But it only sends 1 email to the last email address from the query, not to every user. So here is my current function, maybe someone can see something I could do to make this send an individual email to each user with wp_mail. Note** This is in testing phase, so I am using the exact date in the IF statement at the beginning to see the emails and invoices be created...               function mps_send_annual_notification()  {           // START BY CHECKING THE DATE...       // WE ONLY WANT TO RUN THIS ON THE 1ST OF EACH MONTH          date_default_timezone_set('America/Chicago');     $cron_date = date('m-d');          // BEGIN DATE VERIFICATION     if ('11-21' == $cron_date) {          // GET THE USERS AND INFO FOR RECURRING ORDERS       global $post;     $args = array(          'post_type' => 'purchase',         'posts_per_page' => -1,         'meta_query' => array(             array (             'key' => 'purchase_cycle',             'value' => 'Annually Recurring',             'compare' => '='             )         )     );          $myposts = get_posts( $args );     foreach( $myposts as $post ) :  setup_postdata($post);          $client = get_post_meta($post->ID, 'purchase_user', true);     $email = get_post_meta($post->ID, 'purchase_user_email', true);     $service = get_post_meta($post->ID, 'purchase_service', true);     $price = get_post_meta($post->ID, 'purchase_price', true);          $timestamp = date('Ymd');     $today = date('m-d-Y');              // CREATE A TITLE BASED ON USER NAME, THE MEMBERSHIP TYPE, AND THE DATE          // Turn User Name into Initials     $words = explode(' ', $client);     $acronym = '';          foreach ($words as $w) {     $acronym .= $w[0];     }          // Turn Service into Initials     $svc = explode(' ', $service);     $svc_letters = '';     foreach ($svc as $value) {         $svc_letters .= $value[0];     }          $title_date = date('YmdHis');          $invoice_title = $acronym.$title_date.$svc_letters;             // CREATE AN INVOICE             $invoicepost = array(         'post_status' => 'publish',          'post_title' => $invoice_title,         'post_type' => 'invoice',          'post_author' => 1);       remove_action( 'mps_cron_hook_example', 'mps_update_message');     $pid = wp_insert_post( $invoicepost );             // ADD THE INVOICE META     add_post_meta($pid, 'invoice_user', $client, true);      add_post_meta($pid, 'invoice_user_email', $email, true);      add_post_meta($pid, 'invoice_date', $today, true);      add_post_meta($pid, 'invoice_due_date', $today, true);      add_post_meta($pid, 'invoice_timestamp', $timestamp, true);      add_post_meta($pid, 'invoice_total_due', $price, true);     add_post_meta($pid, 'invoice_balance', $price, true);     add_post_meta($pid, 'invoice_description', 'Annual Membership Dues', true);     add_post_meta($pid, 'invoice_type', 'Dues', true);     add_post_meta($pid, 'invoice_name', $service, true);                  // SET MAIL FILTERS     add_filter ("wp_mail_content_type", "cron_invoice_mail_content_type");     function cron_invoice_mail_content_type() {     return "text/html";     }          add_filter ("wp_mail_from", "cron_invoice_mail_from");     function cron_invoice_mail_from() {     return "no-reply@example.com";     }          add_filter ("wp_mail_from_name", "cron_invoice_mail_from_name");     function cron_invoice_mail_from_name() {     return "Website Name Goes Here";     }             // CREATE EMAIL MESSAGE     $email_subject = 'You Have a New Invoice';          ob_start(); ?>
             Hi <?php echo $client; ?>!

             Message to user goes here...

 Invoice Number:  <?php echo $invoice_title; ?>
             Invoice Date:  <?php echo $today; ?>
             Invoice Due Date:  <?php echo $today; ?>
             Account Status:  <?php echo $service; ?>
             Amount Due:  <?php echo $price; ?>

 View your invoice online.
             Sincerely,
             Website Name Goes Here

         This message was automatically generated by the online account    management system.
                           <?php // SEND THE MESSAGE     $message = ob_get_contents();     ob_end_clean();          wp_mail($email, $email_subject, $message);               // end the beginning query        endforeach;          } // END OF DATE VERIFICATION         }


title: Problems Displaying Multiple WP Menus

text: Not sure where my error is (I did piece most of this together from snippets on different websites,) but when I test my theme, only "Left Menu" displays. There are definitely two menus, however where "Menu Right" should be is a duplicate of "Menu Left." Here's my header               <nav id="navigation" role="navigation">        <?php wp_nav_menu( array('menu' => 'Left Menu' )); ?>        <?php wp_nav_menu( array('menu' => 'Right Menu' )); ?>     </nav><!-- /Navigation -->      And here's my functions.php               function register_mp_menus() {     register_nav_menus(     array( 'left-menu' => __( 'Left Menu' ), 'right-menu' => __( 'Right Menu' )));     }          add_action( 'init', 'register_mp_menus' );      Any ideas or help would be greatly appreciated!


title: the_excerpt() does not work with has_excerpt()?

text: I'm trying to shorten the excerpt but it does not work. It shows the full excerpt which I write in the post edit! I've added this to the functions.php               function custom_excerpt_length( $length ) {         return 20;     }     add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );      To show the excerpt I'm using in content.php: `if(has_excerpt()) { the_excerpt(); } else { the_content(); }` The above code display full excerpt, not shortened! Without `has_excerpt()` `if statement` it displays correctly. Where can be the problem? Any ideas what can cause this?


title: Need a conditional to test if title of parent page matches title of child page

text:
In my main loop, I need to incorporate proper html markup into a conditional to test if title of parent page matches title of child page and do (or do not) display certain content. Default might be to keep h1 tag , otherwise do not display.                    <?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
          <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
          <?php     $children = get_pages('child_of='.$post->ID);     if( count( $children ) != 0 ) {           echo 'NO children';          }     else { echo 'has children';}     ?>
<?php the_title(); ?>
          <?php the_content(); ?>     <?php endwhile; endif; ?>       ex) I want h1 to show here... http://howlingwolfmedia.com/site3/my- club/facilities/ but not here: http://howlingwolfmedia.com/site3/my-club/ **solution here as function:**               function testchildren () {         global $post;          $childtest = get_pages('child_of='.$post->ID);             if( count( $childtest ) != 0 ) {             return false;             } else {             return true;            }      }       **and implementation as markup:**                  <?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
<?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
         <?php if ( testchildren() ) : ?>
<?php the_title(); ?>
         <?php endif; ?>         <?php the_content(); ?>         <?php endwhile; endif; ?>


title: How to create a widget on witch a registered user can create a checklist

text: I have no idea where to start. I want to create a widget. with the following features   1. show a button to create a checklist.   2. Show a list of already created checklists created by the user.   3. Mark checklist as done.   4. Send monthly report of the completed checklists. Should I rather go with drupal or is this possible in wordpress?


title: 'Auto Draft' Post showing in wordpress loop

text:
When running a wordpress loop, I am seeing these weird posts called auto draft. I have never seen this before. Does anyone know what they are and how to get rid of them? Any help is appreciated as I am lost on this one. ![enter image description here](http://i.stack.imgur.com/LBoFN.png) THe loop I used is:

                   <?php // WP_Query arguments              $args = array (                 'post_type'       => 'step_to_hs',                 'post_status'     => 'published',                 );                      // The Query              $query = new WP_Query( $args );                      // The Loop              if ( $query->have_posts() ) {                 while ( $query->have_posts() ) {                    $query->the_post(); ?>

                                <a data-toggle="collapse" data-parent="#accordion" href="#<?php the_id(); ?>">                                   <?php the_title(); ?>

                          <div id="<?php the_id(); ?>" class="panel-collapse collapse collapse.in">
                                <?php the_content(); ?>

                    <?php }                 } else {                    echo 'Sorry - there are no steps to display right now';                 }                      // Restore original Post Data                 wp_reset_postdata(); ?>

      I am using the bootstrap collapse javascript to style the loop. I have tried just doing a regular loop without the jQuery and styling, but same thing still shows.


title: Wordpress Query Default Order if Meta Values Same?

text: If the main query args look like this:               'orderby' => 'meta_value_num',     'meta_key' => 'price',     'order' => 'DESC'      What orderby does the query use if the meta_key value is the same for multiple results? So, in the above example, if multiple items have the same price, how does the query order those items? Like a sub-orderby... I thought it would be publish date, but it isn't.


title: Sync comment data

text: I have a site that used Facebook comments for a period of time and then removed them for native WP comments. I was able to write a function that grabbed all the comments and re-inserted them into the WP database (as FB comments do not store in WP). However, Facebook's OpenGraph API does not provide email addresses (which I understand). So what I want to accomplish is the following:   1. Query the comment table for a specific name using the `comment_author`   2. Pull all comments by that name   3. If there is an email address present in one comment array, copy it over to the one that is missing I have accomplished #1 and #2, but I'm at a loss for #3. Any ideas?


title: Custom Fields for Page Edits

text: Currently using the code below for SEO. When the Code Below if added to the header works perfectly but then you have to manually create the fields that are queried. Most Clients hardly get around the WordPress UI let alone create a field. I trying to write a plugin that can make the fields visible on every page edit by default so that the client would just put the value. Thanks               <title>          <?php if ( is_single() || is_page() ) { ?><?php $title = get_post_meta($post->ID, 'Title', true);  if ($title) { ?>     <?php echo $title; ?> | <?php bloginfo('name'); ?>     <?php } else { ?>     <?php wp_title(''); ?> | <?php bloginfo('name'); ?>     <?php } ?>     <?php } ?>          </title>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="description" content="<?php $description = get_post_meta($post->ID, 'Description', true);  if ($description) { ?><?php echo get_post_meta($post->ID, "Description", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="description" content="<?php bloginfo('description'); ?>" />     <?php endif; ?>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="keywords" content="<?php $keywords = get_post_meta($post->ID, 'keywords', true);  if ($keywords) { ?><?php echo get_post_meta($post->ID, "keywords", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="keywords" content="<?php bloginfo('keywords'); ?>" />          <?php endif; ?>      **Plugin structure**               <?php     /*     Plugin Name: WP Site GPS     Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates     Description: Non Complicated Search Engine Optimization plugin     Version: 001     Author: Chibueze Okechukwu     */                    function mySEO() {         include ('wp-site-gps-transport.php');     }               // Add hook for admin      add_action('admin_head', 'mySEO');     // Add hook for front-end      add_action('wp_head', 'mySEO');          ?>      **Plugin Include File**               <title>          <?php if ( is_single() || is_page() ) { ?><?php $title = get_post_meta($post->ID, 'Title', true);  if ($title) { ?>     <?php echo $title; ?> | <?php bloginfo('name'); ?>     <?php } else { ?>     <?php wp_title(''); ?> | <?php bloginfo('name'); ?>     <?php } ?>     <?php } ?>          </title>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="description" content="<?php $description = get_post_meta($post->ID, 'Description', true);  if ($description) { ?><?php echo get_post_meta($post->ID, "Description", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="description" content="<?php bloginfo('description'); ?>" />     <?php endif; ?>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="keywords" content="<?php $keywords = get_post_meta($post->ID, 'keywords', true);  if ($keywords) { ?><?php echo get_post_meta($post->ID, "keywords", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="keywords" content="<?php bloginfo('keywords'); ?>" />          <?php endif; ?>


title: URL field in metabox with page links select

text: I am building my first metabox and I need to add special field when **user can write your own link** (URL) to outside page (with http://) or **select existing page** /post. If user selected that he want to add link to existing page/post, he should see list of all pages, post, custom-post just existing, and if selected one of them in field should appear correct URL (for example "/blog/my-post/"). Can you help me and suggest some idea?


title: Update feed more frequently

text: When i publish new posts, i notice the new posts do not appear in the feed `http://mysite.com/feed` instantaneously, there is always lag time, one or several hours. When i change something in `wp-includes/feed-rss2.php` file (just `echo 'test'`), it also takes one or 2 hour to see the `test` word in `http://mysite.com/feed`, it means wordpress only use that file periodically. Anyone know how to solve this problem? I want whenever the `http://mysite.com/feed` page is open in browser, it must use `wp- includes/feed-rss2.php` file. Thanks!


title: Send email to all registered users

text: I've got a about 60 registered users. How can I send an email out to all of them? Any suggestions on how to achieve this. The users have registered, so I don't think they are going to mind an email send to them, but how could I get that to work? would a plug in do what you said? send an email out to the registered users? or should I install a newsletter plug in and get everyone to sign up to that again/separately? I'm not looking for specific plug in names (although that would be handy) more how it works in theory?


title: Blank screen after moving WordPress to new server with same domain name

text: I need to move my WP install. Domain name is the same. This is what I did:   1. I backed up the DB and "wp-content" folder.   2. I installed fresh WP install on new server   3. I emptied the DB of the fresh install and imported into it the content of the old DB (because prefix rules prevent me to create a DB carrying the same name as old DB)   4. I replaced the "wp-content" folder of new install by the "wp-content" of old install Now I have the new DB (containing old content) with the new "wp-config.php" that comes with it. Yet I get a blank screen. Why?


title: How to add a Custom Meta Box for more than one Post Type?

text: I am using the following code in `functions.php` for adding a custom meta box. The custom post type is `themes`. I want to add more post types, how can I?               add_meta_box(          'my-meta-box-id',          'Demo & Download',          'cd_meta_box_cb',          'themes',          'normal',          'high'      );


title: Rearrange elements outputted by comment_form()

text: I'm currently developing a custom theme from scratch. In the past week, I've been trying to change the order of the HTML elements output by the `comment_form()`. I basically don't know any PHP, and I was unable to find information on the `comment_form()` that successfully covers how to rearrange the layout of its output, including the WordPress Codex. Can anyone please explain how to rearrange the elements outputted by the `comment_form()`, preferably without having to be proficient in PHP and the inner workings of WordPress? Please don't provide solutions that rely on re-positioning elements with CSS; this can't be the way you're intended to customize the output. If it turns out there isn't an optimal way to achieve this, would it then be possible to customize `comments.php` without using the `comment_form()`, like you would before the function was introduced? The following links cover some of the most relevant methods I've tried. They either don't work at all or don't achieve the correct result:   * http://freetexthost.com/wplcq61i3d (Sorry, but I'm not allowed to post more than two links directly in the post.) Thank you.


title: How to map ids of taxonomy with custom post type objects?

text: My wordpress installation contains of $locations (which are actually categorycourses which is a a taxonomy).               foreach($locations as $location) {                               $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );              //Show children for categorycourses                               foreach ( $categorycourses_ids_array as $categorycourse_id ) {                  $category_course = get_term_by( 'id', $categorycourse_id, 'categorycourses' );                                        $loop = get_loop_courses($category_course);                           if($loop->have_posts()) {                      //code etc...      For the moment I do loop like above, but I want to do it faster :-) The issue is the `get_loop_courses(`) that is called for each and every **categorycourse**. This is actual code:               function get_loop_courses($categorycourse) {         $terms_slug = strtolower($categorycourse->slug);         $terms_slug = str_replace(' ','', $terms_slug);              $args = array(             'posts_per_page' => -1, //Show ALL coures (no limit)             'post_type' => 'course',             'tax_query' => array(                 array(                     'taxonomy' => 'categorycourses',                     'field' => 'slug',                     'terms' => $terms_slug                 ),             ),          );           $loop = new WP_Query($args);         return $loop;     }      I understand that the "bottleneck" is that a whole lot of WP_Query's has to be run to achieve this. Number of categorycourses is about 50 and number of custom type courses are about 10 for each coursecategory. I'm trying to do:               foreach($locations as $location) {          //Children of location = categorycourses     $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );          $cc_array = array();     foreach ( $categorycourses_ids_array as $categorycourse_id ) {              $cc_array[] = get_term_by( 'id', $categorycourse_id, 'categorycourses' );        }     $loops = get_loop_courses_array($cc_array);         //code etc...      And the loop courses array look like this:               function get_loop_courses_array(array $categorycourses) {         $slugs_array = array();         foreach($categorycourses as $categorycourse) {             $terms_slug = strtolower($categorycourse->slug);             $terms_slug = str_replace(' ','', $terms_slug);             $slugs_array[] = $terms_slug;         }              $args = array(             'posts_per_page' => -1, //Show ALL coures (no limit)             'post_type' => 'course',             'tax_query' => array(                 array(                     'taxonomy' => 'categorycourses',                     'field' => 'slug',                     'terms' => $slugs_array                 ),             ),          );           $loop = new WP_Query($args);         return $loop;     }      I don't understand how I could get an array of courses mapped to each coursecategory in one single WP_Query-call. I want to achieve something like:               foreach($locations as $location) {                                   $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );         $cc_array = array();     foreach ( $categorycourses_ids_array as $categorycourse_id ) {              $cc_array[] = get_term_by( 'id', $categorycourse_id, 'categorycourses' );        }     $loops = get_loop_courses_array($cc_array);                   //Show children and their courses                              foreach ( $categorycourses_ids_array as $categorycourse_id ) {                  $category_course = get_term_by( 'id', $categorycourse_id, 'categorycourses' );                                        $loop = $loops[$coursecategory_id]; //THIS I WANT TO DO                 if($loop->have_posts()) {                      //code etc...


title: Wordpress before save / update member

text: I have a site that requires to search for lat long information before been saved / updated a member profile, this is searched from google on reverse geolocation through a custom file name location. I am not looking the function on solve that, I ma looking way on hook the function Any suggest on how to solve that?


title: Execute shortcode only in another shortcode

text: I wonder if it's possible to do a shortcode **only in another shortcode**. For example I got following code pieces:               [heading]some pricing page[/heading]     [pricing_box]       [heading]Some title[/heading]     [/pricing_box]      Now I don't want to define one shortcode **heading** which would apply to both the nested one and the first level shortcode. I want the both **heading** shortcodes to produce different outputs. Of course, I could try to solve this by renaming one of the shortcodes to **title** or something, but this doesn't always result in optimal naming arrangements.


title: How do I add a nested conditional within an echo - to use a default image if there isn't one in the post?

text:
I'm trying to add a conditional that will display a default image if the "image" field isn't populated... here's what I'm trying to work with:               $args = array(        'posts_per_page' => 3,        'post_type' => 'post',        'meta_query' => array(            array(              'key' => 'is_featured',               'value' => '1',              'compare' => '!=', // NOT Featured           )        )     );          $second_query = new WP_Query( $args );     if ( $second_query->have_posts() ):        while( $second_query->have_posts() ) : $second_query->the_post();              $attachment_id = get_field('image');        $size = "customfeatins"; // (thumbnail, medium, large, full or custom size)        $image = wp_get_attachment_image_src( $attachment_id, $size );                  echo '

' . get_the_title() .'

' . get_the_date() .'

             ';             endwhile;     endif;     wp_reset_postdata();      I've tried this but it breaks the page:               $args = array(        'posts_per_page' => 3,        'post_type' => 'post',        'meta_query' => array(            array(              'key' => 'is_featured',               'value' => '1',              'compare' => '!=', // NOT Featured           )        )     );          $second_query = new WP_Query( $args );     if ( $second_query->have_posts() ):        while( $second_query->have_posts() ) : $second_query->the_post();             if( get_field('image') ){              $attachment_id = get_field('image');         $size = "customfeatins"; // (thumbnail, medium, large, full or custom size)         $image = wp_get_attachment_image_src( $attachment_id, $size );              } else {              $image = wp_get_attachment_image_src( 'http://placehold.it/136x90' );              }                     endif;                  echo '

' . get_the_title() .'

' . get_the_date() .'

             ';             endwhile;     endif;     wp_reset_postdata();


title: ReWriteRules and WordPress Multi-Sites with Sub Directories

text: I'm having a diffucult time getting the ReWriteRules and URL structures setup for a Wordpress 3.4.2 (latest version as of this post) blog with multi-site enabled. www.ourdomain.com/ is the homepage of an e-commerce site. We also have www.ourdomain.com/example-category/ and www.ourdomain.com/example-product/ As our category and product URL structures. This is all working. I have installed the wordpress files in the physical folder /var/www/ourdomain/wordpress. Right now, www.ourdomain.com/wordpress/ goes to the default blog. www.ourdomain.com/wordpress/blog1 is the first blog and www.ourdomain.com/wordpress/blog2 is the second. I've got to this point by adding               ReWriteRule ^/wordpress - [L,NC]      to our vhost file (.htacess is diasabled). Our intention is for direct requests (from users) for `www.ourdomain.com/wordpress(/*)` to redirect to the home page `www.ourdomain.com/` since the `/wordpress` folder is just to store files, not intended as an actual blog for users to access. Requests for `www.ourdomain.com/blog/` should silently redirect to `www.ourdomain.com/wordpress/blog1`. Requests for `www.ourdomain.com/policies/` should silently redirect to `www.ourdomain.com/wordpress/blog2`. So:               /wordpress/ -> 301 /     /blog/ -> silent /wordpress/blog1     /policies/ -> silent /wordpress/blog2      It seems simple in theory, but not so simple in practice. I started with:               ReWriteRule ^/wordpress - [L,NC]     RewriteRule ^/blog/(.*)$ /wordpress/blog/$1 [L,NC]       RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d      RewriteRule ^/blog/ /wordpress/blog/index.php [L]      Which results in a 404 at /blog/. Of course, because `/wordpress/blog/index.php` isn't a file. There is no `blog` folder inside the `wordpress` folder. The file I want to load is `/wordpress/index.php`, which reads the URL to determine which blog to load- But the URL has been modified, so this fails. I need a way to invoke `/wordpress/index.php` from the URL /blog/, but make `/wordpress/index.php` see the request as if the user went to `/wordpress/blog`. Any way to pass a fake URI to PHP from modRewrite? Or an alternative way to achieve this without installing to separate copies of WordPress? **UPDATE:** Since this doesn't seem to be supported in the current version, but I still need this working before the new version is released, I think a work around would be to use something like:               RewriteRule ^/blog/ /wordpress/index.php?site=blog [L]      And then modify the WordPress file that reads the URL and have it set the site variable based on the GET parameter instead. Would that work? Which file contains the code to set the current site?


title: How to re-post an old post?

text: I am in need of re-posting random posts to the front page of the blog to make them fresh. Is there any hook that could help me achieve it? Thanks.


title: Loop posts without any taxonomy

text: I've grouped my pages by some custom taxonomy. But I need to care about those without any taxonomy set. My code is:               $page_groups = get_terms('page_group'); //get all existing page groups     foreach ($page_groups as $page_group) { //for every of them         $group_name = $page_group->name;    //get group name         $loop = new WP_Query( array( 'post_type' => 'page', 'page_group' => $group_name ) );    //and loop for all pages from that category              while ( $loop->have_posts() ) : $loop->the_post();                  //main stuff here              endwhile;              wp_reset_query();   //reset loop         rewind_posts();     //and rewind posts     } // End foreach $page_groups ?>      It works cool, but after that loop I want to display all the pages that has no 'page_group' taxonomy - only those. I've tried to query without taxonomy but it loops all the pages.


title: Where is the information about the authors for articles stored?

text: I have recently been appointed to maintain a Wordpress powered news site. I don't have much experience with wordpress and have been teaching myself as I go. The site I am maintaining was recently migrated to a new wordpress site. While the old site used the standard mechanism for storing authors, the new site uses the Co-author's Plus Plugin. After the migration, all of the articles are shown as written by "admin." I'm sure the information about the authors is stored somewhere in the database, just the website does not know to look for that information. Can someone tell me where I can find this information so I can then proceed to add it through the Co-Authors plus plugin?


title: How to put a block of code between [shortcode][/shortcode] in do_shortcode()?

text:
So I want to put a loop of post behind a 'like lock' thats created by a plugin that uses the shortcode [to_like ID="XX"]content[/to_like]. But instead of the plugin blocking the content, i just get a page with all the permalinks to the post on it. So I guess what Im asking is how do I put the page contents (ie, the loop in the template that displays the post) inside the shortcode so its hidden by the plugin? This is what Ive got right now:               foreach ( $posts as $post ) :       setup_postdata( $post );          $content  = '

';         $content .= ''.the_title().'';         $content .= '';         $content .= '
';                      $schemaStreet = get_post_meta( $post->ID, 'schemaStreet', $single );                 $schemaCity = get_post_meta( $post->ID, 'schemaCity', $single );                  $schemaState = get_post_meta( $post->ID, 'schemaState', $single );              $content .= ''.$schemaStreet[0].'';         $content .= '
'.$schemaCity[0].', '.$schemaState[0].'';              $content .= '
';         $content .= '
';         $content .= '
';              do_shortcode('[to_like id="1208"]'.$content.'[/to_like]');          endforeach;      wp_reset_postdata();


title: How do I get my podcast feed created?

text: I have a wordpress site. I added a plugin to create podcasts. It is the Blubrry PowerPress plugin. Then I uploaded an mp3 to my site. Then I used to plugin to display the podcast. Here is an example page where the podcast is, at the very bottom. But when I go to this url to find my feed: http://glowingstart.com/feeds/podcast/ I get a 404-error. Would anyone know why that happens? And how do I determine whether my feed url has been created and the feed updated? Thanks!


title: Moving Domain.wordpress.com to a new domain

text: I have created my website at the following address. http://musivision.wordpress.com/ I would like to move my website to the following domain: http://musivision.ca I found a link on domain mapping 'http://en.support.wordpress.com/domain- mapping/map-existing-domain/ however, it seems to be forcing me to use WordPress hosting which I don't want to do. I want to stay with my current hosting company. In short I would like to: 1) Keep the website that I created   2) Remove the Wordpress from my domain and transfer to 'http://musivision.ca' 3) Keep the same hosting that I use.


title: How to Hard Set the Parent Page in Template

text:
This template displays child pages of the parent page that calls it. I need to modify it to hard code the parent page to a specific parent, using the slug or other means. Once I know how to do that I think I can then have the template display (in separate divs) the child pages from two different parents. Can anyone get me started on how to hard-set the parent page? thanks               <?php     /*     Template Name: Portfolio Section     */          get_header();          global $post;     ?>
<?php echo $post->post_title; ?>

     <?php     $items = get_pages( array('sort_order' => 'ASC', 'sort_column' => 'menu_order', 'child_of' => $post->ID ) );     foreach( $items as $item ) : ?>
         <a href="<?php echo get_permalink($item->ID); ?>">         <?php          $photosToShow = rand(1,3);         $images = get_posts( array( 'numberposts' => $photosToShow, 'post_parent' => $item->ID, 'post_mime_type' => 'image', 'post_type' => 'attachment' ) );         foreach( $images as $image ) {             echo wp_get_attachment_image( $image->ID, 'Portfolio-Thumb' );         }         ?>                  <a href="<?php echo $item->guid; ?>">
<?php echo $item->post_title; ?>
         <a href="<?php echo $item->guid; ?>">
<?php $fields = get_fields($item-    >ID); echo $fields['location']; ?>

     <?php endforeach; ?>
                    <?php get_footer(); ?>


title: Integrating WordPress Content into a jQuery Slider

text:
I have a pretty basic 'featured-list - image slider' implemented above my content in my custom WordPress theme. How do I integrate WordPress content into the slider so that the slide content is pulled via 'Recent-Posts' or via a 'Category'? Also, how can I set the 'Featured Imgs' to display as the photo within the slider and to display in my alotted thumbnail sections in list area? Here's a screenshot of the jQuery I plugin I picked this up on; ![enter image description here](http://i.stack.imgur.com/cenJR.jpg)   _(Their demo is broke, so.)_ **Below is the markup I have implemented.**

David King – on his True Crime thriller

Tips from Steve Perry

Tips from Chuck Berry

SFIRS

David King – on his True Crime thriller

David King is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Tips from Steve Perry

Steve Perry is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Tips from Chuck Berry

Chuck Berry is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Create a Vintage Photograph in Photoshop

Quisque sed orci ut lacus viverra interdum ornare sed est. Donec porta, erat eu pretium luctus, leo augue sodales....read more


title: Displaying Custom Post Types In "At A Glance" Meta Box

text: I found the following snippet will displays the number of Custom Post Types published in Dashboard's At A Glance widget, like this: ![At A Glance](http://i.stack.imgur.com/K0ujY.png) Is there a way to turn that "81 Wrestlers" text to a link to the post types list. Here's the code:               add_filter( 'dashboard_glance_items', 'custom_glance_items', 10, 1 );     function custom_glance_items( $items = array() ) {         $post_types = array( 'wrestler' );         foreach( $post_types as $type ) {             if( ! post_type_exists( $type ) ) continue;             $num_posts = wp_count_posts( $type );             if( $num_posts ) {                 $published = intval( $num_posts->publish );                 $post_type = get_post_type_object( $type );                 $text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'your_textdomain' );                 $text = sprintf( $text, number_format_i18n( $published ) );                 if ( current_user_can( $post_type->cap->edit_posts ) ) {                     $items[] = sprintf( '%2$s', $type, $text ) . "\n";                 } else {                     $items[] = sprintf( '%2$s', $type, $text ) . "\n";                 }             }         }         return $items;     }


title: Create new database through static page code

text:
I want to create a new table in current database of word press through create a static page. I write code for this as below, but there was no result. Why is that, and how can I get this right?               <?php     /*     Template Name:Register Page     Template URI:     Author:yuva     Author URI:     Description:This Is Page for Gallery.     */          get_header();     ?>

<?php  the_title(); ?>
          <?php     global $wpdb;     $my_table=$wpdb->prefix.'your_users';          $sql="CREATE TABLE IF NOT EXISTS $my_table (id int(20) not null auto_increment,name varchar(40) not null,password varchar(20) notnull,PRIMARY KEY(id))";          include_once(ABSPATH.'wp-admin/includes/upgrade.php');          dbDelta($sql);          ?>
     <?php     get_footer();     ?>


title: Wordpress Installation

text: First of all, I am not a techie so be nice to me please. I am trying to install Wordpress. I have followed the installation instructions for Wordpress as best as I could. However when I try to open localhost on Wampserver, I get a message: > The website cannot display The one thing that I believe may be wrong is in the wp-config.php file, I am not sure what to put in "MySQL database username". I put "`root`" as in the example. Any ideas?


title: Two scrollbars in popup window

text: I've got an issue with the popup windows that display when I click on the book cover images(from a widget) in my sidebar: there are two vertical scrollbars instead of one. Any idea why this is happening and how I may get rid of one of the scrollbars? Here's a screenshot: ![Two scrollbars](http://i.stack.imgur.com/00RKC.png) Here's my site: WordPress Blog


title: Creating a thumbnail from an image already on the server?

text: I'm trying to generate thumbnails on my server that are being uploaded by a plugin. It uploads all images to a directory. I'm trying to target these files and then create a thumbnail with them based on img_resize, but I am not having any lucky. Eventually I'll be inserting the thumbs into the media gallery and into user meta, but I can't even produce a thumbnail yet, so that is the first task at hand! Here's my simple code thus far:               require_once(ABSPATH . '/wp-admin/includes/media.php');     require_once(ABSPATH . '/wp-admin/includes/image.php');          $file = 'http://www.mysite.org/uploads/uploaddir/2012/02/bill.jpeg';          $max_w = 200;     $max_h = 200;     $crop = true;          $filePathInfo = pathinfo($file);     $fileName = $filePathInfo['basename'];          $wpUploadPath = wp_upload_dir();     $destpath = $wpUploadPath['basedir'].'/'.$fileName;          image_resize( $file, $max_w, $max_h, $crop );      I tried using the `$destpath` as well and nothing is happening. No thumbnails are being generated. Am I thinking about this incorrectly? Any light anyone could shed upon this situation would be greatly appreciated. Thanks! Tre SOLVED NOTE: This is the code that finally worked for me. I was using the URI before, to define the image_resize. Not the absolute directory.               $wpUploadDir = wp_upload_dir();     $baseDir = $wpUploadDir['basedir'];     $fileName = 'bill.jpg';     $filePath = $baseDir . "/" . $fileName;     $wp_filetype = wp_check_filetype($filePath, null);     $attachment = array(     'post_mime_type' => $wp_filetype['type'],     'post_title' => $fileName,     'post_content' => '',     'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $filePath );          require_once(ABSPATH . 'wp-admin/includes/image.php');     require_once(ABSPATH . 'wp-admin/includes/media.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $filePath );     wp_update_attachment_metadata( $attach_id, $attach_data );          image_resize($filePath, 200, 200, true, '200x200');


title: Mapping external subdomain to Multisite site

text: Everything is running under the same shared server. So there's only one IP to refer to. I have WordPress Multisite running at example.com and one of the sites on it is mug2p.example.com. I have a regular WordPress installation/site running at example2.com, but nothing on m.example2.com. I want m.example2.com to mirror/map mug2p.example.com. And I want m.example2.com to display in the browser's address bar. How can I do this? I added a CNAME record under example2.com pointing m.example2.com to mug2p.example.com but no luck. Every time I type m.example2.com in a browser it takes me to example2.com. EDIT: I installed the MU Domain Mapping Plugin and have it properly set up as well.


title: where to include a php file

text: I have a php file with some variables which I would like to use. When I include it in the header.php the variables in that file are not recognized at footer.php and some other places. Where is the best place to include this file so its content will be shared all over the wp files.


title: Gravity form to submit to third party application

text: I would like to know what the cleanest way to use gravity forms to submit data from my form to another page outside of WordPress is.   Our website is 100% WordPress and I need to use data of my gravity form somewhere else. I found this blog article, that seems to provide a solution, but I really would like to avoid modifying   `/wp-content/themes/*your-theme*/functions.php` I am worried about losing the changes at a WordPress / gravity forms update.


title: wp_editor not modify html tags of initial content

text: How can i set the tinyMCE editor in wp_editor to not modify/replace the html tags of the initial content ? I'm loading html content with tags (i know that they are deprecated but i need them) and the tinyMCE editor is replacing them. I tried several things but with no success. I'm getting a little frustrated. I need help. What i need is that the editor do not change the loaded html content. Sorry for my bad english! It's not my native language. Thanks in advance !


title: How can I pass a variable to a page with a SEF url?

text: I'm making a website for a small church. They would like to upload sermons to their site. I've looked for a WP plugin to do that, but none of them did exactly what they wanted. So, I'm making a plugin to do what they want. I've made a page called 'sermons' that has a page template 'sermon archive'. That file will display the sermon archive. I'd like to have it so when they click on a sermon, it would go to `sermon/my-sermon-name` (rather than `sermon?name=my-sermon-name`). Is there a way to do that in WordPress? Thanks!


title: Wordpress Posts Out Of Order after 3.1 Update

text: The first posts I wrote are now showing on the homepage. After Googling, the problem is because I am using query_posts to exclude a certain category on the main loop.               <?php query_posts($query_string . '&cat=-4'); ?>      * * * how can I still exclude this category, but not have my posts reversed?


title: Show tags of currently popular (by views) posts

text: I'm after a sidebar widget that will show the tags of my site's currently (within the last day) most viewed posts, in order to achieve a rudimentary 'trending topics' widget. Does this require a plugin (and if so which one), or can it be achieved with some nifty code?


title: RSS feed validity and Google Adsense

text: I want to use Google Adsense code snippets in my blog posts, so in my single.php. However, when I do so, then my RSS feed becomes invalid because of the javascript code in the content and the feed won't be updated anymore. Is there ANY way to fix this? I still have the Google Adsense code in the sidebar where it's not causing any issues. I've seen lots of blogs that have Google ads in their blog posts and a functioning RSS feed, so it seems to be possible, but how? Or rather, why is it causing problems in my case? I've done a looooooooot of research, but couldn't find ANY information about this issue. I think that means that it's not a very common problem. I really hope somebody can help me with this BIG problem. Would something like this work? http://chaosinacan.com/programming/adsense- without-blocking/ For reference, here's my website: http://zoomingjapan.com/ Here's my feed: http://zoomingjapan.com/feed/ Thanks a lot in advance!


title: Thumbnail and Featured Image With Fixed Sizes?

text: In my index.php file, I'm trying to create a thumbnail for each post with the size width: 200px and height 142px. And on the single.php, I would ike for the featured image to be width: 598px and height: 300px; for the index.php i tried `<?php the_post_thumbnail( array (200,150) );?>` but I cant get it to work. Is this something timthumb would be used for? or would it not be needed?


title: How can I manage and limit disk usage for each author?

text: I want display and limit disk usage for each author and be able to manage disk usage as an administrator. Example: author1: disk space is 20Mb; if they uploaded more 20Mb the upload button (in media library and post) is disabled. author2: disk space is 30Mb, if they upload more 30Mb the upload button (in media library and post) is disabled.


title: Discount Code in Easy Digital Download

text: I doing the custom extension for easy digital download. Following is the little confuse for me. **For Example** Here is the discount code of price `$100` and the product price is `$50` if i use the discount code of checkout page it update and saying the free download option. But my question is to update the coupon code again to say another `$50` if i use the coupon code again for some `max uses` is `1` I want to know how to know how to update the discount code if it is use in any product.(Only if the product price is lesser than discount code). Because my custom extension is doing to create the coupon code for one person itself. I am not sure is there is a way to find which coupon code is for which product. if the coupon code value is higher than the purchasing product then update the coupon code to the edd which the remaining value.               Product Price: $40     Discount Price: $100     Checkout Did with      Product price of $0       But In this case `Update Discount Code as with Remaining $60`. Is it possible to do that in easy digital download. Thanks, vicky


title: First argument is expected to be a valid callback for cp_admin_init and _canonical_charset

text: I'm using **WordPress 3.5** with child-theme of **Twenty Eleven 1.5**. Suddenly I'm getting following Warning,               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173      I'm using following plugins:   * download-manager 2.3.9   * wordpress-seo 1.4.7   * wp-pagenavi 2.83 Some more points: 1) If I'm giving _mysite.com_ it's giving above 2 line warning. If I give _www.mysite.com_ , the following line also include,               Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-includes/pluggable.php on line 876      2) If I give _mysite.com/wp-admin/_ or _www.mysite.com/wp-admin/_ , It's giving 1st warning and 3rd warning. 3) If I goto _www.mysite.com/wp-login.php_ , It's giving following 5 warning.               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173          Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 368          Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 380          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'wp_authenticate_spam_check' was given in /home/templ/public_html/wp-includes/plugin.php on line 173      4) If I give correct username and password, it's not going to login. giving following problem,               ERROR: Invalid username or incorrect password.     ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.      I'm trying to find solution. I can't. Can any-one help me?


title: something strange is happening to my code

text:
This is my index.php (my homepage). It displays two loops. The first one displays the sticky posts and the second displays all of the posts. The `<div id="primary">` that is located after the first loop is not appearing in my code or functions in my css. This is my code:                   <?php get_header(); ?>

                <?php           $sticky = new WP_Query( array(             'showposts' => 6,             'post__in'  => get_option('sticky_posts'),             'caller_get_posts' => 1 )            );         while ( $sticky->have_posts() ) : $sticky->the_post(); ?>
             <a href="<?php the_permalink(); ?>">               <?php the_post_thumbnail( 'featuredposts' ); ?>
                 <?php echo get_the_title(); ?>

         <?php endwhile; ?>

       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php $countpost = $n++ ; ?>          <?php             if ($countpost % 2 == 0) { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                Its even
          <?php } else { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
           Its odd

          <?php } ?>                           <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                      <?php endif; ?>
          <?php get_footer(); ?>      Do anyone know a solution to this problem? Thanks in advance


title: how specify a directory to file when downloading it

text: I use this code to download a file from remote server to mine and the file is created and saved but in the home directory and i want it in the plugin directory               $url ='*.dat';     // Use wp_remote_get to fetch the data     $response = wp_remote_get($url);          // Save the body part to a variable     $fileContent = $response['body'];               // Create the name of the file and the declare the directory and path          $file ='*.dat';          // Now use the standard PHP file functions     $fp = fopen($file, "w");     fwrite($fp, $fileContent);     fclose($fp);


title: How to add meta boxes to the 'Add new post' screen?

text: I want the user to fill in a form (when they create a new blog post). The results of the form should be embedded within the new blog post. So I am trying to think of the best way of coding this. Meta boxes might be the best way?       **Edit, the original question changed a little. The old one was:** How can I add a Dashboard Widget into a custom Plugin Options Page? I have followed the example here http://codex.wordpress.org/Dashboard_Widgets_API to create a custom Dashboard Widget, but cannot see how to add it into my custom plugin options page (which is found under the 'Settings' sidebar in the Control Panel).


title: Can 'numberposts' be passed in the URL query string?

text: I'm running into circles trying to set up a simple rewrite rule, and thought I'd run the question by some of the rewrite experts here. I have a custom post type, "mealplan", and I'm trying to implement a basic url rewrite where visitng `site.com/mealplan/current` will take the visitor to the most recent post of type "mealplan". I've tried using several variants on this rule:               global $wp_rewrite;     $wp_rewrite->add_rule('mealplan/current',        'index.php?post_type=mealplan&numberposts=1&orderby=date&order=DESC',        'top' );       ... but I can't seem to get either the 'numberposts' or the 'posts_per_page' parameters to do anything in the query string like that. It just goes straight to the archive page with the default number of posts per page. This does what I want:               global $wp_rewrite;     $current_mealplan = get_posts( array(       'post_type'=>'mealplan',       'numberposts'=>1,       'orderby'=>'date',       'order'=>'DESC' ) );     $wp_rewrite->add_rule('mealplan/current',        'index.php?post_type=mealplan&post_id='.$current_mealplan[0]->ID,        'top');      ...but at the cost of an additional query and a potential flush rules on every page load. Even if I optimize this by saving the current post ID in an option that's updated on `update_post` (so rules only have to be flushed when they change), this feels like unnecessary work that could be avoided if I could only get the url parameters above to work correctly.


title: Best Way to Merge a Dev and Live Site to Become a Staging Site?

text: I have two Wordpress installs, both with a little bit of different data. I have a LIVE site and I have a DEV Site. I need to merge the content of these two databases together to make a STAGING Site. I need to merge the new Posts/Pages/Comments/Categories from DEV to a LIVE database backup, and then make that database become STAGING. What is best, easiest, and least time consuming way of tackling this? NOTE: XML Importer will not work for this task as the amount of data is too large.


title: Subscribe to this Blog for a Private P2 Themed Site?

text: What's the easiest way to get a **subscribe to this blog** for a private P2-Themed Site? I want to have an obvious link on the page without having to modify the theme so that everyone using the site can easily see the link. Ideally I'd also be able to see who is subscribed and if possible subscribe them myself _(it's the team members for the project I want to make sure are subscribed.)_ Suggestion for the best plugin for this?


title: How to install "Wordpress for ios" on Apple's SDK's iPhone/iPad simulator?

text: How to install Wordpress for ios on Apple's SDK's iPhone/iPad simulator? and what are other ways to make Wordpress Admin compatible with iphone?


title: Our plugin tags not appearing in WordPress Plugin Repository

text: We have an appointment calendar plugin at WordPress Plugin Repository. In our plugin **`readme.txt`** , we have already added tags like:               === Appointment Calendar ===     Contributors: a.ankit, FARAZFRANK, harimaliya      Link: http://appointzilla.com/     Tags: appointment, booking, calendar, appointment scheduling calendar, appointment calendar     Requires at least: 3.3+     Tested up to: 3.4.2     Stable tag: 2.4      **Readme Snap:** ![enter image description here](http://i.stack.imgur.com/5UvuJ.jpg) you can check our plugin **`readme.txt`** file at WordPress Plugin Repository: **here** But these tags are not appearing after plugin description at WordPress Plugin Repository. If anybody have any knowledge about this issue then help me. Thanks...


title: Performance concerns: index.php vs taxonomy-$taxonomy.php

text: On one of our latest projects I'm planning to use the index.php file to display different taxonomy layouts. Basically I'm planning to use `is_tax( 'sometaxonomy' )` to display the data/loop for different taxonomies. Are there any performance concerns I should address? Is it better to use taxonomy-$taxonomy.php in this case? if so, why? Also, as a somewhat related issue: when using this technique I will need to customize the loop. Is it safe (performance-wise) to use `global $query_string` to alter the query? Or should I, again, simply use taxonomy-$taxonomy.php? Thanks in advance


title: How can i simulate "taxonomy__in" in query?

text: How can I have to set tax_query to get results like 'category__in' => array()? Specifically, I would like to show all the posts that have a term from the city taxonomy with one of these id's: `$cities = array(23,34,45,56);` This is the code I currently use.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'meta_query' => array(         array(                 'key' => 'mar_bedrooms',                 'value' => $bedroomss,                 'compare' => 'IN'             ),         array(                 'key' => 'mar_property_for',                 'value' => $property_forss,                 'compare' => 'IN'             ),         array(             'key' => 'mar_price',             'value' => array( $price_min, $price_max ),             'type' => 'numeric',             'compare' => 'BETWEEN'             )         ),         'post_status'=>'publish',         'post_type'=>'post',         //'cat' => 1,         'category__in'=> $type,         //'taxonomy__in'=> $city,         'orderby'=>'date',         'order'=>'DESC'     );     query_posts($args);          if ( have_posts() ) {         the_post();         $a = 1;     }


title: ReWrite Permalink to New Permalink Nginx

text: I used to have `/%postname%/` permalink but something odd happened today, all links that I click suddenly redirect to home. So I changed the Permalink to `/%category%/%postname%/` but this is a big conflict in SEO... Here is my question : Is it possible to rewrite `/%postname%/` into `/%category%/%postname%/` What do you think? * * * Well , don't know what has happened , but /%postname%/ redirects to home... so I needed to change the permalink.... Somebody know how to change correct this? * * * Now I just notices this: my website is on /sites/%postname%/ So what is happening here is that every click on every post or page is redirecting me to home.. rewrite rule in NGNIX maybe the problem


title: Why won't my taxonomy query show up?

text:
I'm attempting to display **posts** from a **'Uncategorized'** category under a custom taxonomy called **'Reviews'** but without much luck. I'm using `get_template_part('loop','review')` to call `loop-review.php` which contains my taxonomy loop but for some reason, nothing will show up. What gives? Here are the contents of `loop-review.php`...

reviews
         <?php               $args = array(             'post_type' => 'post',             'tax_query' => array(                 array(                     'taxonomy'  => 'review',                     'field'     => 'slug',                     'terms'     => 'uncategorized'                 )             )         ); $review_query = new WP_Query($args); ?>         <?php if ($review_query->have_posts()): ?>                 <?php while ($review_query->have_posts()): $review_query->the_post(); ?>
                                 <?php the_content(); ?>                                 <?php the_title(); ?>
                 <?php endwhile; ?>                                          <?php wp_reset_postdata(); ?>         <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
         <?php endif; ?>
      I call `get_template_part('loop','review')` inside my my `category.php`...               <?php           get_header();           if (is_category('portfolio')):          get_template_part('single','portfolio');          get_template_part('loop','review');     else:          get_template_part("single","blog");     endif;           get_footer();           ?>      Lastly, here is the code from my `functions.php`...               add_action('init', 'build_taxonomies', 0);     function build_taxonomies(){             register_taxonomy('review', 'post', array(                 'hierarchical'    => 'true',                 'label'           => 'Reviews',                 'query_var'       => 'true',                 'rewrite'         => 'true'             )         );     }


title: One page loop issue with posts

text: I have been working on this loop for a very long time. I think so far this is my best version as it will get page templates. My problem is that it does not get posts and I am not sure why. When I try to get the posts it will display the homepage template about 11 times.                $page_query = new WP_Query(array(         'post_status' => 'publish',         'post_type' => array( 'post', 'page' ),         'order' => 'ASC',         'orderby' => 'menu_order',         'posts_per_page' => '-1',         'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1     ));          if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post();           //checking if there is a page template assigned to the page     $template = get_post_meta( $post->ID, '_wp_page_template', TRUE );           //if there is a template and it's not the default or homepage template      if( $template && $template != 'template-home.php' && $template != 'default') {           //here we remove ".php"     $template = str_replace('.php','',basename(get_page_template()));              //including the template the correct way     get_template_part('template', $template);      }      endwhile;      endif;       Any attempt to include posts which should be a part of the `$page_query` array fail. I get bad results. I have tried including `category.php`, `get_template_part('content', get_post_format())`. It just gives me messed up stuff. Any ideas?


title: Saving an array to get_options

text:
1. I'm trying to save an array to get_options in wordpress, I'm aware that I don't have to serialize the array due to get_options doing that.   2. At the moment I don't get any success of failed message upon hitting the submit button.    3. Am I adding the input data correctly to the database using get_options and update_options. If not how can my code be tweaked to accomplish this. add_action('admin_menu', 'dw_quotes_create_menu');              function dw_quotes_create_menu() {         //create custom top-level menu         add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', 'dw_quotes', 'dw_styling_quotes_settings');     }              //generating the random quote     function dw_get_random_quote() {               }          function validate_dw_quote() {         //validation here         if (isset($_POST['submit'] ) ) {                  //checking that $_POST['adding_quote'] is set             if( isset( $_POST['adding_quote'] ) ) {                      //retrieve the stored values                 if( get_option( 'list_of_quotes' ) )                     $list_of_quotes = get_option('list_of_quotes');                 else                      $list_of_quotes = array();                      //add the new quote to the end of the array                  $list_of_quotes[] = $_POST['adding_quote'];                      //store the updated quote                 if ( update_option( 'list_of_quotes', $list_of_quotes ) ) {                     echo "Success your quote was added!";                 } else {                     echo "Failed to add quote!";                 }             }         }     }              //styling the admin menu     function dw_styling_quotes_settings() { ?>
Quote Setting
              <form action="admin.php?page=dw_quotes" method="post">         Enter your quote         <input type="textarea"  name="adding_quote" />         <input type="submit" name="submit" value="add the new quote" />              <?php //test the output          var_dump($list_of_quotes);         ?>