title: Delete Child Posts

text: I'm trying to delete all child posts when the parent is deleted. The parent post deletes just fine, but the child posts are not properly deleting. Here's the code I have in place now:               $args = array(              'post_parent' => $parentid,             'post_type' => 'custom-type'         );              $posts = get_posts( $args );              if ($posts) {                  // Delete all the Children of the Parent Page             foreach($posts as $post){                      wp_delete_post($post->ID, true);                  }              }              // Delete the Parent Page         wp_delete_post($parentid, true);      What it should do is loop through and get the posts that are the child of `$parentid` and delete them, then delete the parent post. Currently, it just deletes the parent post, but leaves all the children behind. I'm looking at my database and the child pages are definitely created correctly with the correct `post_parent` id. Is there a way to get all child posts and delete them? Thanks, Jason


title: Admin can enter JavaScript - potential security risk?

text: WP 3.5/TwentyTwelve/Clean install. I try this when login as admin and editor. I try add reply for first post "Hello World":               <script>alert('XSS')</script><script><</script>      and get popup window ![enter image description here](http://i.stack.imgur.com/Q2y8t.png). Is it porential security risk or can no care? Thanks for advance..


title: How to change the title of a Meta Box on a specified Custom Post Type?

text: > **Possible Duplicate:**   >  Change The Title Of a Meta Box Is it possible to change the title of a Meta Box on a specific Custom Post Type add or edit page? For example, if I'm viewing the post type add or edit page for the Custom Post Type: `my_custom_post_type_name`, can I re-label the Meta Box "Publish" to something more like "My CPT Actions"?


title: Show Welcome Panel on Dashboard for every user

text: I have customised the welcome panel on the dashboard for users with information in. I then hid the "Dismiss" button and added CSS to make the welcome panel always visible. Using the 'welcome_panel' hook. This works fine for Admins but the Welcome Panel is not displayed for other users such as editors and authors. Its not that the admin panel is being hidden its not included in the source code. I need to find a way to include the welcome panel code for every user not just admins. Just found the following in `wp-admin/index.php`. So it will only show if user can edit_theme_options.               <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :      Is there a way to edit this or call the do_action( 'welcome_panel' ); even if the user cannot edit_theme_options?


title: Removing the [...] from the excerpt returned by get_the_excerpt() only in some places

text: I wish to use the excerpt of a post in the meta description for better SEO, so I am using the get_the_excerpt() function to get the post's excerpt. However, I noticed that at the end it is adding [...] when the post's content is not separated by the More separator, and when it is longer than the configured maximum length. Is there a clean way to remove this [...] in the end of the excerpt? The function doesn't seem to have a boolean parameter to specify whether you want it, or anything of that sort. ** UPDATE ** I do not want to remove the [...] from the main index.php. I just want to remove it in certain instances (in the meta description), and leave it in others. So the hook solution does not work in this case. Thanks.


title: how to get category name if my category got custom slug

text: so my category got slug 'aeroplanes' and I need to get category names from it, but I can't get it with               $category = get_the_category($post->ID);      echo $category[0]->cat_name;      cause it takes all posts from default category with category slug 'category'. How can I do that if I got category slug 'aerpolanes'?


title: Admin - Load existing admin template as a submenu page

text: I'm trying to save my client a few clicks. I've created a custom role of "Customer" and I'd like to get them to that screen, without having to have them click "Users" and then select the "Customer" role. So, I have a custom menu called "Orders". I'd like to add a submenu called "Customers" and "load" this page: users.php?role=custom I'm guessing I have to use the callback function on add_submenu_page and then load that template? What's the right way to go about this?


Show category name and new articles and display page numbers. What function to use. Ex. cat name 1   * -listcat1 1 update   * -listcat1 2 update   * -listcat1 3 update   * -listcat1 4 update cat name 2   * -listcat2 1 update   * -listcat2 2 update   * -listcat2 3 update   * -listcat2 4 update pagination 1,2 paged=2 cat name 3   * -listcat3 1 update   * -listcat3 2 update   * -listcat3 3 update   * -listcat3 4 update and paged=x cat name x   * -listcatx 1 update   * -listcatx 2 update   * -listcatx 3 update   * -listcatx 4 update thank


title: multiple files in wordpress plugin

text: i'm trying to write a plugin with multi files, i'm sure i did it before without a problem but now i have the problem in the subject. in the main plugin file i included a file name - ydp-includes.php, inside of ydp-includes.php i included all the files i wanted like this:               <?php     include(dirname( __FILE__ ) .'/1.php');     include(dirname( __FILE__ ) .'/2.php');     include(dirname( __FILE__ ) .'/3.php');     include(dirname( __FILE__ ) .'/4.php');     ?>      but i'm getting: **Fatal error: Call to undefined function add_action().** The files are includes but for a reason i can't see at the moment wordpress doesn't see them as one plugin package and each wordpress function inside ignored. is there another best practice way to develop multiple files wordpress plugin ? what i'm doing wrong ? thanks


title: Custom Post Types and 404 Pages

text: I have tried refreshing my permalinks but I still cant get this to work correctly. I have the categories `movies`, `gaming`, `blu-ray`, and `tv` already created, so my URLs are `site.com/movies/` for example. I would like for a post for movies to be at `site.com/movies/post-here/` so for my custom post type my slug is `movies. All my normal wordpress psots under the category `movies` are now 404ing while posts created specifically from the post type `Movie Posts` is working fine. Is this normal? Is there a step I'm not including? Here are all my custom post types (Created with Custom Post Type UI):               //Movies Custom Post Type     register_post_type('movies_cp', array(  'label' => 'Movie Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'movies'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Movie Posts',       'singular_name' => 'Movie Post',       'menu_name' => 'Movie Posts',       'add_new' => 'Add Movie Post',       'add_new_item' => 'Add New Movie Post',       'edit' => 'Edit',       'edit_item' => 'Edit Movie Post',       'new_item' => 'New Movie Post',       'view' => 'View Movie Post',       'view_item' => 'View Movie Post',       'search_items' => 'Search Movie Posts',       'not_found' => 'No Movie Posts Found',       'not_found_in_trash' => 'No Movie Posts Found in Trash',       'parent' => 'Parent Movie Post',     ),) );               //Gaming Custom Post Type     register_post_type('gaming_cp', array(  'label' => 'Gaming Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'gaming'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Gaming Posts',       'singular_name' => 'Gaming Post',       'menu_name' => 'Gaming Posts',       'add_new' => 'Add Gaming Post',       'add_new_item' => 'Add New Gaming Post',       'edit' => 'Edit',       'edit_item' => 'Edit Gaming Post',       'new_item' => 'New Gaming Post',       'view' => 'View Gaming Post',       'view_item' => 'View Gaming Post',       'search_items' => 'Search Gaming Posts',       'not_found' => 'No Gaming Posts Found',       'not_found_in_trash' => 'No Gaming Posts Found in Trash',       'parent' => 'Parent Gaming Post',     ),) );               //Blu-ray Custom Post Type     register_post_type('blu-ray_cp', array( 'label' => 'Blu-Ray Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'blu-ray'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Blu-Ray Posts',       'singular_name' => 'Blu-Ray Post',       'menu_name' => 'Blu-Ray Posts',       'add_new' => 'Add Blu-Ray Post',       'add_new_item' => 'Add New Blu-Ray Post',       'edit' => 'Edit',       'edit_item' => 'Edit Blu-Ray Post',       'new_item' => 'New Blu-Ray Post',       'view' => 'View Blu-Ray Post',       'view_item' => 'View Blu-Ray Post',       'search_items' => 'Search Blu-Ray Posts',       'not_found' => 'No Blu-Ray Posts Found',       'not_found_in_trash' => 'No Blu-Ray Posts Found in Trash',       'parent' => 'Parent Blu-Ray Post',     ),) );               //TV Custom Post Type     register_post_type('tv_cp', array(  'label' => 'TV Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'tv'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'TV Posts',       'singular_name' => 'TV Post',       'menu_name' => 'TV Posts',       'add_new' => 'Add TV Post',       'add_new_item' => 'Add New TV Post',       'edit' => 'Edit',       'edit_item' => 'Edit TV Post',       'new_item' => 'New TV Post',       'view' => 'View TV Post',       'view_item' => 'View TV Post',       'search_items' => 'Search TV Posts',       'not_found' => 'No TV Posts Found',       'not_found_in_trash' => 'No TV Posts Found in Trash',       'parent' => 'Parent TV Post',     ),) );


title: How to turn this customized core function into a filter/action in functions.php?

text: So in template.php the original function looks like this:                   function meta_form() {             global $wpdb;             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta                 GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );             if ( $keys )                 natcasesort($keys);      Meanwhile someone in my office changed it to do this:                   function meta_form() {             global $wpdb;                if ( isset($_GET['post']) )             $post_id = (int) $_GET['post'];           elseif ( isset($_POST['post_ID']) )             $post_id = (int) $_POST['post_ID'];           else             $post_id = 0;                if ( $post_id ) {             $post_ = get_post($post_id);                }                if ($post_->post_type == 'video_photo' ){             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta             where meta_key like 'tqmcf_%'                 GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );           }else{             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta                      GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );           }                  if ( $keys )                 natcasesort($keys);      I've been doing research and it looks like any changes to the core should be done in my theme's function.php file using add_filter or add_action. Is this the right way to go? How would I do that? I still don't have too good of a grasp of how they work. Thanks for your help in advance.


title: 500 Internal Server Error after Register dialog, but with successful registration

text: I get a 500 Internal Server error if I try to register a new user. This user will be created successfully, but I don't want that my users will see the error page and, therefore, think that something went wrong. My WordPress is hosted in a subdirectory of my institutions web page (e.g., `www.page.com/path/WordPress`). The installation itself is in the `/var/www` directory on an Ubuntu in a VirtualBox image. It seems that 500 Internal Server errors are quite common, but I didn't found a working solution for me in the web. Most discussions recommend to do one of the following things:   * Disable all plugins   * Change to default theme   * Checked Apache2 log   * Checked PHP log I tried them all, bot none works for me. Has somebody an additional recommendation?


title: Woocommerce purchase note?

text:
I think i am missing something glaringly obvious here: I am trying to include the pruchase note in the customer-completed-order.php so the customer recives the note along with the pruchase confirmation. but i am failing miserably. here is what i have tried:                   <?php echo '
'.  $purchase_note .  'PURCHASE NOTE
'; ?>      and this                   <?php                    $purchase_note = get_post_meta( $_product->id, '_purchase_note');                         echo '
' .  $purchase_note . '
';                      ?>      and this:                   <?php                    $purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) :                         echo '' . apply_filters('the_content', $purchase_note) . '	';                     ?>      and this:                   <?php       if ($order->status=='completed' || $order->status=='processing') {                     if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true))                         echo '

' . apply_filters('the_content', $purchase_note) . '

';                 } ?>      nothing seems to work.... it shows up on the order-received page but will not show on the order confirmed email. Any help is much apricated I am also open to some other method to get the note to the client upon purchase. such as custom meta values maybe?? Chris


title: Creating an accordion style menu

text: Is there any way to create a menu with dropdown list like the image below in WordPress ? ![accordion menu](http://i.stack.imgur.com/4Qtw0m.jpg)   _click to enlarge_ ⤴ Here, when we click on [+] sign the dropdown menu shows up, I can manage the CSS, but what would be the code to make this possible?


title: Why does WordPress rely on an fully qualified site_url with a 15-step plan for moving a site?

text: From the Moving WordPress codex page (emphasis mine): > When your domain name or URLs change there are additional concerns. The > files and database can be moved, however references to the old domain name > or location will remain in the database, and that can cause issues with > links or theme display. > > If you do a search and replace on your entire database to change the URLs, > you can cause issues with data serialization, due to the fact that some > themes and widgets store values with the length of your URL marked. When > this changes, things break. To avoid that serialization issue, you have two > options: > >   1. Only perform a search and replace on the wp_posts table. >   2. Use the Search and Replace for WordPress Databases Script to safely > change all instances. ( If you are a developer, use this option. It is a one > step process as opposed to the 15-step procedure below ) > What are the benefits of saving the site_url vs. using relative links? Is it because of performance? Or is there some other benefit (e.g. SEO-related or technical) when hyperlinks in the content are fully qualified? Because it certainly makes WordPress more difficult to use when developing in a team, when you have a shared database with your test/acceptance environment, and when 'going live' with a WordPress website.


title: Highlight posts currently being edited on multiple editor site?

text:
I have a custom page that uses the Cleverness To-Do List plugin to display multiple posts on a page. My site has multiple editors, and if a post is currently being edited on the custom page (not the dashboard) by another editor, I want that post (in the form of a `<tr>`) to be highlighted. Can someone point me in the direction of how to accomplish this in the context of my custom page's structure? The site structure looks like this when you're editing a post: *****.com/blog/to-do-list/?action=edit-todo&id=1190 The PHP used to display the list:               /**      * Display the to-do list with checkboxes      */     public function display( $complete = 0 ) {         extract( shortcode_atts( array(             'title'      => '',             'priority'   => 0,             'assigned'   => 0,             'deadline'   => 0,             'progress'   => 0,             'category'   => 0,             'addedby'    => 0,             'date'       => 0,             'todoid'     => '',             'editlink'   => 0         ), $this->atts ) );         global $current_user;         get_currentuserinfo();         $this->add_script = true;         $layout = 'list';         $this->list = '';              list( $this->url, $this->action ) = CTDL_Lib::set_variables();              /** @var $title string */         if ( $title != '') {             $this->list .= '
'.esc_html( $title ).'
';             }              // get to-do items         /** @var $todoid int */         if ( $todoid != '' ) {                  $post = CTDL_Lib::get_todo( $todoid );             if ( $post ) {                 $id = $post->ID;                 list( $the_priority, $assign_meta, $deadline_meta, $completed_meta, $progress_meta ) = CTDL_Lib::get_todo_meta( $id );                      if ( CTDL_Loader::$settings['list_view'] == 2 ) {                     $completed = ( $todoid != '' && get_post_meta( $id, '_user_'.$current_user->ID.'_status', true ) == 1 ? 1 : 0 );                 } else {                     $completed = ( $todoid != '' && get_post_meta( $id, '_status', true ) == 1 ? 1 : 0 );                 }                      $this->show_checkbox( $id, $completed, $layout, ' single' );                 $this->show_todo_text( $post->post_content, 'list' );                 /** @var $priority int */                 if ( $priority == 1 ) $this->show_priority( $the_priority );                 /** @var $progress int */                 if ( $progress == 1 ) $this->show_progress( $progress_meta );                 /** @var $assigned int */                 if ( $assigned == 1 ) $this->show_assigned( $assign_meta );                 /** @var $addedby int */                 if ( $addedby == 1 ) $this->show_addedby( get_the_author() );                 /** @var $deadline int */                 if ( $deadline == 1 ) $this->show_deadline( $deadline_meta );                 /** @var $date int */                 if ( $date == 1 ) $this->show_date_added( get_the_date(), get_the_date( CTDL_Loader::$settings['date_format'] ) );                 $this->list .= do_action( 'ctdl_list_items' );                 /** @var $editlink int */                 if ( $editlink == 1 ) $this->show_edit_link( $id );             } else {                 /* if there are no to-do items, display this message */                 $this->list .= '
'.apply_filters( 'ctdl_no_items', esc_html__( 'No items to do.', 'cleverness-to-do-list' ) ).'
';             }              } else {                  /** @var $category mixed */             $this->loop_through_todos( 0, $category );              }              wp_reset_postdata();     }      PHP used to create the `<tr>`:               /**      * Creates the HTML for the To-Do List Table Headings      * @param $completed      */     public function show_table_headings( $completed = 0 ) {         extract( shortcode_atts( array(             'priority'   => 0,             'assigned'   => 0,             'deadline'   => 0,             'progress'   => 0,             'categories' => 0,             'addedby'    => 0,             'date'       => 0,             'editlink'   => 1         ), $this->atts ) );              $this->list .= '

';         $this->list .= '	';         $this->list .= ''.apply_filters( 'ctdl_heading_item', esc_html__( 'Item', 'cleverness-to-do-list' ) ).'	';         /** @var $priority int */         if ( $priority == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_priority', esc_html__( 'Priority', 'cleverness-to-do-list' ) ).'	';         /** @var $progress int */         if ( $progress == 1 && CTDL_Loader::$settings['show_progress'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_progress', esc_html__( 'Progress', 'cleverness-to-do-list' ) ).'	';         /** @var $categories int */         if ( $categories == 1 && CTDL_Loader::$settings['categories'] == 1 ) $this->list .= ''.apply_filters(             'ctdl_heading_category', esc_html__( 'Expeditor',             'cleverness-to-do-list' ) ).'	';         if ( CTDL_PP ) $this->list .= ''.apply_filters( 'ctdl_heading_planner', esc_html__( 'Post Planner', 'cleverness-to-do-list' ) ).'	';         /** @var $assigned int */         if ( $assigned == 1 && ( CTDL_Loader::$settings['assign'] == 0 && ( CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 0                 && ( current_user_can( CTDL_Loader::$settings['view_all_assigned_capability'] ) ) ) || ( CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 1 )                 && CTDL_Loader::$settings['assign'] == 0 ) ) $this->list .= ''.apply_filters( 'ctdl_heading_assigned',             esc_html__( 'Assigned to', 'cleverness-to-do-list' ) ).'	';         /** @var $addedby int */         if ( $addedby == 1 && CTDL_Loader::$settings['list_view'] == 1 && CTDL_Loader::$settings['todo_author'] == 0 )             $this->list .= ''.apply_filters( 'ctdl_heading_added_by', esc_html__( 'Added By', 'cleverness-to-do-list' ) ).'	';         /** @var $deadline int */         if ( $deadline == 1  && CTDL_Loader::$settings['show_deadline'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_deadline',             esc_html__( 'Deadline',             'cleverness-to-do-list' ) ).'	';         /** @var $date int */         if ( $date == 1 && CTDL_Loader::$settings['show_date_added'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_date_added', esc_html__( 'Date added',             'cleverness-to-do-list' ) ).'	';         if ( $completed == 1 && CTDL_Loader::$settings['show_completed_date'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_completed', esc_html__( 'Completed', 'cleverness-to-do-list' ) ).'	';         $this->list .= do_action( 'ctdl_table_headings' );         /** @var $editlink int */         if ( $editlink == 1 && current_user_can( CTDL_Loader::$settings['edit_capability'] ) || CTDL_Loader::$settings['list_view'] == 0 )             $this->list .= ''.apply_filters( 'ctdl_heading_action', esc_html__( 'Action', 'cleverness-to-do-list' ) ).'	';         $this->list .= '

';     }


title: List post wit the same category but exclude parent

text: I have the followind code:               <?php global $post;                 $cat_ID=array();                 $categories = get_the_category(); //get all categories for this post                     foreach($categories as $category) {                         array_push($cat_ID,$category->cat_ID);                     }                 $args = array(                     'orderby' => 'date',                     'order' => 'DESC',                     'post_type' => 'post',                     'numberposts' => 10,                     'post__not_in' => array($post->ID),                     'category__in' => $cat_ID                 );                 $cat_posts = get_posts($args);                     if ($cat_posts) {                              echo 'SOME HTML';                              foreach ($cat_posts as $cat_post) { ?>      It currently lists all post which contain the same category as the current post you are on. What I would like it to do is to exclude the parent category. The a example category list / example would look like this: Work   \- Animation   \- Film   \- Misc When on a post eith the cat Animation all the other posts with the same cat show up (which is good ) but so does the main parent 'Work'. How do I exclude it? THANK YOU!


title: Custom url structure - pages under a custom post type

text: I'm struggling with the structure of my Wordpress site and I was hoping you might be able to give me some advice. The site is for a series of events and the structure is as follows:   * Gateway (contains a list of events)      * London 2012 (a specific event)        * Overview (default for event)       * Speakers       * Agenda       * Venue       * Register     * New York 2012        * Overview       * Speakers       * Agenda        * Venue       * Register I am using several custom post types, and each have a number of custom fields attached: Events: the information from this custom post type is used to create the Overview page Speakers: this a pool of the potential speakers. Speakers are added to a specific event using the above custom post type Venue: this is a pool of potential venues. The venue is added to a specific event using the above custom post type I would like the structure of the site to be as follows:   * / - Gateway   * /london-2012/ - A specific event overview   * /london-2012/speakers - Speakers page   * /london-2012/agenda - Agenda page   * /new-york-2012/speakers - Another speakers page   * etc. …where an identical page 'types' (eg. speakers page) will all use the same template across the board (I'll just get the parent event from the URL and do a custom query to grab the data for the page). Can anyone suggest the best way to do this? I believe either a URL rewrite solution or categories may work but I'm unsure about both :( **Update 1** Have sorted this using redirects - for example, speakers pages:               add_rewrite_rule(       '^event/([A-Za-z0-9-]+)/speakers/?$', //Checked against the global $wp object - $wp->request       'index.php?page_id=9&event_slug=$matches[1]', //Use WP_Query params to find your page       'top' //This will superceed the default WP rewrite stack     );      then registered the variable:               add_filter('query_vars', 'my_query_vars');          function my_query_vars($vars){         $vars[] = 'event_slug';         return $vars;     }


title: Block wordpress style for my plugin admin page

text: I have my own style for my plugin, it works, but wordpress adds a style too, and the page is not looking very ok. Is there any way to block wordpress style for my plugin administration page?


title: using wp_remote_get to retrieve own url on local host

text: I have a website in local development at test:8888 and I am trying to get the following to work in my functions.php file.               $response = wp_remote_get( 'test:8888/?p=1' );     print_r($response);      Unfortunately this is printing               WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => A valid URL was not provided. ) ) [error_data] => Array ( ) )        Is it possible to request your own url while developing on localhost?


title: Registering post type is not adding to admin menu

text: I started playing with an idea a few days ago that will be using custom post types. I've never used CPTs before and am running into issues with the basic registration process. The following registration code is hooked into `init` and I have verified that it is running, however I am not seeing "Slides" appear in the admin menu. *EDIT: WP_DEBUG is enabled and nothing is being produced.*               register_post_type(self::$post_type, array(         'labels'               => array(             'name'               => __('Slides', 'bonestheme'),             'singular_name'      => __('Slide', 'bonestheme'),             'add_new_item'       => __('Add New Slide', 'bonestheme'),             'edit_item'          => __('Edit Slide', 'bonestheme'),             'new_item'           => __('New Slide', 'bonestheme'),             'view_item'          => __('View Slide', 'bonestheme'),             'search_items'       => __('Search Slides', 'bonestheme'),             'not_found'          => __('No Slide Found', 'bonestheme'),             'not_found_in_trash' => __('No slides found in Trash', 'bonestheme')         ),         'capability_type'      => array('slide', 'slides'),         'description'          => 'Represents a single slide in the header slideshow.',         'hierarchical'         => false,         'menu_position'        => 5,         'public'               => false,         'register_meta_box_cb' => array('SlideJS', 'createCPTMetaboxes'),         'rewrite'              => false,         'show_in_admin_bar'    => false,         'show_in_nav_menus'    => true,         'show_ui'              => true,         'supports'             => array('title', 'thumbnail')         )     );          remove_post_type_support( self::$post_type, 'editor' );


title: Change the output of wp_title()

text: I use wp_title to generate some kind of breadcrumb and it works well, but in there I have the title of the _site_ , and I want to delete that. It looks like this: Taxonomy1: City | Title of the site. I get that by using `<?php wp_title(); ?>`. How can I delete the title of the site in that output?


title: Remove all nav menu classes ( but keep useful ones... )

text: I'm trying to remove all menu-item classes (except for `.current- menu-{item/parent/ancestor`} and `.menu-item-has-children`)               function custom_nav_menu_css_class($classes) {         $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes);         return $classes;     }     add_filter('nav_menu_css_class', 'custom_nav_menu_css_class');      This almost does the job, _except_ it removes `.menu-item-has-children`? Any idea what I should change, to exclude it from being removed? (P.S. I'd rather not use a custom walker...)


title: Sort posts with multiple meta_keys

text: does anybody know how to filter post by meta_key1 (meta_key1=something) and order by meta_key2 at the same time ? `query_posts('post_type=press_articles&posts_per_page=5&meta_key=dt_featured_press_radio&meta_value=yes&order=ASC')` how add order by meta_key2 here ? thanks!


title: Images will not attach to posts after site migration

text: I recently migrated a WordPress install from a subdirectory to the root. After the migration everything worked great, except that I can no longer set a featured thumbnail or add a picture in the WYSIWYG. On a possibly related note, I can only set post tags from the Quick Edit screen and not the post edit screen. When I click set featured image on the post edit screen it opens the screen to add media, but it opens in a new page, not like in a box before. When I click to the media library and click show next to an image, it does not show and so I can't select "use as featured image." I can still upload the photo, but I can't attach it to the post. I'm not sure if the tags issue is related, but whenever I enter a tag in the Post Tag box it will not save. But if I go out to the All Posts listing, I can enter them via Quick Edit. Any ideas? Thanks in advance.


title: Page Navigation not working for the next pages

text:
I use a custom template to display the lists of post. The pagination design works, and even the post_per_page works but then it only display the post indicated for the post per page. so when clicked to the next page. it only displays nothing. I have searched through internet and tried the given solutions however it didnt worked out. I am just a newbie with wordpress. Your help is so much appreciated. thank you :) Here is my code for the custom page template:                      <?php        $paged = ( get_query_var( 'paged' ) ) ? (get_query_var( 'paged' )) : 1;       $temp = $dynamic_que;       $dynamic_que= null;         if ( isset( $_POST['nextbtn'] ) )          {              $given_id = $_POST['catidfwd'];                  /*  query_posts( array ( 'category__and' => 4208,$given_id) );                     // The Loop                     while ( have_posts() ) : the_post();                     $postid = get_the_ID();                       echo '
';                           the_title();                       echo 'ASC);                     //$dynamic_que->query('paged'=>$paged);                 $dy_que = array ('category_id' => $given_id, 'posts_per_page' => '7', 'page'=>$paged);                  $dynamic_que = new WP_Query($dy_que);                     //$dynamic_que = new WP_Query($dy_que);                     while ( $dynamic_que->have_posts() ) {                         $dynamic_que->next_post();                         echo '
' . get_the_title( $dynamic_que->post->ID ) . '
';                     }       ?>

                     <?php                          wp_pagenavi( array( 'query' => $dynamic_que) );                          wp_reset_postdata();                         $dynamic_que = NULL;                         $dynamic_que = $temp;                     ?>

          <?php         }  // end of isset     ?>


title: get_page_by_title not working when used with a variable

text: My page title is `This is my title`, if I try and retrieve the ID from the title like this then it does not work:               $mytitle = 'This is my title';     $mytitle2 = get_page_by_title( $mytitle, OBJECT, 'mycustompost' );     print_r($mytitle2);      But if I do this it does work:               $mytitle2 = get_page_by_title( 'This is my title', OBJECT, 'mycustompost' );     print_r($mytitle2);      What gives? Does `get_page_by_title` not accept variables?


title: How to show selected value in dropdowm menu

text: I have a problem, I want to show the user the selected value the user has selected before. I have a `custom post` type I have created and I have also a separate plugin that's using a custom db. What I have done is make the dropdowm menu with all the custom posts (show posts name) and then the user choose what custom post they need to get the post link. Then I copy the post permalink into var and uptade the permalink into plugins DB. Here is the code that print all `custom post type`               <select class="edit-link-field" name="link[<?php echo $id ?>]">                 <?php                 $args = array(                     'post_type' => 'test_reviews',                     'position' => 'pastor'                 );                 $pastorList = new WP_Query($args); while ($pastorList->have_posts()) : $pastorList->the_post();                 $postID = get_the_ID();                     $is_selected = (get_the_title() == $selected) ? 'selected="selected"' : '';                     echo '<option value="'.get_permalink( ).'" '.$is_selected.'>'.get_the_title().'</option>';                      endwhile; wp_reset_postdata();                 $test = get_permalink( );                      ?>                </select>      So what I need now is the same dropdown menu but with selected value that the user selected. and if the user will change the select value and will push on the "update button" it will update the new permalink to DB


title: How to add the widgets manually to the sidebar?

text: How can I add the widget manually in the code ?


title: Modify output of custom loop using WP_query

text: I have a custom loop from a custom post type and I want to NOT display posts with the category 'slider'. I'm using this to set up the query:               $args = array( 'post_type' => 'hotwives', 'posts_per_page' => -1);     $loop = new WP_Query( $args );     while ($loop->have_posts() ) : $loop->the_post();      I was going to use this in the $args variable:               'category' => 'slider'      But not sure how to make that NOT display the posts from category 'slider'. And, incidentally, when I use that in the $args variable it still shows every post, not just the 'slider' posts. So, seems I'm not on the right track regardless. Thanks!


title: Set Featured Post Automatically - First Image included IN the post

text: I want to set the featured image to the first image IN the post content. I've come across a few functions that grab the first image **attached** to the post. Sometimes a user will add an image to a post that was previously uploaded and used in another post, which causes this function to not grab any image because it doesn't see the image as attached to that post. This is the function that grabs the first image attached to the post, but I want it to grab the first image inside of the post content, even if its not directly associated to that post. I know this can be done with a plugin, but I'm trying to add a function to my functions.php file to avoid plugin bloat. Thanks               function autoset_featured() {               global $post;               $already_has_thumb = has_post_thumbnail($post->ID);                   if (!$already_has_thumb)  {                   $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );                               if ($attached_image) {                                     foreach ($attached_image as $attachment_id => $attachment) {                                     set_post_thumbnail($post->ID, $attachment_id);                                     }                                }                             }           }     add_action('the_post', 'autoset_featured');     add_action('save_post', 'autoset_featured');     add_action('draft_to_publish', 'autoset_featured');     add_action('new_to_publish', 'autoset_featured');     add_action('pending_to_publish', 'autoset_featured');     add_action('future_to_publish', 'autoset_featured');


title: Post Admin - Filter by posts without tags

text: I am stuck on this one and it's probably a really simple answer but can anyone please shine some light on how to add a filter menu with an option value of 'No Tags' that when clicking the Filter button will only show posts that have no tags associated with them? Many thanks in advance!


title: Variables posting twice

text: I wish to create a new variable as described in the codex, but on submission of the URL the variables are submitted twice to my function I have tried this within a plugin also a the `function.php`. I have also tried to use `wp_reset_query()` Here is my sample code:               add_filter('query_vars', 'my_function');     function my_function ($vars) {           $vars[] = 'Q1';       $vars[] = 'Q2';           return $vars;         }          add_action('parse_query', 'query_var');         function query_var () {           if (get_query_var('Q1')){             echo ('hello');           }     }


title: Get image post ID in media upload

text:
I am developing a plugin that adds a Custom Post Type to my theme. It's a retail directory and the post type is a retail listing. Everything is working fine. I can upload content to the DB and then print in a customized CSS framework I have developed. However, when i want to upload and display an image, that's when I have problems. The problem occurs when the image is uploaded. I use the update_post_meta() to update the meta information of the image which is related it to the post ID and post it to the database table "wp_postmeta" under column "meta_value". I also use the WP media upload JQuery Code to select the image. I'm not sure where the problem is exactly, but I know it's with the upload because when the image goes into the "meta_value" column has value NaN and not the ID value that it should be. Here's the upload code:               add_action( 'save_post', 'process_image_meta', 10, 2 );          function process_image_meta( $post_id, $post ) {             update_post_meta( $post_id, '_image_id', $_POST['upload_image_id'] );         }      And the wp media uploader code: And finally, the display code:               function display_retail_listing_meta_box($retail_listing) {         // Retrieve current shop details based on retail lisitng ID              global $post;                  $image_src = '';         $image_id = get_post_meta( $post->ID, '_image_id', true);         $image_src = wp_get_attachment_url( $image_id );     ?>

     Image Upload	     <img id="shop_image" src="<?php echo $image_src; ?>" style="max-width:100%;" />     <input type="text" name="upload_image_id" id="upload_image_id" value="<?php echo $image_id; ?>" />     <a title="<?php esc_attr_e( 'Upload Image' ) ?>" href="#" id="upload-image"><?php _e( 'Upload Image' ) ?>     <a title="<?php esc_attr_e( 'Remove Image' ) ?>" href="#" id="remove-image" style="<?php echo ( ! $image_id ? 'display:none;' : '' ); ?>"><?php _e( 'Remove Image' ) ?>

      Followed by the WP Media Upload Code:               jQuery(document).ready(function($) {                  // save the send_to_editor handler function             window.send_to_editor_default = window.send_to_editor;                  $('#upload-image').click(function(){                      // replace the default send_to_editor handler function with our own                 window.send_to_editor = window.attach_image;                 tb_show('', 'media-upload.php?$post_id=<?php echo $post->ID ?>&type=image&TB_iframe=true');                      return false;             });                  $('#remove-image').click(function() {                      $('#upload_image_id').val('');                 $('img').attr('src', '');                 $(this).hide();                      return false;             });                  // handler function which is invoked after the user selects an image from the gallery popup.             // this function displays the image and sets the id so it can be persisted to the post meta             window.attach_image = function(html) {                      // turn the returned image html into a hidden image element so we can easily pull the relevant attributes we need                 $('body').append('
' + html + '
');                      var img = $('#temp_image').find('img');                      imgurl   = img.attr('src');                 imgclass = img.attr('class');                 imgid    = parseInt(imgclass.replace(/\D/g, ''), 10);                      $('#upload_image_id').val(imgid);                 $('#remove-image').show();                      $('img#shop_image').attr('src', imgurl);                 try{tb_remove();}catch(e){};                 $('#temp_image').remove();                      // restore the send_to_editor handler function                 window.send_to_editor = window.send_to_editor_default;                  }              });         </script>


title: The uploaded file exceeds the upload_max_filesize directive in php.ini

text: I'm trying to upload a XML file through Wordpress Importer It shows this error, no matter what the size of the file is. Even 10kb file throws up this error. My php.ini settings were set to 100MB, still no change. Back to defaults, wich is 8MB. I'm starting to think it's permission related. Any ideas?


title: Wordpress HTTPS - Entry of URL with and without www doesnt lead to https

text: I dont want to post the exact same text here again (duplicate content), so maybe anybody can refer to my question, please: http://wordpress.org/support/topic/wordpress-https-entry-of-url-with-and- without-www-doesnt-lead-to-https Thanks in advance. Andre


title: Make WooCommerce pages accessible for logged in users only

text: I have a website using WordPress, and an e-commerce using WooCommerce. I would like my shop (and all its pages) to be seen by logged in users only. Via the _User Access Manager_ plugin, I have denied access to the shop page, but with a direct link to a product etc. one can access that particular page nonetheless, even if the user is not logged in. How can I redirect users, who are not logged in, to another page if they try to access a WooCommerce page?


title: How to determine what is generating large amount of database queries?

text: For some reason, my Wordpress site is using a lot of memory (spiking at 72MB) and generating a huge amount of database queries (76923 according to Wp- Memory-Usage. I'm really not sure why this would be, as there is nothing going on on the site that would create these. The only thing I can think of is the Ninja Forms plugin. The site is here: http://cbipath.com And the plugins installed are: BlackStudio TinyMCE Easy Bootstrap Shortcodes Ninja Forms Shortcodes Ultimate Page Builder by SiteOrigin TPC Memory Usage WP-Pro-Quiz Plugin Performance Profiler I have a plugin load time of .449 sec per visit, Plugin impact of 58.8% of page load time, and 98 MySQL queries per visit (all according to the Plugin Performance Profiler). Any insight would be hugely appreciated.


title: Metabox with file upload to custom directory

text: I've found lots of tutorials on how to create a metabox file uploader using wordpress' native file uploader. However, I would like to have the uploaded file placed in to a custom directory, and I'm having a hard time finding any info on it. Can anyone provide some leads? Thanks in advance!


title: Custom Post Type or Shortcode, What to choose?

text: While developing a _multipupose_ theme for _mass audience_ , i’m facing an issue. I’m going to code staff listing section. Now i was wondering, what should i do? 1: Create dedicated Custom Post Type for staff; or 2: Create Shortcode for it. Now each decision has some pros and cons. **a) Custom Post Type:**   * Centralization, can call same group of listing on mutiple places without defining each time.   * Better staff order managerment   * No need to enter detail page link specifically   * Taxonomy support, so better hierarchy   * _cons:_ dedicated CPT for it might be an overkill **b) Shortcode Approach:**   * _cons:_ cannot do anything with current shortcode generator which are described above and there would be too many fields in shortcode generator.   * _pro:_ less messy WordPress sidemenu Now is the best approach in this context?


title: How to create custom LOGIN and REGISTRATION forms?

text: I have developed a theme for Wordpress and I need to customize login and registrations form. At the moment, as usual, the login and the registration URL are:               http://www.example.com/wp-login.php     http://www.example.com/wp-login.php?action=register      I would like to create INLINE form, with INLINE I mean that this form must to be inside my pages and not in a single(dedicated) web page. For login I need:               - Email      - Password      For Registration:               - Name     - Email     - Password     (and a pseudo check for "spammers" like captcha or arithmetical operations)      as I told I need these forms in my pages, not in a dedicated page. Two questions: 1- Can I do it **WITHOUT** using a plugin? 2- If I can, how can I show any errors (example: wrong email, wrong password) inline with the form? (without redirect to wp-login.php) Thank you!


title: How can I do customizations on login, registration and password recovery forms?

text: There are a couple of answers here basically just linking to a plugin - to be fair there are some more specific ones too. I know there are many possibilities to use different hooks for the customization. I really want to learn more about that, but where do it start?


title: If on term-page -> get the current term?

text: I'm trying to write a kind of "breadcrumb" function in my "functions.php" I'd like to query if I'm on a term-page and if so I want to print the current term I'm in. By "term-page" I mean the following. I list all terms of a custom-taxonomy (associated with a custom-post-type) as kind of categories in my header. I do this with `get_term_link($term->slug, 'my_taxonomy')`; In my new function for the breadcrumbs I'd like to query if I'm on one of this pages and print this term. First off, … I'm doing this …               if ( is_taxonomy_hierarchical('my_taxonomy) ) {                 echo "test";      But now my function is depending on this `my_taxonomy` string. I'd love to work this function for all upcoming taxonomies. How can I do this? There are conditional tags like `is_category()` that doesn't need any params. Why do all term- or taxonomy-conditionals need this param? And how can I print the current-term i'm in. Right now I'm just echoing "test" up there, however I'd like to print the current term. Any ideas on that? Thank you in advance. **UPDATE:**               function list_breadcrumbs() {              $q_object = get_queried_object();         $taxonomy = $q_object->taxonomy;              $seperator = " ⟩ ";              if ( !is_home() ) {                      echo "Home" . $seperator;                  if ( is_category() ) {                 $category = get_the_category();                  echo "" . $category[0]->cat_name . "";             } else if ( is_tax( $taxonomy ) ) {                 echo "The Term Name";             } else if ( is_single() ) {                 …             } else if ( is_page() ) {                 …


title: update Semiologic?

text: I usually wait for Denis to let us know when to upgrade to the next SP and WP version.. Anyone know? Thanks Miami


title: Upload attachment from external site

text: For example, we have some image on the external site: http://site.com/image.png How do I upload this image to my wordpress as an image attachment by php? Image should be copied to my uploads folder, post added, meta generated.


title: Unified Approach for Placing Option Pages

text: Currently, it is up to any plugin's author as to where to put a link to the plugin's option page. I have seen at least the following "solutions":   * Plugin list   * Dashboard menu   * Plugins menu   * Appearance menu    * Tools menu    * Settings menu   * Tools menu   * Top level In my opinion, this is very bad style (globally, not necessarily individually). In addition to the mass of links in many different locations, Wordpress does not sort them or anything. As it is now, plugin developers can put anything anywhere in the menues and we probably want it that way; but there really should be a unified way of registering an options page such that is recognised and placed as such. Please see here, too. The old ways could remain valid, but I'd suggest recommending to use the standardised (and easy) way. I have lately thought about writing a plugin that provides such an frontend, that is offers a function for other plugin authors that registers an options page and cares for placing links to it in the appropriate places. The notion of _appropriateness_ could be hardcoded in a first version and be left to the user in subsequent iterations. I can even image a screen were users can put pages registered by plugins (not necessarily only option pages) were it suits them; if _the user_ thinks this plugin's options should be there, so be it. What do you think? In particular:   * As a plugin author, would you delegate to such a plugin?   * Do you think I should build it?   * Should I rather implement the feature directly into Wordpress, hoping that the main hackers approve and incorporate it?


title: How can I prevent uploading bmp image?

text: I need to prevent uploading bmp image for user. How can it be possible?


title: Mixing Regular Javascript With jQuery in a Plugin

text: Sorry for a simple question. I'm learning about plugins. I've got some javascript that I want to put in a jQuery file in my plugin. (I've got jQuery and the scripts enqueued, and working fine). Is it okay if I just prepend the javasvript to the jQuery? So, the file would look like this:               //regular javasript      function do_something() {       //do Something     }          jQuery.noConflict();          jQuery(document).ready(function() {       //my jQuery stuff     }      Is there a right way of doing this or does it not matter? If I put my straight javascript first (as above), it works. If I put the javascript in with the jQuery, wrapping it in jQuery(document).ready(function() { }, then it doesn't. Is it possible to add regular javascript in the jQuery ready function? Any ideas as to why it wouldn't work? I'm trying to learn.


title: Allow users mark posts as "complete"?

text: Any search keyword suggestions to help would be appreciated - not sure how best to describe this query :) I have a custom post type "module". I have ~300+ modules in my install. I have ~100+ registered users (Subscriber role) Query: I want to allow users to mark a "module" as "Complete" using a checkbox, and be able to get that info from DB when I'm generating lists of modules. Is there a plugin or hack available or any suggestions if I need to code it up myself? Any other suggestions?


title: Nginx rewrite rules

text: I am having some problems with the Nginx rewrite algorithm for WordPress. I am using this for the rewrite and it works good;                   server_name www.domain.com domain.com;         if ($host != 'domain.com') {         rewrite ^/(.*)     http://domain.com/$1 permanent;         }       it makes this url;               http://domain.com/?author=1       to this;               http://domain.com/author/username/      which is good but with an url like this;               http://domain.com/?author=1&type=like      it makes it;               http://domain.com/author/username/?type=like      and i am not getting any error but the query is not working. What i am missing?


title: Run a plugin just 'once' per page reload

text: I'm making a plugin that counts the number of times a visitor visits my site. I want to run the code in the plugin once per page load. What's a good action hook I can use ?


title: When using wp_enqueue_script(); in a theme why don't we use add_action?

text: When using `wp_enqueue_script` in a plugin, I have always been told to use an `add_action` :               function add_my_css_and_my_js_files(){         wp_enqueue_script('jquery-validate-min', plugins_url('jquery_validate_min.js', __FILE__ )          }     add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");        How come this is **not** required if you put wp_enqueue_script in the theme:                wp_enqueue_script('jquery-validate-min', plugins_url('jquery_validate_min.js',


title: Search by the title in WP_Query?

text: From the wordpress offical document website , there are a search parameter which is `&s={keywords}` However, I wonder is this search is based on everything of the Post? that means if I provide `&s=book` , then if a Post has a name = "abc" which is a category of "book", it still include in the search result. Are there any way to specific the search to title_plain only?


title: Sending a search query form a Flash search box to Wordpress search.php?

text: it does not look like to many people would try this, maybe not possible?? I have an old Flash page that contains a search for using command "Get" and goes to a cgi search script. I need to modernize the whole thing and use WordPress for my Arts Directory in the future - but, this little tricky thing keeps bugging me, i want to use my Flash interface as front page and the search box /search query should end up at WordPress `search.php` (or `searchform.php` which my Theme has in addition to `search.php`. Is there any way to do this in Flash, what PHP string would i need to replace the existing               On (Release)           If (query ne "")                 Get URL ("cgi-bin/linksaroo/search.pl", window="_self", vars=GET)           End If     End On      in Flash??


title: Help with implementing qTip2, with html map in wordpress

text: I am trying to create an HTML map with qTip2 in my WordPress page, but can't get it work- so I'd really appreciate your help. My aim is to have something very similar to this StackOverflow thread. but in my WordPress custom page. I have added the same HTML and CSS as in the example (as a test) and placed the jQuery in a separate file called `qtipcall.js`, I have then followed a tutorial How to implement the qTip to WordPress. I have followed it step by step, did everything few times and it doesn't work! As it says in the guide I have inserted, this, just above the `wp_head()`:               wp_enqueue_script('qtip', 'your/path/to/jquery.qtip.min.js', array('jquery'), false, true);     wp_enqueue_script('qtipCall', 'your/path/to/qtipcall.js', array('jquery', 'qtip'), false, true);      I then updated the paths to match my site, like this:               wp_enqueue_script('qtip', get_template_directory_uri() . '/js/jquery.qtip.min.js', array('jquery'), false, true);     wp_enqueue_script('qtipCall', get_template_directory_uri() . '/js/qtipcall.js', array('jquery', 'qtip'), false, true);      But the files seem not to be loading up with the site. I have checked the page source and the call for the two `js` files (`jquery.qtip.min.js` and `qtipcall.js`) aren't in the code. This is my site. Would appreciate any suggestions and tips on what I am doing wrong and how to fix this.


title: database columns: post_title vs post_name

text: I changed post_title, post_contents, and post_name to allow for utf by changing collating sequence to: utf8_general_ci Then using add new post, I type for the title three Hebrew ALEFs.   The post_title is in Hebrew in the database, but the post_name has this value: %d7%90%d7%90%d7%90 According to Charmap, ALEF has a hex value of 05D0.   So what does the d790 represent? Some other encoding? I'm looking to write a program to mass upload a bunch of posts, so I need to know what to put in the post_name field, and what it is used for.


title: How can I set up a category "overview" page?

text: I know I can use the Template Hierarchy to set up custom theme pages for terms inside a category, like these:               mysite.com/category/tech/              // category-tech.php     mysite.com/category/blog/              // category-blog.php     mysite.com/category/featured/          // category-featured.php      `category.php` does not seem to work for the overview page, but it would work for a page like `mysite.com/category/tech/` if a more specific template file (`category-tech.php`) was not available. I want to create a "category overview" page (`mysite.com/category/`) which would show all the terms of the `category` taxonomy. Similarly, I would also like to be able to do this with a custom taxonomy, such as `mysite.com/books/` in this case:               mysite.com/books/fiction/     mysite.com/books/non-fiction/     mysite.com/books/science/      I do want this done dynamically, i.e. I don't want to create a page called 'category' with a permalink `category` and then add the items to that page. I think it would work but that seems like a hack.


title: How to implement separate sub-menus?

text: I want to implement two menus that work like this:                 Cars      *Animals   <-selected       Recipes     --       Bear      *Dog   <-selected       Cat      So the top menu in the main menu, the the menu below is the sub-menu. Not all main menu items have sub-menus. Is there an elegant way to implement this? Preferably, selecting the top menu item would select the first sub-menu. wordpress version 3.03


title: How to give a CPT (custom post type) a date based url

text: I have events that have an event-date custom field. I want to create a date based page to display all events for a given day, and my hope was to use the url to help with that. I have a 7 day calendar working, and it shows a "featured" event for a given day. Then I want to link to a page that shows all the events for that day. Not sure if this is at all possible but I figured the geniuses in this Stack would know.


title: Show recent posts in menu?

text: I'm building a menu which contains categories. Is there a way to make each menu option show a list of recent posts in that category when you hover over it?


title: What happened to my Inactive Widgets?

text: I have purchased the DynamiX theme, and I'm trying to use it for the first time. I was looking at the widgets, and I saw some neat customized (Dynamic maybe?) widgets in the Inactive Widgets section. I was going to drag one to my Sidebar, but accidentally dropped it, and now it is gone. Is there any way to retrieve those? I don't even know exactly what it was, I just know that it was part of my theme. I'm pretty new to Wordpress, so please bear with me. Thanks in advance!


title: Filter search by terms

text: I want to implement advanced search by filters. The user should have the option to select some "tags" or "terms" or "category" and then all the posts containing those tags to be displayed. Expected results as: side bar widget that user should have to select category, subcategory,and child of subcategory with prices,locations and then all the posts containing those tags be displayed.


title: wordpress custom walker for thumbnails with custom menu

text:
I'm still very novice at PHP so any help is greatly appreciated. Typically I have found the codex to be very helpful but it appears custom walkers may be outside its scope. I'd like to have thumbnails show in a custom nav menu which I have in a theme. From what I understand I need to create a custom walker to accomplish this. I've placed this               wp_nav_menu( array( 'container_class' => 'menu-stamp', 'theme_location' =>'stamp-menu' , 'walker' => new Thumbnail_Walker) );       in my theme menu location and inserted the 3 thumbnail lines below the item output section below               /*      * Create HTML list of nav menu items.      * Replacement for the native Walker, using the description.      *      * @see    http://wordpress.stackexchange.com/q/14037/      * @author toscho, http://toscho.de      */     class Thumbnail_Walker extends Walker_Nav_Menu     {     /**      * Start the element output.      *      * @param  string $output Passed by reference. Used to append additional content.      * @param  object $item   Menu item data object.      * @param  int $depth     Depth of menu item. May be used for padding.      * @param  array $args    Additional strings.      * @return void      */      function start_el(&$output, $item, $depth, $args)      {         $classes     = empty ( $item->classes ) ? array () : (array) $item->classes;              $class_names = join(             ' '         ,   apply_filters(                 'nav_menu_css_class'             ,   array_filter( $classes ), $item             )         );              ! empty ( $class_names )             and $class_names = ' class="'. esc_attr( $class_names ) . '"';              $output .= "
ID' $class_names>";              $attributes  = '';              ! empty( $item->attr_title )             and $attributes .= ' title="'  . esc_attr( $item->attr_title ) .'"';         ! empty( $item->target )             and $attributes .= ' target="' . esc_attr( $item->target     ) .'"';         ! empty( $item->xfn )             and $attributes .= ' rel="'    . esc_attr( $item->xfn        ) .'"';         ! empty( $item->url )             and $attributes .= ' href="'   . esc_attr( $item->url        ) .'"';              // insert thumbnail         // you may change this         $thumbnail = '';         if( $id = has_post_thumbnail( (int)$item->object_id ) ) {             $thumbnail = get_the_post_thumbnail( $id );         }              $title = apply_filters( 'the_title', $item->title, $item->ID );              $item_output = $args->before             . ""             . $args->link_before             . $title             . ' '             . $args->link_after             . $thumbnail             . $args->after;              // Since $output is called by reference we don't need to return anything.         $output .= apply_filters(             'walker_nav_menu_start_el'         ,   $item_output         ,   $item         ,   $depth         ,   $args         );        }     }      I get an error for unexpected } at the end of the thumbnail code so its wrong but I'm not sure why.


title: archive as a page, so that it can be added in the wp_menu_nav

text: `http://localhost/lyrics/don't-turn-me-away/` is a custom post type. my question is how to display `http://localhost/lyrics/` as a page and not an archive? my goal really is just for it be added to `wp_nav_menu`. I have created a page named `lyrics` but it won't direct me there. Instead it brings me to `archive.php`. With that, the `lyrics` in menu, don't have the `current-menu-item` class.


title: Remove duplicated values from meta box values

text: I use the code to get all the meta boxes values in a custom type               <?php     $args = array('post_type' => 'posttype');     $emptyvalue = "";     $optionname = "optionname";     $the_query = new WP_Query($args);          $output ="<select name='".$optionname."'> <option value='".$emptyvalue."'>Location</option>'";          while ( $the_query->have_posts() ) : $the_query->next_post();              $id= $the_query->post->ID;              $location = get_post_meta($id, 'institution_location', true);              $get_location = $_GET['institution-location'];              $selected = ($get_location == $location) ? 'selected=selected' : '';              $output .="<option $selected name='".$location."' value='".$location."'>".$location."</option>";          endwhile;     $output .="</select>";          echo $output;          ?>      But if there are two custom post have the same values it returns the two values, so I want to just return one value of them. Thanks


title: How to remove comment link title attribute?

text: When I hover over any post's comment link, I see the title: "Comment on Post Title". How can I remove it? I could not find this text in the theme. Edit: Here's the source which generates the comments link:               <?php comments_popup_link( __('0', 'domain'), __( '1', 'domain'), __('%', 'domain')); ?>


title: Get posts based on meta key/value

text: I have a custom post type "custom_author" which is selected when making a new post using a metabox dropdown with field key "chosen_author". This is what my wp_postmeta looks like: ![enter image description here](http://i.stack.imgur.com/ImnXv.png) Where 13088 is the blog post that has "author" 13112 assigned to it. I am trying to get all posts by a particular author using the following:               $args = array(             'post_type'     => 'post',             'post_status'   => 'publish',             'meta_query' => array(                 array(                     'key' => 'chosen_author',                     'value' => '13112' (tried with and without quotes)                 )             )         );              $getPosts = new WP_Query($args);      But it just returns ALL my posts. I did some debugging:               $getPosts = new WP_Query($args);     echo $GLOBALS['wp_query']->request;      and that output               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (wp_posts.post_author != 0) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10      Completely ignoring the meta_query array! If it matters this being used outside the loop


title: How to test custom rewrite rules /permalinks?

text: After much research, I think I can wrap my brain around WP's rewrite system. I would like to know, though, how to properly test rewrite rules to see if the right rule/tags is being used and the right query vars are being passed. Is there a way to create a temporary template that supersedes everything in a theme whose sole purpose is to spit out current query_vars?


title: update_option in javascript

text: So there's function in wordpress to update a named option/value pair to the options database table: `<?php update_option( $option, $new_value ); ?>`. And what I'm trying to do implement this function in javascript so when you hit the bottom of the page an option would update. I am using this script to check when you hit bottom of the page:               $(window).scroll(function () {        if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {           /***update options***/        }     });      So my question is how to implement update_option function into javascript.


title: Form to post new post with custom taxonomies

text: ![enter image description here](http://i.stack.imgur.com/EAeWl.png) I have displayed the custom taxonomies in the drop down as you see in the red box i want to ask that how can i submit them with the post .I can't figure it out.`               // Do some minor form validation to make sure there is content     if (isset ($_POST['title'])) {         $title =  $_POST['title'];     } else {         echo 'Please enter the wine name';     }          // ADD THE FORM INPUT TO $new_post ARRAY     $new_post = array(     'post_title'    =>  $title,     'tax_input' => array(         'industries' =>  $_REQUEST['taxonomy_id'] ),     'post_status'   =>  'publish',           // Choose: publish, preview, future, draft, etc.     'post_type' =>  'websites'  //'post',page' or use a custom post type if you want to     );          //SAVE THE POST     $pid = wp_insert_post($new_post);          //SET OUR TAGS UP PROPERLY          //REDIRECT TO THE NEW POST ON SAVE     $link = get_permalink( $pid );     wp_redirect( $link );          } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM          //POST THE POST YO     do_action('wp_insert_post', 'wp_insert_post');?>`          the form          enter code here


title: Custom Capability - show plugin menu to these users and admins only

text: I have created a plugin which has custom menu pages. The plugin creates two roles upon activation (let's say role 1 and role 2). role 1 is used for some coding and works fine, WordPress users are assigned this role and the code works correctly. Where I am struggling is that I would the plugin menu's to only be displayed to Administrators and users who have role 2 assigned to them. I am running the following from a function called by my activation hook...               add_role( 'role 1', 'Role 1', array( 'read' => true, 'level_0' => true ) );     add_role( 'role 2', 'role 2', array( 'read' => true, 'level_0' => true ) );     add_action( 'admin_init', 'f_mdjm_caps');      the function f_mdjm_caps contains the following               function f_mdjm_caps()  { /* Capabilities */     $role = get_role( 'role 2' );     $role->add_cap( 'manage_myplugin' );     }      I tried adjusting my menu code to be               add_menu_page( 'My Menu', 'My Menu', 'manage_myplugin', 'mdjm-dashboard',  f_mdjm_admin_dashboard' );      but the menu disappears. Any help appreciated Thanks


title: user contributed content as custom post types

text: We are looking into creating a solution that allows user to contribute media files by filling out a form (without access to the admin) and have it ןד created as a custom post type. The files will be either YouTube Movies, PowerPoint Files etc. Is that possible at all? Do you know any example of something similar?


title: Truncate Widget Title

text: I'm using a function: `function widget_new_title($title) { echo word_limiter($title,20); } add_filter('widget_title','widget_new_title');` to limit the characters for widget title but my problem is that if I do this, the title is not wrapped in before_title and after_title as well as before_widget and after_widget. Any help? Thanks, Cip


title: Creating entries with image attachements within posts and managing them in a list

text: I need help with choosing a suitable meta box or other means for listing, adding and sorting entries, relevant to the containing post. For each entry it should be possible to attach a set of images, for example by using an WP "Add Media" button. The images should be attached to the entries and not to the containing post. It should also be possible to edit and delete entries. I've thought of having these entries as regular posts of some type/category and I think that could work, but they're actually only relevant to the containing post and my thinking is that it could be sensible to avoid it. What do you think? So, in other words I have two problems:   1. How to create a kind of "mini post" with image attachments.   2. How to create an interface to manage them inside the containing post admin page. Does anyone have suggestions on how this could be approached or on any plugin that could be useful for this?


title: Any harm in pointing my dev Wordpress installation to my production database?

text: I have a dev instance of a public website that I maintain, and while they are very similar, there are differences between the site structure of the development instance and the production website. They are both using the custom theme we developed for the site, and when we update production from dev, that's all we update, not any of the rest of the Wordpress install. My question is, can I point my dev Wordpress instance to our production database? The dev instance would presumably be missing some files from some of the plugins that the production instance has, but really all I'm trying to do here is get it working well enough to view and debug any html/css changes to the theme. Is this just a dodgy approach? My ultimate reason for doing this is I want to be able to have the dev instance use Git and have it work on multiple machines, which doesn't play so well when you're using a local database. Any help would be most appreciated.


title: Self-Hosted Blog on Google Search

text: I have a self-hosted blog, (Code Repo - Code Snippets) but for some reason when I search for it on google, it doesn't come up in the results. I posted an entry about 4 days ago, and by now I would have expected it come up in the results. When I search for things on my normal site (same domain), they do come up, its just things inside the blog that don't seem to be included. In the past, I have only had blogs hosted on wordpress.com and they have always automatically come up. What can I do to fix this? Thank you!


title: Need advice on theme customizer and child themes

text: I have been working on a theme, initially it only had one design and I made almost all of the front page elements customizable through the theme customizer. Now I would like to offer a few variations of my theme and I am not sure what I should do. The way I setup my theme is that is that when my theme is installed it looks like the demo, since I made the default values of the theme settings match the design. So the defaults are all setup for the one style. Now since I want to offer a few variations of my theme it makes sense to use child themes that the users can switch to. Although I have no idea how that would work, since most of the elements get there values from the theme settings and not the CSS file so they can be easily customized. Would I not be able to use child themes? Would it make more sense for me to add a setting for which style is chosen and have my customizer choose different default values depending on that setting? (Have three sets of defaults values in a function, and use logic to choose which defaults are used depending on theme chosen?) I want to be able to have a demo bar to show the theme variations. So would it be possible to have a child theme that overrides the customizer aswell? So I could switch to a child theme easily in the demo bar? Any advice would be appreciated.


title: Trouble using antispambot()

text:
I have a custom field in a theme that contains an email address and was pleased to find `antispambot()`
<a href="mailto:<?php antispambot(the_field('queries_e-mail')); ?>"> <?php echo antispambot(the_field('queries_e-mail'));?>
      It looks fine and works as intended (ie. it opens a compose mail window) but when I view the code source it doesn't appear to be encoded.
 john.doe@mysite.com
      According to the Codex the default usage is :               <?php echo antispambot("john.doe@mysite.com"); ?>      which should output:               john.doe@mysite.com      However the encoding doesn't appear to be working in my case.


title: Modify main WordPress loop with a parse_query filter

text: I am trying to modify the main WordPress loop on my category pages like so:               add_filter('parse_query', 'my_modified_query');          function my_modified_query( $q ) {            if (!is_admin() && is_category()) {                   $q->set( 'orderby', 'meta_value' );                   $q->set( 'meta_key', 'my_key' );            }                 return $q;     }      but it does not seem to work. However modifying anything else like :                $q->set( 'order','title' );      $q->set( 'orderby', 'DESC');      works perfectly. Just not               $q->set( 'orderby', 'meta_value' );     $q->set( 'meta_key', 'my_key' );      any idea why that is?


title: How do I get the parent category if I know the child category?

text: So Ive got this function here that creates a drop-down menu from only the child categories, it works great. The problem is that I need to get the parent categories name and assign it as the value of the option class for the child category menus. I can't seem to get it to work, all I get is either '/' or '/child_Category_name/' Thanks!               function child_dropdown($dropID, $taxonomy, $exclude) {          $args = array(     'orderby'                  => 'name',     'order'                    => 'ASC',     'hide_empty'               => 0,     'hierarchical'             => 1,     'exclude'                  => $exclude,     'taxonomy'                 => $taxonomy,     'pad_counts'               => false );                         $categories = get_categories( $args );          $menu = '<select name="'.$dropID.'" id="'.$dropID.'" class="postform">';     $menu .='<option value="">--</option>';          foreach($categories as $category)     {         if($category->parent != 0 ) {                  $menu .= '<option class="'.get_category_parents().'" value="'.$category->name.'">'.$category->name.'</option>';         }     }        $menu .= '</select>';     echo $menu;      }


title: Putting the title attribute in image tag — Snapshot Theme from Woothemes

text: Does anybody know, how to insert the title used in the field "screenshot" and "large-image", in Snapshot Theme from Woothemes? I´ve tried using 'the_title();', but I get the post title, not what I wrote in the "Title" field, in the additional fields "Snapshot Custom Settings". Does anyone have used yet this theme? Does anyone know how to get that title? The Theme website: http://www.woothemes.com/products/snapshot/ My Customization: http://kevingstongramado.p.ht/catalogo/ Thanks.


title: Page will only display first 6 videos

text:
I'm creating a page in WordPress using a custom theme. I have a page that I need to put 8 (maybe more) videos on. With 6 video players on the page it loads in less than a second, but as soon as I put any more videos on, it just loads the first 6 videos then the page continues to load for ages. In the bottom left corner of Chrome it says "Processing Request". I don't understand why 1 or 2 more videos would prevent the page from loading properly. This page contains videos that will introduce you to the different IT & business systems that we use in the company. This includes Google Apps, Dropbox, WorkflowMax, Skype and TeamGantt.

Gmail
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/Using-Gmail.mp4"][/video]

Google Calendar
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/Google-Calendar.mp4"][/video]

Dropbox
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/Using-Dropbox.mp4"][/video]

Team Gantt
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/Team-Gantt.mp4"][/video]

Skype
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/Using-Skype.mp4"][/video]

WorkflowMax Introduction
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/WFM-Introduction.mp4"][/video]

WorkflowMax - Purchase Orders
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/WFM-Purchase-Orders.mp4"][/video]

WorkflowMax - Timesheets and logging time
     [video mp4="http://intranet.yourgroupuk.com/wp-content/uploads/2014/08/WFM-Time-Sheets.mp4"][/video]


title: Update post status from "publish" to "trash" for half of posts

text: I want to update half of all posts with status from `published` to `trashed`. Example:   * if I have 10000 posts, 5000 post to trash   * If I have 6000 posts, 3000 posts to trash   * If I have 7000 posts, 3500 posts to trash


title: Modify image while uploading

text: I have a plugin which uploads image using `wp_upload_handler` here is a function:               //handles upload, a modified version of bp_core_avatar_handle_upload(from bp-core/bp-core-avatars.php)     function handle_upload( ) {         global $bp;              //include core files         require_once( ABSPATH . '/wp-admin/includes/file.php' );             $max_upload_size=$this->get_max_upload_size();             $max_upload_size=$max_upload_size*1024;//convert kb to bytes         $file=$_FILES;                  //I am not changing the domain of erro messages as these are same as bp, so you should have a translation for this             $uploadErrors = array(             0 => __('There is no error, the file uploaded with success', 'buddypress'),             1 => __('Your image was bigger than the maximum allowed file size of: ', 'buddypress') . size_format($max_upload_size),             2 => __('Your image was bigger than the maximum allowed file size of: ', 'buddypress') . size_format($max_upload_size),             3 => __('The uploaded file was only partially uploaded', 'buddypress'),             4 => __('No file was uploaded', 'buddypress'),             6 => __('Missing a temporary folder', 'buddypress')         );              if ( $file['error'] ) {             bp_core_add_message( sprintf( __( 'Your upload failed, please try again. Error was: %s', 'buddypress' ), $uploadErrors[$file['file']['error']] ), 'error' );             return false;         }              if ( ! ($file['file']['size']<$max_upload_size) ) {             bp_core_add_message( sprintf( __( 'The file you uploaded is too big. Please upload a file under %s', 'buddypress'), size_format($max_upload_size) ), 'error' );             return false;         }              if ( ( !empty( $file['file']['type'] ) && !preg_match('/(jpe?g|gif|png)$/i', $file['file']['type'] ) ) || !preg_match( '/(jpe?g|gif|png)$/i', $file['file']['name'] ) )          {             bp_core_add_message( __( 'Please upload only JPG, GIF or PNG photos.', 'buddypress' ), 'error' );             return false;         }                   $uploaded_file = wp_handle_upload( $file['file'], array( 'action'=> 'bp_upload_profile_bg' ) );              //if file was not uploaded correctly             if ( !empty($uploaded_file['error'] ) ) {             bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $uploaded_file['error'] ), 'error' );             return false;         }                  //assume that the file uploaded succesfully             //delete any previous uploaded image             self::delete_bg_for_user();             //save in usermeta             update_user_meta(bp_loggedin_user_id(),'profile_bg',$uploaded_file['url']);             update_user_meta(bp_loggedin_user_id(),'profile_bg_file_path',$uploaded_file['file']);             update_user_meta(bp_loggedin_user_id(),'profile_bg_pos',0);                  do_action('bppg_background_uploaded',$uploaded_file['url']);//allow to do some other actions when a new background is uploaded         return true;     }      before uploading I want to modify this file. Generally I want to add "blur" effect to image. is it possible with such structure?


title: wp_delete_post() not working with BBpress replies

text: I'm trying to auto-delete all BBpress replies of a user when someone's account is banned, but the wp_delete_post is not working with replies. wp_delete_posts() returns a post object if it runs successfully, and it does do this with the reply, but the reply is not deleted from its respective topic!               $args = array (             'numberposts' => -1,             'post_type' => array('topic','reply'),             'author' => $user_id     );     $user_posts = new WP_Query($args);     while ( $user_posts->have_posts() ) : $user_posts->the_post();         wp_delete_post(get_the_ID(), true);         endwhile;


title: Pull & display new comments without refreshing the page

text: I've just managed to implement ajax on comment submission and now members don't have to leave the page when they comment but still have to go one extra mile when they want to see new comments. I've looked around the web before asking this question and I didnt find any real info about doing this. Anyone has any ideas or maybe already did it? Right.. I need something like this :                    $numComments = wp_count_comments('comments');           $numComments = $numComments->publish;              // Posts per page         $per_page = 50;              // Determine total amount of pages         $total_comments = ceil($numComments / $per_page);              // Get current page         $paged      = (get_query_var( 'page' )) ? get_query_var( 'page' ) : 1;              // Above your loop         $ignores = array();              // If we have sent ignore ID's         if ( $_GET['ignore] )        {            $get_ignores = trim($_GET['ignore'], ',');            $get_ignores = explode(',', $get_ignores);        }             // If we have ignore ID's         if ( !empty($get_ignores) )         {             foreach ($get_ignores AS $k => $v)             {                 $ignores[] = $v;             }         }              $count = 1;              $my_args = array(             'per_page' => '50'             'paged'  => get_query_var( 'page' ),             'comment__not_in'   => $ignores,             'comment_status'    => 'publish'         );                                                $my_query   = new wp_list_comments($my_args);              if ( $paged <= $total_pages):             $paged = $paged + 1;                       while ( $my_query->have_posts() ): $my_query->the_post();                 // At the start of the loop populate the used post ID's                 $ignores[] = $comments->ID;     ?>     <?php $count++; endwhile; endif; ?>     <?php              if ( $ignores AND is_array($ignores) )         {             // Create a comma separated string of ignore ID's             foreach ( $ignores AS $k => $v ) {                 $ignore_str .= $v.',';             }                  // Trim the ignore string of any rogue commas             $ignore_str = ltrim($ignore_str, ',');             $ignore_str = rtrim($ignore_str, ',');                  $ignore = site_url('page/'.$paged.'/?ignore='.$ignore_str.'');         }          ?>           <a href="#" rel="<?php echo $ignore; ?>" id="load-more">Load New Comments           <?php if ( !$my_query->have_posts() ) : ?>           <?php endif; ?>                   This is just something Im trying to modify to suit my own needs.


title: Would like to be able to take list of pages, and place them into an array

text: Well...title says it, but here are the details. I would like to take a list of all of the active wordpress pages on my site, and place them into a list. This list is generated by an array (it uses Options Framework Multi-check-boxes The way that the option code looks when I create it:               $options[] = array(     'name' => __('What Pages to Include?'),     'class' => 'inner_section_header',     'id' => 'select_pages_to_display',     'options' => array('option1' , 'option2' , 'option3'),     'std' => '',     'type' => 'multicheck');      * * *               'options' => array(),       That is where I am attempting to put the list of pages, so that it will generate a list of checkboxes with each active page. I have tried both `get_pages();` and `wp_listpages();` but both have left me pulling my hair out -- Roughly 4 hours of it last night with no luck. Would anyone be able to guide me in the right direction as to how I would solve this? How the attempt went with wp_list_pages() I attempted to store the output of wp_list_pages() in a variable. I thought that the following would do so               $pages_list = wp_list_pages($args);      Unfortunately all this did was output the list of pages at the beginning of my page, even though it or the variable was never echo'd. so I moved onto get_pages() How the attempt went with "get_pages" I attempted to store them in a variable as before, this time with better luck.                   $pages = get_pages($args);          foreach ( $pages as $page ) {             $option = "'";             $option .= $page->post_title;             $option .="' ," ;             $page_list .= $option;              }         $options[] = array(                 'name' => __('What Pages to Include?'),             'class' => 'inner_section_header',             'id' => 'select_pages_to_display',             'options' => array($page_list),             'std' => '',             'type' => 'multicheck');      At this point I thought I almost had it because this outputted a single checkbox with the option: 'Contact' ,'Home' ,'Portfolio' ,'Services' , Was almost there...just need those to be displaying as separate checkboxes instead of one checkbox. After that, I began trying different formatting combinations (using substr to remove that last comma to see if it was a formatting issue...but I got it to the point where it looked exactly as it would if I were to manually type out each option which I thought would have made the array act like the equivalent of this:               'options' => array('Contact', 'Home', 'Portfolio', 'Services'),      but apparently I am missing something. If anyone needs more details, I'll be happy to provide. Thanks in advance * * * ## EDIT: it has been solved (leaving the details above, and posting the answer below, in case it solves someone else's problem in the future) Wordpress.org support forums yielded the solution!               $pages = get_pages();          if ( $pages ) {         $prop = 'post_title';         $pages = wp_list_pluck( $pages, $prop );              $options[] = array(             'name'    => __( 'What Pages to Include?' ),             'class'   => 'inner_section_header',             'id'      => 'select_pages_to_display',             'options' => $pages,             'std'     => '',             'type'    => 'multicheck' );     }     If you need the post slugs use:     $prop = 'post_name';     Post IDs:     $prop = 'ID';      Tested it out, and it worked perfectly. **Credit goes to Mod keesiemeijer** @Wordpress.org


title: Is the '/category/post-name-date/' permalink structure okay?

text: > **Wordpress Codex says:** Make sure to end your structure with either > `%post_id%` or `%postname%` (e.g. `/%year%/%monthnum%/%day%/%postname%/`) so > that each permalink points to an individual post. But I would like to set my website's permalink structure (to suite the Google News URL guidelines) like this: `/%category%/%postname%-%year%%monthnum%%day%/` So, an example URL would look like this:   _http://example.com/internet/hello-world-20120322/_ But this permalink structure appears to be against the quote from WP codex. Do you see any problems with my custom permalink structure? Please advise.


title: Rewrite-Rules not working on a vhost, everything goes to index.php

text: after setting up the wordpress htaccess rules in my vhost, i was unable to enter the wp-admin area. I was always redirected to the frontpage of my wordpress instance. The rewriting itself worked on the mainpage. All links worked so far, but the admin area remains without any access. Rewrite rules used:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      Personally i dont know where to start looking, im even unable to find that problem over google, which is kinda rare - maybe someone over here knows where the problem is to be located.


title: How to get current menu item "CSS Classes" value?

text: While on any given link that has a CSS Classes value, I'd like to do something like this:               $css_classes = get_current_menu_item_css_classes();         if ( $css_classes == 'mycustomclass' ) : // do something      Thanks ![enter image description here](http://i.stack.imgur.com/D45LE.png)


title: Drop Down menu expanded by default (on front page)

text: For this site users seem to have difficulty finding the site's content that is accessible through the 'Data' drop down menu on the top left. To improve this I would like to have this drop down menu expanded by default – but only on the front page. By this older (not WordPress related) StackExchange question (that is including a JSFiddle) and some other comments I have learned that I should use jQuery. I tried my best but I have not been able to get it working at all on my site. What are the CSS elements on my site that I have to address in the JQuery code? And where should I put this code? Would somebody be able to help me? **Edit:** Thank you very much user49916! This works! The problem that I encountered was that the second level children were also expanded by default. To hide them and then only show them on hover I added this:               /*Make the drop down menu expanded by default – on the front page*/         .home ul#menu-all-descendants-as-submenus li ul {             left: 0;         }              /*Make the drop down menu expanded by default and hide the sub-children – on the front page*/             .home ul#menu-all-descendants-as-submenus.menu li ul ul {                 left: -999em;             }         /*Make the drop down menu expanded by default and show the sub-children on hover of menu – on the front page*/                  .home ul#menu-all-descendants-as-submenus.menu li ul li:hover>ul {                 left: 0;             }


title: Using global $post; to get featured image for custom post via WP_Query

text: I'm using a site-wide function to add css to the `<head>` of the page pull in featured images of various as a responsive page background. It works great across the rest of my site but fails on a page where I'm calling posts from a custom post type using `WP_Query`. I think this is because `WP_Query` doesn't use the standard loop, and my function uses `global $post;`. Is there a way to adapt the `WP_Query` loop to work with the function? I need the featured image function to also work on the rest of my site, which uses the standard WP loop. \-- Here's how I'm calling the custom posts:               <?php $port_query = new WP_Query( array(         'post_type' => 'portfolio',         'posts_per_page' => 1,         'orderby' => 'rand'     ) );      if ( $port_query->have_posts() ): while ( $port_query->have_posts() ) : $port_query->the_post(); ?>         <div class="page-bkg responsive-bkg">             // page content here         </div>     <?php endwhile; wp_reset_postdata(); endif;      And the function to call responsive featured images, from functions.php:               function bkg_featured_image() {          // call the global post variable     global $post;          if ( has_post_thumbnail( $post->ID ) ) : // checks whether the post has the featured image set          // get the post thumbnail ID for the page or post     $post_thumbnail_id = get_post_thumbnail_id( $post->ID );          // store the image sizes in an array. You can also add your own image sizes with the add_image_size function     $img_sizes = array( 'thumbnail', 'medium', 'large', 'full', 'thumb480', 'thumb768', 'thumb1280', 'thumb1680', 'thumb2048' );          // grab the URL for each image size and store in a variable     foreach ( $img_sizes as $img_size ) {         ${ 'img_src_' . $img_size } = wp_get_attachment_image_src( $post_thumbnail_id, $img_size );     }          echo '<style type="text/css">               .responsive-bkg {             background-image: url(' . esc_url( $img_src_thumb768[0] ) . ');         }              @media screen and ( min-width: 768px ) {             .responsive-bkg {                 background-image: url(' . esc_url( $img_src_thumb1280[0] ) . ');             }         }              @media screen and ( min-width: 1281px ) {             .responsive-bkg {                 background-image: url(' . esc_url( $img_src_thumb2048[0] ) . ');             }         }          </style>';             endif; // end if the featured image is set          } // end function my_featured_image          add_action( 'wp_head', 'bkg_featured_image' );          // (this function borrowed from http://s2webpress.com/responsive-featured-image-function-in-wordpress-themes/)