title: adding a text message beside the comment submit button

text: What is the cleanest way to display a text message beside the submit button like this in screen shot: ![example of what I am talking about](http://i.stack.imgur.com/ybV6Y.png) I am currently doing it by editing the file `wp-includes/comment-template` line `1577` (wordpress 3.5) before:               <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>"      value="<?php echo esc_attr( $args['label_submit'] ); ?>" />       after:               <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>"      value="<?php echo esc_attr( $args['label_submit'] ); ?>" />      (your message will only be visible after moderation)      I understand this is not the optimal way to do it, but what is the way to do it. I prefer as a plugin, but editing a theme would be fine.


title: query_posts exclude a meta key

text: <?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC', 'meta_key' => featured_product, 'meta_value' => 1)); ?>               <?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC')); ?>      I have 2 queries, first to show meta key with featured_product eq 1. So I want to exclude all the featured products on the second query. How can i do that please? Thanks!


title: Under Theme folder, what's sequence of action for index.php, page.php, single.php?

text: INdex.php, page.php and single.php all three files under the theme folder have the Loop to check for posts. Which one get execute first, and the next? What's sequence for Wordpress to read those files?


title: Get video from the post on homepage

text: I have embedded videos in the post (from youtube and other websites). Is it possible to get only the embedded video from the post and display on the homepage? There is some text before the video in the post, I do not want to display the text or anything else from the post, but only want to get the video. How that can be done? Thanks.


title: Display content from a specific category

text:
I'm trying to get my news page to display content from one category only (number 3) but I cant seem to get it to work. Instead of just displaying posts from category 3 it displays posts from all category's. Here is my code:               <?php get_header(); ?>

Latest News
                                      <?php $args = array(                                 'post_type' => 'post' ,                                 'orderby' => 'date' ,                                 'order' => 'DESC' ,                                 'posts_per_page' => 6,                                 'category'         => '3',                                 'paged' => get_query_var('paged'),                                 'post_parent' => $parent                            ); ?>                            <?php query_posts($args); ?>                                                <?php if ( have_posts() ) : ?>                                 <?php while ( have_posts() ) : the_post(); ?>

                                         <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?>                                              <a href="<?php the_permalink() ?>">
<?php the_title(); ?>
                                         <?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>" class="readmore_news">Read more

                                      <?php endwhile; ?>                             <?php endif; ?>

          <?php get_footer(); ?>


title: How to customize the wp-signup.php for a multisite network?

text: I googled about customizing `wp-signup.php` but found no luck. Here's what I need:   1. User will register.   2. During registration process, user will pay first (like paypal or credit card).   3. Create subdomain when user successfully paid. My problem is: How can I add a payment field in `wp-signup.php`? I am really new to wordpress. Any guide or link is a big help to me. Registration form something like this:   * username   * email address   * gimme a site   * payment   * …   * register button


title: Changing the pagination URL format

text: Currently when I use the `next_posts_link` and `previous_posts_link` functions I get a URL returned such as `/posts/page/2`. However, is it possible to make Wordpress work with a pagination URL format such as `/posts?page=2` instead?


title: Is it bad to store many files in a single folder?

text: I upload thousands of images and it stored in a single folder. Is it bad if too many images are in a single folder? would that slow down the loading of the image even though you're viewing an attachment image which has a path defined?


title: Bridging TinyMCE js and Wordpress PHP?

text: I'm updating my wordpress plugin to use a custom TinyMCE button. From inside the TinyMCE button javascript, I'd like to interact with wordpress data--ie set custom post options inside the plugin setting page, then access those values inside the TinyMCE js script. Can I invoke my php plugin functions from inside the TinyMCE button handler code (which is javascript)? Is there a bridge I can use? For Clarification: As part of my plugin installation process, users are instructed to go to the Plugin settings page, and input some data. This data is normally stored and read using Wordpress Plugin API hooks: `get_option` and `set_option` This is part of my original plugin and works fine. I am now adding a TinyMCE button, and when I click it, an HTML page is shown, that has an html `textarea`. This part also works fine. However, I'd like to Fill the `textarea` with data via the `get_option` Wordpress Plugin call, but I can't figure out how to access the API. Another acceptable solution would be to pass that data into the TinyMCE script, and injest it that way. Or to have the TinyMCE button script invoke a method in my PHP plugin script that reads and returns that data back into the TinyMCE button script.


title: change precedence of permalink for post_types?

text: I have a series of pages with the heirarchy: ` /albums /name1 /name2 /name3   ` ie. all these pages have a parent page with the slug 'albums'. If I have a permalink /name2 it shows the page /albums/name2. I didn't need to fully express the link as /albums/album2 I also have a post_type called 'songs' which is not hidden, but would be far less often visited. ` /songs/name1 /songs/name2 /songs/name3 ` So there are Pages and 'Songs' with the same slug. In the past, simply typing mysite.com/name2 would bring up the -Page- (ie. /albums/name2), not the Song. This has changed. Now, if I type: mysite.com/name2 into the browser, /songs/name2 appears. So the precedence of 'Songs' appears now to be higher in the redirection 'hierarchy'. How can I change it back to the way it was... ie. when a visitor types: mysite.com/name2 into the browser, the -Page- /albums/name2 appears? I have experimented with all number of values for the Rewrite array to no avail for the simple reason that it's not the permalink that is the issue, it is the fact that in the WP_Rewrite Rules, the 'Songs' post_type is processed -first- for some reason, so if there are two posts with the same slug, one 'Page' and the other 'Song', the Song will be rendered. I have been working around this by simply setting the Public property for 'Songs' to false, but that's no long term solution. Help!


title: Save post_parent in a custom post type

text: I'm using the save_post action to save some meta data in a custom post type:               function my_save_post($post_id) {         // is autosave?         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              // verify nonce         if ( !wp_verify_nonce( $_POST['metabox_nonce'], basename(__FILE__) )) {             return $post_id;         }              if ('book' == $_POST['post_type']) {             $post_parent = intval($_POST['post_parent']);             $author = $_POST['author'];             $price = intval($_POST['price']);             update_post_meta($post_id, 'author', $author);             update_post_meta($post_id, 'price', $price);                  //TODO: add function to update the post_parent field         }     }      My question is, how can I modify the custom post type's post_parent field? As I understand, I can't use the update_post_meta() function because the post_parent field is not a meta field. Am I right? Any help would be appreciated


title: How to display custom taxonomies with links in filter menu?

text:
Since two days I am trying to solve a problem with custom taxonomies (categories). I have a Custom Post Type called 'Portfolio' and it works as expected but a problem is with my hierarchical taxonomy that I have registered. I gave it a name: 'galleries'. Instead of displaying custom taxonomies it simply shows default categories from my blog. I found some similar problems on here but I realy don't know how to adopt other's solutions into my case. I am quite new to wordpress unfortunately. Can someone help me? This is the code from my loop.php which is the template of my custom post type (this is my home page):
     Filter

All
         <?php $args=array('orderby' => 'name');         $galleries=get_categories($args);         foreach($galleries as $gallery){ ?>
<a href="#<?php echo $gallery->gallery_nicename; ?>" class="<?php echo $gallery->gallery_nicename; ?>"><?php echo $gallery->name; ?>
         <?php } ?>

      Here is the code from my function.php:               add_action('init', 'portfolio_register');     function portfolio_register() {          $labels = array(             'name' => _x('My Portfolio', 'post type general name'),             'singular_name' => _x('Portfolio Item', 'post type singular name'),             'add_new' => _x('Add New', 'portfolio item'),             'add_new_item' => __('Add New Portfolio Item'),             'edit_item' => __('Edit Portfolio Item'),             'new_item' => __('New Portfolio Item'),             'view_item' => __('View Portfolio Item'),             'search_items' => __('Search Portfolio'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/images/portfolio-icon.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','author','thumbnail','comments')           );          register_post_type( 'portfolio' , $args );         flush_rewrite_rules();     }     // Custom taxonomy for Portfolio Categories (Galleries)     register_taxonomy('galleries', array('portfolio'), array('hierarchical' => true, 'label' => 'Galleries', 'singular_label' => 'Gallery', 'rewrite' => true, 'public' => true ));      Thanks in advance!


title: Using permalinks, category slugs, and tag slugs

text: I'm trying to set up some permalinks for my site. Right now all the posts are under sitename.com/blog/, which is fine. But the category pages and tag pages show as 'sitename.com/blog/category/catname' and 'sitename.com/blog/tag/tagname'. Is there a way to just skip the 'category' and 'tag' parts of the URL? As in: 'sitename.com/blog/catname' 'sitename.com/blog/tagname' I tried leaving the optional settings (Settings --> Permalinks --> Optional) as blank for 'Category base' and 'Tag base', but they default to 'category' and 'tag', which brings me back to my previous problem. I then tried putting 'blog' instead. It works for the categories and tags, but it then makes all the posts redirect to a 404 page. It's as if it searches for a category/tag with the name of [postname] and on failing to find one, 404s me. Anyone having this trouble / found a workaround for this?


title: How to set Media Box form elements default value?

text: I am developing a plugin to customize wordpress administration. Creating / Editing an article, when i user insert an image from media library or uploading it, i want to clear the image title, as default is set as image file name, and i want to set Big as image size. I am looking for the hook to work on it, i tried by using jquery but i guess the view button load the content in ajax.               add_action('admin_head-media-upload-popup','set_form_fields');          function set_form_fields() {         echo"<script type=\"text/javascript\">         jQuery(document).ready( function($) {             alert('ciao');             jQuery('tr.post-title td.field input').attr('value','');         });         </script>";     }      i am looking for how to set image post title='' and big radio button to "checked"


title: Front-end editing with custom fields?

text: I use the custom field plugin http://www.advancedcustomfields.com Is it possible to create and edit custom posts via the front end? I'd need to be able to see all the custom fields and allow those to be edited as well. Users should only be allowed to edit their own posts if they are logged in.


title: Add Class to Specific Paragraph of the_content()

text: Let's say I want to give the first paragraph bold text by adding a body class to the first paragraph. Is there a way to filter the output of               the_content();      or any other paragraph? First paragraph? Last paragraph? I know I can do this using Javascript or CSS (:firstchild), but is there a native WordPress way? Thanks. J


title: WordPress custom URL Rewrites redirecting not masking

text: I have the following code that exists in a plugin that is meant to take a request to the url `/stores/directory/foorbar/` and pass `foobar` as a GET variable:               function pcrr_rewrite_rules($a) {         $k = array('stores/directory/([^/]+)/?$' => 'index.php?pagename=directory&pod_store_id=$matches[1]');         return $k + $a;     }     add_filter('rewrite_rules_array', 'pcrr_rewrite_rules');          # Flush existing rules and rewrite     function pcrr_activate() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     register_activation_hook(__FILE__, 'pcrr_activate');      The expected behaviour would be any requests to `/stores/directory/foobar/` would instead load `index.php?...`, however, whilst requests are being handled, they are redirecting to the URL, instead of masking it. For example, a request to `/stores/directory/foobar/` is redirected to `/stores/directory/`. Any ideas on how I can correct this behaviour? Cheers!


title: Is it possible to override the result of get_template_part()?

text: I'm working on a child theme, I strongly prefer not to override the main template files in order to maintain simplicity of the child theme as well as minimize the amount of code and maintenance over time. In the loop, the index.php template in parent theme uses: `get_template_part( 'content' );` which will bring in _content.php_ , I'm looking to have it behave more like `get_template_part( 'content', get_post_format() );` or similar in order to bring in different templates such as _content-aside.php_ , etc, without creating an _index.php_ in the child theme to overwrite the parent for a single line change. `get_template_part()` consists of:               function get_template_part( $slug, $name = null ) {              do_action( "get_template_part_{$slug}", $slug, $name );         $templates = array();         $name = (string) $name;         if ( '' !== $name )             $templates[] = "{$slug}-{$name}.php";              $templates[] = "{$slug}.php";         locate_template($templates, true, false);     }      So there's an action available, in my case called `get_template_part_content` I can hook onto the action with something like:               add_action( 'get_template_part_content', 'child_post_styles', 10, 2 );          function child_post_styles ( $slug, $name ) {         if( false == $name ){             $name = get_post_format();             $templates = array();             if ( '' !== $name )                 $templates[] = "{$slug}-{$name}.php";                  $templates[] = "{$slug}.php";             locate_template($templates, true, false);         }     }      This obviously results in post duplication, one from my hooked function, which can display the desired template, and the other from the normal `locate_template` call in `get_template_part()` I'm having trouble finding a way to accomplish this without duplication, or without ending page render right after serving my template part by doing something stupid such as a `break` or `exit`


title: how to ask if in two categorys inside if

text: I'm new two wordpress so sorry in advance if this question might be very basic. Depending on which category a post is, I do some script things and I ask inside the loop in this way:               <?php if (has_category('category_1')):?>        // do some stuff     <? endif; ?>      this works pretty fine. But how can I ask for if post has two specific categories like:               <?php if (has_category('category_1') && has_category('category_2'):?>       // do some stuff     <? endif; ?>      this does not seem to work. What am I doing wrong?


title: How do I prevent the wp_editor from loading outside container?

text: I'm trying to load the wp_editor on a settings page:               <?php                                      //$content = $value->playerBio;                                 $editor_id = 'listingIntro';                                 $textareaname = "listingIntro";                                 $settings = array("textarea_name" => $textareaname);                                      wp_editor( $content, $editor_id, $settings);                                  ?>      the editor is loading outside the table. Can I force it to load inside the table?


title: Multiple Websites that share some content types and not others

text: I need to know if Wordpress can handle multiple sites. **And between these sites, it should share some content types while restricting others**. If the answer is yes, then I need to know:   1. does it do it out of the box   2. what plugins will i need   3. do i need to build my own plugins   4. do i need to modify the core code (and hence, break forwards upgrade/compatibility) So here's what I need: I need to create several websites for one company that has multiple offices around the world. Each website will have their own domain name like http://toronto.website.com, http://newyork.website.com, http://dubai.website.com etc.. These sites will all be in English. I will only have 1 set of html css files that all these websites will use. The difference between all these sites will be content. Some content-types will be shared between these sites, while others will not. For simplicity sake, there are 2 content-types: **Page** \- A page is your traditional wordpress page or post. They will be used to create Home Page, About Us, History, Contact Us, Terms of Service etc... Pages **ARE NOT SHARED** between the different websites. So if http://toronto.website.com has a History page, that doesn't mean http://newyork.website.com must have a history page...and even if they do, it can be completely different content. **Projects** \- A project will have fields like title, description, author, film director, camera man, location etc... Projects **ARE SHARED** between different sites. So a person on the http://toronto.website.com website can see the same set of project information as http://newyork.website.com. So to re-iterate, my biggest concern is the ability to share project content- types between sites while not sharing page content-types.


title: Keeps on redirecting on my development copy

text: I'm working on some edits for a client's site. So I downloaded the site's files and exported the database. I need to make some big changes on a development machine first so I won't mess with the live site. Then I imported the database to my development machine and setup the files as well. But whenever I go to http://localhost it redirects me to the client's site: https://theclientsite.com So since it redirects me to a https address I'm thinking it probably has something to do with that. I did a global search on the code for the client's domain, but I don't see anything that redirects. What could be the source of the redirecting? If the site doesn't stop redirecting, I can't work.


title: A Post is saved twice or more during add_action(save_post)

text: I have added a custom meta box for advanced information for a specific post category, to my create new post page. Now I recognize, that if I save the post, it writes 2 entries in the db with 2 post_ids.               add_action( 'add_meta_boxes', 'my-plugin_add_custom_box' );     add_action( 'save_post', 'my-plugin_save_postdata' );          my-plugin     function my-plugin_add_custom_box() {         add_meta_box(              'my-plugin_sectionid',             __( 'my-plugin', 'my-plugin_textdomain' ),             'my-plugin_inner_custom_box',             'post'          );     }          /* When the post is saved, saves our custom data */     function my-plugin_save_postdata( $post_id ) {       // verify if this is an auto save routine.        // If it is our form has not been submitted, so we dont want to do anything       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )            return;            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( $_POST['my-plugin_noncename'], plugin_basename( __FILE__ ) ) )           return;                 // Check permissions       if ( 'page' == $_POST['post_type'] ) //is this the correct post_type?       {         if ( !current_user_can( 'edit_page', $post_id ) )             return;       }       else       {         if ( !current_user_can( 'edit_post', $post_id ) )             return;       }            // OK, we're authenticated: we need to find and save the data              //$mydata = $_REQUEST['sports'];         print($post_id); //prints two post ids e.g. 831 & 832         //print($mydata); //prints two times content of $mydata     }      Why are two records in the tables `wp_posts` are created? And when I update the post, a new record is created with `post_name` post_id-revision (843-revision). What are the advantages for creating a new post type, like _sports_ for such kind of posts? My advanced information like `$_REQUEST['sports'];` are planned to be stored in a separate db with a ref to wp_posts. Thanks in advance & BR, mybecks


title: Filter wp_nav_menu()

text: I try to split my navigation into 3 single navigation bars (level 1, level 2 and level3+). Three because they're separated over the site and they should only appear depending on the current page.               -0-------1--------2-------3+- level/depth     Home      |      |\___ Lobby      |      |\___ Projects      |       |\___ Project A      |       |       |\___ Review      |       |       |\___ Comments      |       |       \____ Download      |       \____ Project B      |               |\___ Review      |               |\___ Comments      |               \____ Download      |\___ Blog      |      \____ About              |\___ Legal              \____ Contact      The first navbar containing the level 1 is always visible. The second navbar (level 2) only when im currently on the corresponding parent page. The same goes for the third navbar (level 3+, plus because this navbar will also contain sub pages and subsub pages ... of level 3). In short: I want to display all the parent menus in their navbars and only the direct children of the current page. What I tried:               function my_nav_menu( $args = array() )     {         $echo = isset( $args['echo'] ) ? (bool)( $args['echo'] ) : true;         $args['echo'] = false;              add_filter( 'wp_get_nav_menu_items' , 'my_nav_menu_filter' , 666 , 3 );              $menu = wp_nav_menu( $args );              remove_filter( 'wp_nav_menu_objects' , 'my_nav_menu_filter' , 666 );              if( $echo )             echo $menu;         else             return $menu;     }          function my_nav_menu_filter( $items , $menu , $args )     {         //var_dump( $args );              $navLevel = isset( $args['navlevel'] ) ? (int)( $args['navlevel'] ) : 0;              //echo 'navlevel = ' . $args['navlevel'] . ' | ' . $navLevel;              if( $navLevel == 1 )         {             foreach( $items as $key => $item )             {                 if( $item->menu_item_parent != 0 )                     unset( $items[$key] );             }         }         else if( $navLevel == 2 )         {             foreach( $items as $key => $item )             {                 if( $item->menu_item_parent != 0 )                 {                     $page = get_page( $item->menu_item_parent );                          if( $page->menu_item_parent == 0 )                         continue;                 }                      unset( $items[$key] );             }         }         else if( $navLevel == 3 )         {             foreach( $items as $key => $item )             {                 if( $item->menu_item_parent != 0 )                 {                     $page = get_page( $item->menu_item_parent );                          if( $page->menu_item_parent != 0 )                         continue;                 }                      unset( $items[$key] );             }         }         else         {             //var_dump( $items );         }              return $items;     }      Calling this in my header.php: `<?php my_nav_menu( array( 'echo' => false , 'navlevel' => 1 ) ); ?>` However `$args` is set to the default values and my custom entry `navlevel` isnt shown in the filter. How can I split my navbar as described? How do I set my custom `$args`-entry?


title: add span to wp_nav_menu widget

text:
Am using the custom menu widget to add a menu in the footer and i want to add a in the menu how can i do this ? like so...
menu1
       if done it for the main nav using the link before below but as this is a widget am not sure where to add this               'link_before' => '',     'link_after' => ''      any one know ?


title: WPML - how to translate user profile fields with icl_t()?

text:
Existing code somewhere in a template or shortcode handler, display user profile biography:               <?php if ( $user ) : $bio = get_the_author_meta( 'description',  $user->ID ); ?>
         <?php echo $bio; ?>
      How do I get these biographies to show up in WPML String Translation. This is not making it happen:               $bio = icl_t( 'theme', 'bio-' . $nimi, get_the_author_meta( 'description',  $user->ID ) );      This help page isn't particularly helpful to me, at least I cannot figure out how to apply it to this situation. This problem-specific thread is also quite vague on how exactly icl_t() is supposed to be used.


title: How to modify wp_ajax function?

text: I want to modify wp_ajax_find_posts function. It receives search string from find-posts form and delivers search results by ajax. Part of the function looks like this:               function wp_ajax_find_posts() {         global $wpdb;         check_ajax_referer( 'find-posts' );              // ........         $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";         $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" );              $html = //......              $x = new WP_Ajax_Response();         $x->add( array(             'what' => $what,             'data' => $html         ));         $x->send();     }     add_action( 'wp_ajax_find_posts', 'wp_ajax_find_posts,1)      I want to modify the line $post to add post_author to the querry in order to limit the results within current loggin user. I would like to learn how to hook up with this wp_ajax_find_post function to let it accept my modified $post. Do I have to do remove_action and add_action to make completely rewrite of the above funtion?


title: WordPress Widgets no drop down

text: i gave my editor role an access to my Widget settings. But i wonder why it is different when an admin access it. It has no drop down. see the attachment: http://i.stack.imgur.com/Rv3g3.png Thanks Ivan


title: Nested calls the the_content filter

text: I'm writing a plugin that adds some custom content near the end of a post (or page). So I've added a filter for 'the_content', and the plugin adds its content there. Mostly, it works. However, some sites show the entire content of several posts on the homepage (rather than just excerpts). On those sites, my filter is being called once for every post that is displayed. So the custom content shows up more than once. Is there some way for me to detect when my filter is a nested call? I.e. that it is being called for the content of a post which is being displayed on the homepage. I could then add my custom content only when it is a "top level" call. I also considered attaching my filter to the footer instead of the content, but I've run across themes that don't have a footer. Thanks! Ken


title: What's the most efficient database method to add and query usermeta?

text: What's the most efficient way - concerning the database - to add and query extra usermeta fields to a profile? I need to add four additional fields of numeric and text data to a user profile and then query that to compile the data for display in a template. And there are potentially thousands of users. There are lots of examples to store the data in usermeta. But should this amount of data be stored in the usermeta table? Or should I store it all in a new database table? And if so, how do I initialize a new table and then write to it?


title: How to organise post by category and date

text: I'll try to be as clear as possible. I'm working on a project that requires posts organised by category and date. I need something like this: First step: Annual listing of archive 2014: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 2013 2012 2011 2010... Second step: by clicking on a year link, you are directed to another page where the category and subcategories for the related month are listed. Music (January 2014) Rock “The History of AC/DC” Hip Hop “What Ever Happened to Bell Biv Devoe?” Pop Bruce Springsteen – High Hopes Pharrell Williams   Other David Bowie's The Next Day U2 The subcategories can be use each month or new one can be created and used only once. The main category (Music) will have no post. I can have (second step) post from categories and subcategories work using the code on this page http://www.cssreflex.com/snippets/list-wordpress-posts- category/ But it's not limited to a specific month or year. Thank you for helping me or ponting me to the right direction to solve my issue.


title: Can we validate user email changes?

text: I am having difficulty understanding why user security and validation is so vague in WP (4.0).. Surely email verification should come as default? Anyway I have been trying to find a solution to user security. All I can seem to find are plugins that send email validation links on registration. This is great, however a user can the log in and just change the email to foo@par.com no questions asked. Either a) I now have an unverified user; or b) Someone has just hijacked the account. Surely I am missing something here, these features predate WordPress so there must be a solution?


title: add text to the top of category page

text: I want to add the text to top of each category page. I am using a plugin **http://wordpress.org/extend/plugins/categorycustomfields/** . With the help of this plugin, i am able to add extra field to my categories, but how can i display that. eg :- if i want to display category description, i used `<?php echo category_description(); ?>` similarly, how can i display custom field value.


title: Multisite: Redirect to appropriate domain if subdomain doesn't exist

text: I have a multisite with domains: site1.com, site2.com, site3.com, etc. where site.com is the "home domain" of the multisite. As of now there is two issues I am trying to solve at the same time. If I try example.site2.com (a subdomain that does not exist) it will redirect to site1.com/wp-signup.php (and i have registration disabled). I tried to fix this with http://wordpress.stackexchange.com/a/85530/35677, with mine being:               function prevent_multisite_signup()      {         wp_redirect(site_url(), 301);         exit;     }     add_action('signup_header', 'prevent_multisite_signup');      Of course this does do partially what I want which is to redirect to the homepage with a 301, however it is site1.com and not site2.com. Is there a way to adjust this code to always direct to its parent domain? I even tried getting the blog_id first, then get that url and pass it, but by the time this function is called the blog id is for site1.com. The ideal answer would be in code versus something like .htaccess.


title: Stop WordPress automatically adding <br> tags to post content

text: Is there a way to stop WordPress from automatically inserting `<br>` tags when adding returns in the WordPress text editor. I would like for it to behave more like a code editor where I can structure the code how I like and make it easy to read. The code I am using in the editor is:               [one_third][team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"][custom_button url="#"]For more information[/custom_button][/team_member][/one_third][one_third][team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"][custom_button url="#"]For more information[/custom_button][/team_member][/one_third][one_third][team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"][custom_button url="#"]For more information[/custom_button][/team_member][/one_third]      I would like to structure it like this so it is easier to read and edit:               [one_third]     [team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"]     [custom_button url="#"]For more information[/custom_button]     [/team_member]     [/one_third]          [one_third]     [team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"]     [custom_button url="#"]For more information[/custom_button]     [/team_member]     [/one_third]          [one_third]     [team_member image_url="team_member.jpg" name="Laser vision" role="WordPress Designer"]     [custom_button url="#"]For more information[/custom_button]     [/team_member]     [/one_third]      However, when do this there will be invisible `<br>` tags added to the post content which will mess up the layout of my page.


title: terms_description and admin problem

text: Hey hi, I am using a piece of code, where with help of it I can display the description of the term to my archives page. My idea of doing this is simple, I have MBA website and I have 3 custom-taxonomies with 1000's of terms in each, for-eg:- I have a term mba-in-accounts, so its description will be displayed on the archive page of mba-in-accounts, But now the main problem is, this description comes well, but it is just displayed to logged in users I want to make it display to all users who visits my website, I am using this code to display                <?php                      if ( is_tax( 'location' ) ) {                         echo term_description();                     }                     elseif (is_tax('mba_courses')){                         echo term_description();                     }                     elseif (is_tax('duration')){                         echo term_description();                     }                          ?>      How can I make it display to all users, and I am also using allow-html-in- category-descriptions plugin to enable HTML in description box


title: Plugin Needed (User Register - have own profile)

text: I am looking for a wordpress plugin where when the user registers it creates their own profile where the user will have their own personal area. Can anyone point to any? Thanks Update: OK, I've try to explain further. I am writting a web application which I need to plug into wordpress. Visitors who are not logged in can use the app ... then if the user likes the application and what he/she has created, then they can register and save it and pay a monthly fee for using it. Hope this helps.


title: Using get_terms() as shortcode attribute

text: Hop you pepople would be fine. I'm creating a shortcode with the following code.               $categories = get_terms( 'project-type' );          foreach ($categories as $category) {              $portfolio_terms[$category->slug] = $category->name;          }          $ABdevDND_shortcodes['portfolio_DD'] = array(         'attributes' => array(             'category' => array(                 'default' => 'all',                 'type' => 'select',                 'values' => $portfolio_terms,                 'description' => __('Category', 'dnd-shortcodes'),             ),                   'style' => array(                 'default' => 'classic_gallery',                 'type' => 'select',                 'values' => array(                      'classic_gallery' => 'Classic Style',                     'alternative_gallery' => 'Alternative Style',                 ),                 'description' => __('Style', 'dnd-shortcodes'),             ),              ),         'description' => __('Portfolio', 'dnd-shortcodes' )     );     function ABdevDND_portfolio_DD_shortcode( $attributes, $content = null ) {         extract(shortcode_atts(ABdevDND_extract_attributes('portfolio_DD'), $attributes));              ob_start();           get_template_part( 'lib/blocks/portfolio', 'index' );           $return = ob_get_contents();           ob_end_clean();           return $return;               }      shortcode is working just fine, but the only issue is i'm unable to populate taxonomy array values from $portfolio_terms variable. It outputs nothing. The question is, how i populate category attribute with all avaiable terms of 'project-type' with slug as key and name as value?


title: Removing the TinyMCE editor for a given page template

text: I was looking for a way to remove the TinyMCE Editor for a specific page template in a theme (in my case it's page-home.php). I found the following code, which works, however, I was wondering if this could be accomplished in a better/neater way, perhaps using some of WordPress' built-in functions for finding the ID of the page...               function hide_editor() {         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;         if( !isset( $post_id ) ) return;         $template_file = get_post_meta($post_id, '_wp_page_template', true);         if($template_file == 'page-home.php'){ // template name here             remove_post_type_support('page', 'editor');         }     }     add_action( 'admin_init', 'hide_editor' );


title: Trying to create a custom column for a custom post type

text: I'm trying to create a custom column for my custom post type and I'm having no luck. Below is the code I'm using, I have a similar code that pulls the featured thumbnail and that works for all post types, but this column will only show up on the custom post type. Any help would be appreciated.               add_filter("manage_Featured_columns", "edit_Featured_columns" );     add_action("manage_Featured_column", "custom_Featured_columns");     function custom_Featured_columns($Featured_column) {         global $post;         switch ($Featured_column) {             case "redirect_url":                     if(get_post_meta($post->ID, 'redirect_url', true) !='') {                         echo get_post_meta($post->ID, 'redirect_url', true);                     } else { echo '-'; }          } }      That is the code I have so far, but it's not showing up on the Featured custom post type. The name I'm using in my custom post type is: register_post_type( 'Featured', Thanks


title: Next Page Link shows same posts on custom template

text: I have a Page, with Custom Page Template to display 6 "Posts" with a specific category on that page. The Code that i have used can be found here: http://pastebin.com/E52u0TTi Also, i have tried: But Both show same posts and not other posts, however the URL changes to page/1/ page/2 and so on. What do i intend to have: I want to have Next link to be displayed on the template and when it is clicked, the next set of Posts with same Category should load. I tried to google for a solution can stumbled upon this post: http://blog.deconcept.com/2005/02/07/wordpress-next-previous-post-links/ the solution used here is deprecated. Kindly help.


title: Permalink of a page that has already been deleted

text: I had a page.. and I by mistake added another one, so the permalink got appended by "-2" at the end. I had to delete one of the pages, so I happened to delete the one without the -2 attached. Now I'm trying to change the slug of the page so that it becomes "pagetitle/" rather than "pagetitle-2" but everytime I edit the permalink it reverts back to "pagetitle-2" any ideas?


title: Programmatically Add Font-Awesome Icons to Category Widget

text: I use the Categories widget on my sidebar(s) and I would like to display a Font Awesome icon next to each category listed in the widget. The icon would be the same for all categories, for now, but I would like to give each category it's own unique icon in the future. I would like to modify the Categories widget using code in my **functions.php** file to add the icon by inserting markup like `<i class="fa fa-chevron-right"></i>` into category's link/anchor element _after_ the category's title. I could accomplish this via CSS, but in doing so I lose the ability to programmatically determine which icon to display, along with the flexibility for other improvements/changes that I may wish to make in the future.    Basically, I wish to achieve this effect:               Cat 1          >          Cat 2          >          Cat 3          > **(The greater-than symbol '>' represents the icon placement relative to the category title)**    I have Font Awesome enqueued in the _functions.php_ file using the `wp_enqueue_scripts` hook as follows, and it loads and displays the icons perfectly. Note that I do not use any Font Awesome plugin built for WordPress.               /* Enqueue Scripts     -----------------------------------------------------------------*/     add_action( 'wp_enqueue_scripts', 'essentials_enqueue_scripts' );     function essentials_enqueue_scripts() {         /* jQuery */         wp_enqueue_script('jquery');         wp_enqueue_script( 'jquery_ui', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jqueryui/2.0.3/jquery-ui.min.js", false, null);         wp_enqueue_script( 'waypoints', get_template_directory_uri() . '/js/waypoints.min.js');         wp_enqueue_script( 'essentials_main', get_template_directory_uri() . '/js/essentials_main.js', array(), '1.0.0', true );         wp_enqueue_script( 'essentials_show_stuff', get_template_directory_uri() . '/js/essentials_show_stuff.js', array(), '1.0.0', true );         /* Google Fonts */         wp_register_style('GoogleFonts','http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Bad+Script');         wp_enqueue_style( 'GoogleFonts');         /* Font Awesome Fonts */         wp_register_style('Font Awesome','//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css');         wp_enqueue_style( 'Font Awesome');      }      Despite my best research efforts, I was unable to find a solution to modify the categories widget.


title: Loop through multiple custom taxonomy terms and display posts for a custom post type

text:
I am working with custom post types in the bones theme from themble. There, I want to create a link list and therefor i've created a custom post type, called links. This custom post type has a custom taxonomy, called links_categories. Now I would like to display all links on one page, like this: Link Category 1   * Post 1   * Post 2   * ... Link Category 2   * Post 1   * Post 2   * ... While researching on how to achieve this dynamically, i tried this two solutions: Loop through custom taxonomies and display posts Custom post type multiple loop by taxonomy term Strangely enough I had the same issue with both versions. It seems like WP_Query is not getting any posts - I just get the slug of the custom category term. Here is what I have for now:               <?php get_header(); ?>

<?php post_type_archive_title(); ?>
                              <?php                             $post_type = 'links';                                  // Get all the taxonomies for this post type                             $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );                                  foreach( $taxonomies as $taxonomy ) :                                       // Gets every "category" (term) in this taxonomy to get the respective posts                                 $terms = get_terms( $taxonomy );                                      foreach( $terms as $term ) :                                           $wp_query = new WP_Query( array(                                         'taxonomy' => $taxonomy,                                         'term' => $term->slug,                                         'posts_per_page' => '-1'                                         )                                     );                                          if( $wp_query->have_posts() ) :                                              while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                                                  <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">

                                                         <?php // show the post thumbnail                                                         if ( has_post_thumbnail() ) { ?>                                                                  <a class="fadeit" href="<?php the_permalink(); ?>">                                                                 <?php the_post_thumbnail(); ?>                                                                                <?php } ?>

                                                         <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>                                                         <?php the_content(); ?>

  <?php                                              endwhile;                                              else : ?>

<?php _e("Oops, Post Not Found!", "bonestheme"); ?>

<?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?>

<?php _e("This is the error message in the custom posty type archive template.", "bonestheme"); ?>

 <?php                                          endif;                                      endforeach;                                  endforeach;                         ?>
                           <?php get_sidebar(); ?>


title: Create a custom URL for blog archive

text: I'm playing around with a test site and I've set up a static page as home page. Now I want to make a menu item called `Blog` \- with url `example.com/blog/` \- where I'll list the latest articles. I made a custom page template and changed the `WP_Query` so that it queries a list of 10 latest posts. I then created a page and set the permalink to `example.com/blog/`. For the permalinks, I'm using a custom structure `/blog/%postname%/` so that my blog posts are like `example.com/blog/post-name`. The issue: I would also want that the monthly archive page and the category list page also use that custom page I made instead of their respective template files. Or another solution I was thinking about is to get the normal archive page to work without using the custom page pointing to `example.com/blog`. I'm kinda confused about how to implement the solution.


title: get random users each time based on the meta key

text: I have many users on my website, out of some has status "elite". I am saving this status in meta key/value for each user (`'meta_key' => 'elite_member', 'meta_value' => '1'`). I want to display randomly 2 user profiles in rotation on my site home page which has status "elite" so that each user profiles will appear same no. of times in rotation. I am able to get all the users with meta_key "elite" and meta_value="1"               $elite_members=get_users(array('meta_key' => 'elite_member', 'meta_value' => '1'));      But I am not able to get how to display 2 user profiles in rotation so that each user will get same no. of chance to appear on home page.


title: How to store foreign language characters in WordPress?

text: I am building a membership site in WordPress. I have added a Notes functionality on my site where each unique user can login to the site and enter notes specific to each lesson/post. I am storing these notes in a custom table in db. The user can enter the notes in any preferred language rather than just using English language for entering Notes. Now, the problem is notes are not getting stored properly in db if the user enters it in some other language. For example, if the user enters some characters in Russian language, it gets converted into this form               %u0414%u0440%u0435%u0432%u043D%u0435%u0440%u0443%u0441%u0441%u043A%u0438%u0439 %u043B%u0438%u0442%u0435%u0440%u0430%u0442%u0443%u0440%u043D%u044B%u0439 %u044F%u0437%u044B%u043A %u0438 %u0435%u0433%u043E      I am using the following query for inserting the data in the custom table:               <?php         $wpdb->insert( 'wp_notes', array( 'userid' => $_POST['userid'], 'postid' => $_POST['postid'], 'note' => ''. stripslashes($_POST['notes']) .'', 'title' => ''. stripslashes($_POST['title']) .'' ),  array( '%d', '%d','%s','%s' ) );     ?>      I am already using a meta tag for `charset utf-8` and my db is also set to `utf8_general_ci` Collation. Any help will be appreciated.


title: How to redirect user to first page of product after selecting a new filter

text: Anyone one know how i could go about changing the loading behaviour of WooCommerce. I'm trying to figure a way to load from page 1 everytime a new filter is selected At the moment, when a new filter is selected and applied it's remains on the current page. Thanks !!


title: Hueman layout styles and custom post type (DW Q&A)

text: I'm running a wp site with the Hueman Theme and the Q&A plugin from DW. The theme doesn't really plays well with the theme, so I had to find some solution for it. Managing the is somewhat painful has the DW didn't thought a lot about easy theme integration. Well, that being said and with a few fixes here and there I came to the last bit I need to be done and I'm missing something... I want to create a filter in `function.php` that enforces a specific layout on the custom post type "single-question". What am I doing wrong?               /* Define DW Single Answer como Página*/     add_filter('alx_layout_class', 'my_single_question_page');     function my_single_question_page($layout) {         $post_type = get_post_type_object( get_post_type($post) );         $my_post_type = $post_type->name;         if ( is_single() && $my_post_type = 'dwqa-question'){           // Define o layout para "layout-page"           $layout = ot_get_option('layout-page',''.$default.'');         }         // Returns the layout.         return $layout;     }      EDIT: Edited the code to reflect the one I'm trying right now. Still getting a error 500 :/ Another Edit: The error was a markup error. The code now stands as above explained. This should be simple, but it's making my brain hurt :P


title: HM CMB: Post Select Field for CPT ID

text: 'm using human made's custom meta boxes framework (https://github.com/humanmade/Custom-Meta-Boxes). Using the post select:               array(          'id'       => 'example-field-post-select',          'name'     => 'Post Select Field',          'type'     => 'post_select',          'use_ajax' => true,         'query' => array( 'post_type' => array('posttype') )     );      Currently, the way the post_select field works is that it populates with post ids in the select box for the name and value of the field. I'd like to populate the "name" part of the select box as the post type title and the "value" as the id. Any idea how to accomplish this without modifying the field type or creating a custom select field?


title: Import XML automatically every X days

text: I found this article. I'm not yet able to automatically import from an existing file... From here what I have to do for loading a sample.xml and using articles to user id#1? I'm a noob... How can I automatically "run" this updater every X days?


title: Post-specific widgets in Wordpress 'Twenty Fourteen' theme

text: Using Wordpress 3.8.1 with 'Twenty Fourteen' theme I'd like to arrange my post in such a way that it's main contents go to main (center) column while galleries, attached files and links pertaining to this post go to content sidebar to the right. How can I do that? Do I need some specific plugins? Right now I can place in the content sidebar only site-specific widgets. I think that sidebar named 'content' and visually placed and styled like post should display post-specific widgets but I'm unable to force it to that.


title: How can I apply no-disposable when programmatically adding a user with wp_insert_user()?

text: How can I run no-disposable-emails plugin when programmatically adding a user with wp_insert_user()? I mean how does that work? http://wordpress.org/plugins/no-disposable-email/                   $random_password = wp_generate_password( 8, false );              $user_data = array(                                         'user_login'  => $sanitized_user_login,                                         'user_pass' => wp_generate_password ( 7, false ),                                         'first_name'  => $first_name,                                         'last_name' => $last_name,                                         'user_email'  => $email,                                         'display_name'  => $first_name . ' ' . $last_name,                                         'nickname'  => $first_name . ' ' . $last_name,                                         'role'    => 'TestDrive',                                         'city'=>$city,                                         'state'=>$state,                                         'country'=>$country                         );              $user_id = wp_insert_user($user_data);      HERE what worked for me:                   $errors = new WP_Error();         $check_disposable = no_disposable_email($errors, $sanitized_user_login, $email);         $error_string = $check_disposable->get_error_message();              if (!$error_string)) {                 $user_id = wp_insert_user($user_data);         } else {                 die("Please do not use disposable email for registering!");         }


title: Which hook can i use to have multiple passwords access a page?

text: I am trying to add multiple password access to a password protected page. For this i created a function and added a simple db table. The function just checks if the password is correct.               function multiple_password_access($pwd) {         global $wpdb;         $q = "SELECT pwd_code FROM wp_protected_pages WHERE pwd_code = '$pwd'";         $access = $wpdb->get_results($q, ARRAY_A);         if (!empty($access)) {             return true ;             //update used field             $wpdb->query("UPDATE wp_protected_pages SET used = used+1 WHERE pwd_code='$pwd'");         } else {             return false;         }        //return $msg;     }      And now i like to add multiple_password_access to the protected page proces, preferable in functions.php so maybe from a hook?? Regards,


title: How do I obtain a list of categories assigned to the current post?

text:
The two functions below are designed to return a list of posts that share the same category as the current post being viewed in single.php However, when I var_dump on $cat (should be a list of the categories assigned to the current post), I'm not getting what I'm expecting. Do I need to deserialize the array before passing it to the get_posts query?               function get_cats()     {     $post_cats= array();     $categories = get_the_category();     foreach($categories as $cat){     array_push($post_cats, $cat->cat_ID);     }     return $post_cats;     }          //get related posts by category     function ce4_get_related_by_category()     {     global $post;     $cat = implode(',',get_cats());     $catHidden=get_cat_ID('hidden');     $myqueryCurrent = new WP_Query();     $myqueryCurrent->query(array('cat' => "$cat,-$catHidden",'post__not_in' => get_option('sticky_posts')));     $totalpostcount = $myqueryCurrent->found_posts;     if($totalpostcount > 0)         {             echo "
";             $myposts = get_posts(array('cat' => "$cat,-$catHidden",'numberposts' => $cb2_current_count));             foreach($myposts as $idx=>$post)              {             ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_excerpt(); ?>
             <?php              }             echo "
";         }     }


title: How to query a custom post type with a taxonomy filter but display post type archive page?

text: I'm filtering the main query of Jigoshop with my own taxonomy with this hook (The file responsible for Jigoshop queries that I'm hooking, Jigoshop hooks onto WP 'request' filter):               add_filter( 'loop_shop_tax_query', 'my_loop_shop_tax_query', 11 );     function loop_shop_tax_query( $request )     {         $region = 'dublin';         if ( ! empty( $region ) ) {             $request[] = array(                 'taxonomy'  => 'product_region',                 'field'     => 'slug',                 'terms'     => $region,                 'operator'  => 'IN',             );         }              return $request;     }      I want to filter every Jigoshop query this way (all products display, category display & search display). This is working as intended but wp_title() in the html head is causing the error:               Notice: Undefined property: stdClass::$labels in /var/www/wp/wp-includes/general-template.php on line 658          Notice: Trying to get property of non-object in /var/www/wp/wp-includes/general-template.php on line 658      I've tracked this down in general-template.php and `is_post_type_archive()` is returning true even though `get_tax()` is also returning true. `get_queried_object()` is returning my taxonomy object (normally the Jigoshop product custom post type object). I need `get_queried_object()` to still return the Jigoshop product custom post type object and `get_tax()` should return false, I want to filter the posts with my taxonomy but I want to keep displaying a post type archive (is this even possible?) Just before the request is sent back to WP for 'request' filter, it looks like this:               Array ( [post_type] => product [post_status] => publish [posts_per_page] => 12 [orderby] => post_date [order] => asc [tax_query] => Array ( [relation] => AND [0] => Array ( [taxonomy] => product_region [field] => slug [terms] => dublin [operator] => IN ) ) [meta_query] => Array ( [0] => Array ( [key] => visibility [value] => Array ( [0] => visible [1] => catalog ) [compare] => IN ) ) [post__in] => Array ( [0] => 293 [1] => 291 [2] => 289 [3] => 18 [4] => 0 ) )      I hope this isn't too specific and makes sense, I'm really at my wit's end here, any help would be greatly appreciated.


title: Why: sticky front page code, shows latest non-sticky on logged-in front page

text: I have this code to display only the latest sticky post on the front page. the strange thing is that, when I'm logged-in it shows non-sticky latest post, even if it's private...               <?php get_header(); ?>     <?php if ( is_home() && !is_paged() ) : ?>          <?php         // Get IDs of sticky posts         $sticky = get_option( 'sticky_posts' );         // first loop to display only my single,          // MOST RECENT sticky post         $most_recent_sticky_post = new WP_Query( array(          // Only sticky posts         'post__in'            => $sticky,          // Treat them as sticky posts         'ignore_sticky_posts' => 1,          // Order by date to get the most recently published sticky post         'orderby'             => date,          // Get only the one most recent         'posts_per_page'      => 1         ) );     ?>          <?php while ( $most_recent_sticky_post->have_posts() ) :  $most_recent_sticky_post->the_post(); ?>     <!-- your code to display most recent sticky -->          <?php endwhile; wp_reset_query(); ?>     <?php endif; ?>      The idea is that those logged-in see the exact same thing as those not logged- in. Does anyone know how to present that?


title: Displaying Multiple Post types in Taxonomy

text: I have the following Custom Post Types which are all linked to the `destination` taxonomy.   * Deals   * Accommodation   * Attractions   * Articles How would I change the `taxonomy-destination.php` file to show matching posts from all 4 post types. For instance, when currently viewing the destination `"los angeles"`, it shows all this content together by date rather than separating in sepearte sections. I would prefer to have them split, deals at the top, followed by the other content not all mixed together. How would be best to achieve this?


title: Building a form with WordPress, and also pulling that data for a user page

text: I am going to give the most basic example of what I want to achieve. I have a page for booking a pickup service, and a form needs to be created to take information of the following. (Date, # of Bottles, Name, Address, phone #) Once the data is entered I want the info to be stored in a database, where I can later export it back on a page. Where I will have a list of each entry containing that data. How do I go about doing this in wordpress, I have done something similar in php a while ago, my memory is a little bit bad though. Is there some sort of process. I don't really know where to start. (not needed just yet, but for the date, I want to delete a certain date, once it has been chosen before once, and I want to have a drop down menu to choose dates, specifically time increments of 30mins e.g. monday 19th 8:30, 9:00 instead of the user choosing their own time) Thanks for any help.


title: Make parent category not selectable when it has child categories

text: I'm trying to find a way of disabling the selection of the parent category within Wordpress 3.5.1 (post editor screen) **only** when that parent category contains child categories. My structure:   * Category 1 (no children, allow users to post, keep selection option)   * Galleries (parent category WITH children, remove selection option to stop users posting)      * User 1 (child category, allow user to post, keep selection option) A jQuery solution to disabling the section of **all** parent categories (regardless of having child categories or not) can be found here: Make parent categories not selectable


title: WordPress (+WPMU) Import/Export ALL settings?

text: As we all know WordPress does not import Widgets when you import content with [Tools > Import] and I'm wondering what kind of script could do that? Database has more than just 1 single information related to sidebars unfortunately. Another question would be - how to auto-import XML file without WordPress Importer? I'm looking for auto-import solution when someone setups new WPMU website. I'd like settings, posts, pages, comments, sidebars etc. to import as soon as user sets up new WPMU website. Perhaps there are already ready solutions that I'm not aware of so any help would be appreciated :)


title: Enable Minify in W3Total Cache using NGINX

text: I am having an issue with enabling minify with the W3TC plugin. I am using a LEMP stack and cloudfront as a CDN, and all of these features, except for the minify work fine. In order to enable fancy permaplinks in WP I added `/index.php?q=$uri&$args` to the `try_files` line in sites-available and now all of the permalinks are `/index.php/postname/` which I think may have something to do with these errors.


title: Custom fields: my custom checkbox area doesn't seem to work

text: I'm trying to create my own custom fields meta box filled with just checkboxes in pages. I'm basing it off this tutorial here. I was able to get the original tutorial to work, but when I started to simplify it down just to saving a checkbox, it stopped working: the checkbox won't save the 'on' state when I update the page. I'm sure this has something to do with the saving portion of the function. Anyone have any clues, tips, or hints? Thanks!               <?php function cd_meta_box_cb() {      // Some settings first:         global $post;         $check = isset( $values['page_title_off'] ) ? esc_attr( $values['page_title_off'][0] ) : '';             // We'll use this nonce field later on when saving.         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );     // Render the custom fields:     ?>           <div>             <input type="checkbox" id="page_title_off" name="page_title_off" <?php checked( $check, 'on' ); ?> />             <label for="page_title_off">Turn off page title</label>         </div>     <?php } ?>     <?php     add_action( 'save_post', 'cd_meta_box_save' );     function cd_meta_box_save( $post_id )     {         // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;         // if our nonce isn't there, or we can't verify it, bail         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;         // if our current user can't edit this post, bail         if( !current_user_can( 'edit_post' ) ) return;         // now we can actually save the data         $allowed = array(              'a' => array( // on allow a tags                 'href' => array() // and those anchors can only have href attribute             )         );         // Save         if( isset( $_POST['page_title_off'] ) )         update_post_meta( $post_id, 'page_title_off', $_POST['page_title_off'] );          }     ?>


title: Site URL always in front of other URLs

text: My Wordpress site is having a bad URL structure when I'm adding new URL. For example in comments, when commentators fill in their website, it always has this structure `http://mysite.com/www.commentorsite.com/`.   The same thing happens in my side bar widget. When I add new text widget and put something like this `<a href="facebook.com/mypage" title="Find Us On Facebook"><span class="social">Find Us on Facebook</span></a>`, the result showing this instead `http://mysite.com/facebook.com/mypage`. Could anyone help me solve this please!


title: How can I re-register my blogs widgets?

text: I deleted my wp_options database file in error. I replaced it with a clean install file. Now my widgets are still present in my widgets area but none are recognized by wp. Am I right in thinking that I somehow need to re register my sites widgets so that wordpress can see them in order for them to become active? If so, how do I do this? Currently my site is displaying a default list of pages, categories etc in the sidebar area. Please understand that I am no programmer but I will do my best to follow any answers. Marc


title: Change the title of an Administration Panel

text: I'm working with a Lucidpress theme at the moment. A client has asked that the "Lucidpress Options" title of a metabox on the page editor screen be changed. I have searched through the Lucidpress theme and have not found anywhere to change the title. Does anyone know, offhand, where to find this? Can anyone at least tell me what sort of a function I would be looking for? Could I do something similar to this: Change The Title Of a Meta Box ? Cheers!


title: Featured image for social sharing ot author archive page

text: Personal blog with occasional guest authors (non-commercial) self hosted Wordpress. I create a bespoke author PHP file for each author (example).   I use Yoast SEO and set a default image for meta property='og:image' where one isn't specified for a post or page for sharing to Facebook / Google+, etc. Is there any way I can over-ride the default image for the archive page for each author.   This could be done by coding either the individual author archive page or adding something to `functions.php`. Appreciate any guidance at all.


title: Using multiple taxonomies to sort Custom Posts

text:
I have a post type that includes a taxonomy for (1) location and (2) a day of the week. I'm using the first taxonomy to sort the posts into groups. Here's the loop I'm using:               <?php      $terms = get_terms('cell-locations');     $argv = array(                     'orderby'       =>  'by_term',                     'hide_empty'    => false                     );     foreach ($terms as $term) {       $wpq = array ('taxonomy'=>'cell-locations','term'=>$term->slug);       $myquery = new WP_Query ($wpq);       $article_count = $myquery->post_count;       echo '
';       echo "
slug."\">";       echo $term->name;       echo "
";       echo '
';       echo '
';       if ($article_count) {          echo "
";          while ($myquery->have_posts()) : $myquery->the_post();?>

<?php $terms_as_text = get_the_term_list( $post->ID, 'cell-days', '', ', ', '' ) ;                                             echo strip_tags($terms_as_text);                                         ?>

 <? echo get_post_meta(get_the_ID(), '_cell_leader', true); ?> / <?php echo get_post_meta(get_the_ID(), '_cell_apprentice', true)?>

Get in touch with <a href="mailto:<?php echo get_post_meta(get_the_ID(), '_cell_leader_email', true);?>"><?php echo get_post_meta(get_the_ID(), '_cell_leader', true);?>

               <?php endwhile;          echo "
";       }       echo '
';     }     ?>      This gives me a nice accordion-style layout based on the taxonomy term, "cells-location." This works all fine, except I now want to sort the posts within each location according to the other taxonomy, "cells-days." I've used a plugin to give them a sort order (http://wordpress.org/extend/plugins/taxonomy-terms-order/). The api for the plugin offers the following query arguments to call the posts in order:                $argv = array(                     'orderby'       =>  'term_order',                     'hide_empty'    => false                     );     get_terms('category', $argv);      I'm having trouble creating this second loop within the first loop. Any thoughts or suggestions?


title: Store wordpress media completely off my server and on a CDN

text: This question has been asked before, and it is pretty dead with no one answering the question properly so I am asking it again. Is there a CDN service that can be configured with a plugin or manually that simply allows you to host your uploaded media files completely off your server, but allow you to manage the attachments like normal. These are key simple points...   1. Uploaded files are sorted into folders (just like normal)   2. Attachments can be deleted - which in turn removes the attachment files off the CDN   3. Files only to be uploaded directly to CDN (not mirrored)   4. The ability to move previous uploads to the CDN and relink them   5. Multisite compatibility  I've got budget, but it's just finding such a service that does all the above. I have a server with alot of wordpress installations on, and 4 of them are extremely heavy with photographic content, so I just want to go the down the CDN route and have all media stored/uploaded that way. I've tried all these plugins, and none of these do what I need...   1. W3 Total Cache \- Only tried with Amazon Cloudfront - no option to direct upload   2. WP2Cloud \- MySQL incompatible   3. WP Read-Only \- Almost perfect but unable to delete files - and no multisite compatibly. I've tried more but they just mirror or copy using cron, which is useless for me because the whole point I would of thought is to get the media strain off your server and live safely in the cloud (which is backed up anyway). Surely something must exist that can do everything I need. Thanks in advance http://wpquestions.com/


title: Fetching uploaded images using Link URL

text: I am trying to fetch the uploaded images using the link URL (The Link URL option is available in the **Add Media** when we upload/insert media) and display it on web. I have gone through the methods `has_post_thumbnail` and `the_post_thumbnail` which are working perfect for me. Now, i am trying to display images (other than featured image) with certain sizing options (as available in `the_post_thumbnail`). I am using the Link URL associated with the uploaded image with the help of the function `$im =imagecreatefromjpeg($url[image]);` and `imagejpeg($im);` to display it on web but all it displays it is special characters ! Is there a way to do it ? **Update code for fetching a single image from media library:**               $media_query = new WP_Query     (               array(               'post_parent' => get_the_ID(),                'post_type' => 'attachment',                'post_status' => 'inherit',               'post_title' => $url[image]               )     );          foreach ($media_query->posts as $post)      {       print_r(wp_get_attachment_image($post->ID));       $imageFound = true;       break;     }      `$url[image]` contains the `post_title`. The problem is this query is fetching all the images from the media library ! Am i missing something ?


title: Get the content of a specific page (by ID)

text: I have the following front-page template made: ![enter image description here](http://i.stack.imgur.com/VP1G6.png) In place of those large Lorem Ipsum blocks, I need to show an "excerpt" from a specific page to fill that box (a certain # of characters). So my question is: how do I get a pages content in String format so that I can echo it out and trim down to a certain # of characters?


title: Help! I changed the domain and now I can't log in via admin online

text: Help! I changed the domain of a website and now it sends me to a 404 error when i try to access my admin page. I don't have the files backed up. What can I do to reverse this?


title: Send all WPMU emails via SMTP

text: I've tried plugins like "WP Mail SMTP" "WP SMTP" "Easy WP SMTP" "WP SMTP Config" noone is compatible with WPMU


title: Delete all scheduled events with a particular hook

text: I have several cron jobs all hooked to the same hook, but each with a different argument (a post ID). It appears `wp_clear_scheduled_hook` only clears job which match the argument passed with it (or jobs without any arguments, if no argument is provided). Is there a way to delete all the cron jobs associated with a hook, regardless of the argument that job has? (Without doing so 'manually' by looping through the IDs). * * * Seems an answer was deleted! To clarify what I would like to achieve: each post has an expiration date - and I would like to delete the post after this date. (An alternative option is to have one cron job - repeating every 24 hours that deletes any expired posts). However, I decided to create a one-off job for each post - but it seems you can't delete all the jobs at once without cycling through them.


title: Rewrite Rules returning wrong data

text: I have a custom post type called `product`. It is categorized with the two taxonomies `product_category` (which is superior) and `product_group`. I want the permalinks for single products to appear like:   `products/%product_category%/%product_group%/%postname/`   and for the "archives", in fact an overview of the products in a product category like:   `products/%product_category%/`. This is my approach:               add_filter('rewrite_rules_array', 'rewrite_rules');     function rewrite_rules($rules)         {             $newRules  = array();             $newRules['products/(.+)/(.+)/(.+)/?$']  = 'index.php?product_category=$matches[1]&product_group=$matches[2]&product=$matches[3]';             $newRules['products/(.+)/(.+)/?$']       = 'index.php?product_category=$matches[1]&product_group=$matches[2]';             $newRules['products/(.+)/?$']            = 'index.php?product_category=$matches[1]';                  return array_merge($newRules, $rules);         }      Two Problems seem to appear now: # 1\. Archives (solved): No matter which of my product categories' slugs I insert into the permalink, the query will get the posts of all categories. Why? # 2\. Single Post/Product: This works "too good": Even if a wrong category is in the permalink, the correct post is returned. I want WordPress to redirect these wrong permalinks to the correct ones. Any ideas? * * * ## EDIT: I solved the archive problem. I simply forgot to evaluate my query correctly. My function in `taxonomy-product_category` now at first gets the terms for `product_group` and for each term it gets all posts that belong to the current product group and to the current product category. If there are now posts, the loop is continued.               <?php $terms = get_terms( 'product_group', 'hide_empty=0' ); ?>     <?php foreach ($terms as $child) { ?>              <?php                  $args = array(                             'post_type' => 'product',                             'status'    => 'publish',                             'tax_query' => array(                                                 array(                                                     'taxonomy' => 'product_category',                                                     'field' => 'slug',                                                     'terms' => get_query_var('product_category')                                                     ),                                                 array(                                                     'taxonomy' => 'product_group',                                                     'field' => 'term_id',                                                     'terms' => $child->term_id                                                     )                                                 )                             );                  $current_issue_posts = get_posts($args);                  if(is_wp_error($current_issue_posts) || count($current_issue_posts)<1){                     continue; //will terminate the loop if posts found                  }           /* Do stuff / output the term */          }     ?>      Still I got that redirect problem.


title: dynamic_sidebar(1).... how to add some post data in this dynamic_sidebar

text:
Hello i am very new to wordpress and working on a theme. This is a video theme and there is some bookmark links on each video post, when i click any video then the these bookmark appear on these posts. But on my front page latest video post appearing in sequence by dynamic_sidebar(1). I just want to add these bookmark link on front page showing video, so i have to change some dynamic_sidebar(1) code, but i searched and i dont know where it is...so help me(I know its not a big deal). and what am I trying to do...I am trying to implement same code on front page with side bar(I know I am stupid) as: as
                               <?php if(function_exists('the_ratings')) { the_ratings(); } ?>                                   <?php if(get_post_meta($post->ID,'views_count',true)){?>                                                          Total Views : <?php echo get_post_meta($post->ID,'views_count',true);?>                                                       <?php }?>                                   <?php if(get_post_meta($post->ID,'twitter',true)){?>                  <a href="<?php echo get_post_meta($post->ID,'twitter',true);?>" target="_blank" class="i_twitter"> <?php _e('Twitter','templatic');?>                    <?php }?>                         <?php if(get_post_meta($post->ID,'facebook',true)){?>                        <a href=" <?php echo get_post_meta($post->ID,'facebook',true);?>" target="_blank" class="i_facebook"> <?php _e('Facebook','templatic');?>                    <?php }?>

     <?php _e('Share Video','templatic');?>

      Please tell me what should i do... any help would be appreciated.


title: Removing a taxonomy term

text: There is a Wordpress function called wp_remove_object_terms that unfortunatly doesn't seem to work. I am trying to achieve the same ends using the following                   $post_terms = wp_get_object_terms( $post_id, $taxonomy );                                    if( $post_terms ){                         if(($key = array_search($term_id, $post_terms)) !== false) {                             unset($post_terms[$key]);                         }                         wp_set_object_terms( $post_id, $post_terms, $taxonomy, true );                     }      This doesn't work, not sure where I am going wrong. Here is the code in the context of the function it sits in               add_action('admin_init', 'update_custom_tour_groups');              function update_custom_tour_groups(){                  $taxonomy = 'custom';                  $terms = get_terms( $taxonomy, array( "hide_empty" => 0 ) );                  foreach( $terms as $term ):                      //Get the term id of the current term                 $term_id = $term->term_id;                 //Create the acf string to get the acf field on the current term page eg custom_awesome-tours                 $acf_value = $taxonomy.'_'.$term_id;                      //wp_set_post_terms, used later, needs to term id as a number (int)                 $term_id_int = (int)$term_id;                      //Loop through all tours in the custom taxonomy and remove the term we are currently looping through                 $args = array(                     'post_type' => 'tours',                     'posts_per_page' => -1                 );                      $the_query = new WP_Query($args);                        if( $the_query->have_posts() ):                           while ( $the_query->have_posts() ):                               $the_query->the_post();                              $post_id = $post->ID;                              //$post_id_int = (int)$post_id;                              //Remove the current term from this post. Basically this remove all posts from the current term                         //wp_remove_object_terms( $post_id_int, $term_id, $taxonomy );                         //wp_delete_object_term_relationships( $post_id, $taxonomy );                         $post_terms = wp_get_object_terms( $post_id, $taxonomy );                              /*                         echo                          '                         <script>                         alert("'.$post_terms.'");                         </script>                         ';                         */                              if( $post_terms ){                             if(($key = array_search($term_id, $post_terms)) !== false) {                                 unset($post_terms[$key]);                             }                             wp_set_object_terms( $post_id, $post_terms, $taxonomy, true );                         }                          endwhile;                  endif;                      //Loop through each tour that has been selected on this term page                 $post_objects = get_field('tours_in_group',$acf_value);                               if( $post_objects ):                               foreach( $post_objects as $post): // variable must be called $post (IMPORTANT)                                  $post_id = $post->ID;                                  $term_id_array = array( $term_id_int ); //Specially formatted to work with wp_set_post_terms                                  //Add the current term to the selected post                             wp_set_post_terms( $post_id, $term_id_array, $taxonomy, true );                              endforeach;                           endif;                  endforeach;          }                 Thanks


title: How to change the layout and styling of posts according to their category in WordPress?

text: I'm customizing a WordPress installation and was wondering what the best way to do this is. I want to customize each post completely depending on the category. Each post will be under only one category.


title: Displaying custom field meta within WP_query loop

text:
This function seems like it should work, and it mostly does, but what I'm lacking are the values for the 'author' key that ends the list item, prefaced by the text 'By'. What I'd like is for the function to loop through the taxonomy and return all the custom posts that are ascribed to it, and for each post I'd like to see that custom field's value. Am I using the wrong WP function to call the custom field?               /**     * List custom post type posts of custom taxonomy     */     function get_all_of_a_taxonomy(){         $post_type = 'entry';         $tax = 'issue';         $tax_terms = get_terms( $tax );         if ($tax_terms) {             foreach ($tax_terms  as $tax_term) {             $args = array(                 'post_type' => $post_type,                 "$tax" => $tax_term->slug,                 'post_status' => 'publish',                 'posts_per_page' => -1,                 'caller_get_posts'=> 1             );                      $my_query = null;                 $my_query = new WP_Query($args);                      if( $my_query->have_posts() ) : ?>                          <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> by <?php echo get_post_meta($post->ID, 'author', true); ?>
                          <?php endwhile;?>                 <?php else : ?>                 <?php endif; // if have_posts()                 wp_reset_query();                  }         }     }


title: conditional function to change post-meta background image

text: I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I'm not quite sure how to do it.               .entry-meta {     background: url("images/dish_blogtitle.png") no-repeat scroll center center transparent;     color: #666666;     float: left;     font-size: 13px;     font-style: italic;     height: 100px;     line-height: 18px;     margin-left: -125px;     margin-top: 5px;     position: relative;     text-align: center;     top: -80px;     width: 100px;     }


title: Insert Wordpress page via external (cron) script?

text:
I'm trying to write a php script that I can run out of cron to create new Wordpress pages. Unfortunately, I can't find any documentation on how to do this. I'm using the WP scripts rather than directly manipulating the SQL...but still no joy. The below runs with no errors...but also produces no pages. I am sad. Anyone know how to do this?               #!/usr/local/php5/bin/php     <?php             include ('/some/path/wordpress/wp-admin/admin.php');             include ('/some/path/wordpress/wp-includes/post.php');                  $to_insert = array();                  $to_insert['post_author'] = 0;             $to_insert['post_content'] = '
Here is my info
\n

one

two

\n';             $to_insert['post_type'] = 'page';             $to_insert['post_status'] = 'publish';             $to_insert['post_title'] = 'We Must Test';                  $result = wp_insert_post($to_insert,true);                  if ( is_wp_error($result) ) {                     echo $result->get_error_message();             }


title: How do I create a NextGen slideshow to show all photos?

text: I have tried many plugins to create a slideshow out of photos I have uploaded to my NextGen galleries. Specifically, I want this slideshow to incorporate photos from all of my galleries. However, so far, the plugins I have encountered only allow for the photos in the slideshow to come from one gallery (as specified by an id argument). How do I do create a slideshow that has all of my photos in all of my NextGen galleries? I have assigned a tag to each of my photos in NextGen if that helps.


title: Taxonomy list links to first post in that term

text:
I have a custom post type of 'artworks' and a custom taxonomy of 'artists'. On page-artists.php I have created a custom list of all the artists and would like to link each artist's name to the first post associated with that term instead of going to the term's page. This is my current code:               <?php while ( have_posts() ) : the_post(); ?>     <?php           $args = array(         'post_type' => 'artworks', // change this to the post type you registered         'posts_per_page' => 1,         'tax_query' => array(           array(             'taxonomy' => 'artists',             'field' => 'id'           )         )       );      $first_cat_post = get_posts($args);          $terms = get_terms('artists', $args);          // list artists alphabetically by last name     $count = count($terms); $i=0;     if ($count > 0) {         $term_list = '
';         foreach ($terms as $term) {             $i++;                  // group terms by first letter                                   $this_char = strtoupper(substr($term->name,0,1));             if ($this_char != $last_char) {               $last_char = $this_char;               $term_list .= '

'.$last_char.'

';             }                   $termid = 'artists_' . ($term->term_id);             $termfirst = get_field('first_name', $termid);                  // link artist name with first work by that artist             $term_list .= '
slug, $term->taxonomy ) . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $termfirst . ' ' . $term->name . '
';              }         $term_list .= '
';         echo $term_list;     }          ?><?php endwhile; // end of the loop. ?>      Here is the dev site. Right now the term list items are linking to that terms page, but it is a 404. This Answer looks promising, but I do not know what template file to put the code in. I tried putting this code:               <?php     /*     Redirect To First Child     */     if (have_posts()) {       while (have_posts()) {         the_post();         $pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");         $firstchild = $pagekids[0];         wp_redirect(get_permalink($firstchild->ID));       }     }      ?> in taxonomy-artists.php, but nothing happens.


title: Highlighting admin submenu pages

text: Here is my plugin's current menu/submenu structure:               add_menu_page('Sunshine', 'Sunshine', 'sunshine_manage_options', 'sunshine_admin', 'sunshine_dashboard_display', plugins_url( 'assets/images/sunshine-icon.png' , $plugin_dir_path ));     add_submenu_page('sunshine_admin', __('Dashboard','sunshine'), __('Dashboard','sunshine'), 'sunshine_manage_options',  'sunshine_admin', 'sunshine_dashboard_display');     add_submenu_page('sunshine_admin', __('Settings','sunshine'),  __('Settings','sunshine'), 'sunshine_manage_options', 'admin.php?page=sunshine');          $sunshine_admin_submenu = array();     $sunshine_admin_submenu[10] = array(__('Galleries','sunshine'), __('Galleries','sunshine'), 'sunshine_manage_options', 'edit.php?post_type=sunshine-gallery');     $sunshine_admin_submenu[20] = array(__('Product Categories','sunshine'), __('Product Categories','sunshine'), 'sunshine_manage_options', 'edit-tags.php?taxonomy=sunshine-product-category&post_type=sunshine-product');     $sunshine_admin_submenu[30] = array(__('Products','sunshine'), __('Products','sunshine'), 'sunshine_manage_options', 'edit.php?post_type=sunshine-product');     $sunshine_admin_submenu[40] = array(__('Orders','sunshine'), __('Orders','sunshine'), 'sunshine_manage_options', 'edit.php?post_type=sunshine-order');     $sunshine_admin_submenu = apply_filters('sunshine_admin_menu', $sunshine_admin_submenu);     ksort($sunshine_admin_submenu);     foreach ($sunshine_admin_submenu as $item) {         add_submenu_page('sunshine_admin', $item[0], $item[1], $item[2], $item[3], $item[4]);     }      I apply a filter on the submenus because I have addons for my plugin which can add additional submenu items. My issues arise with the "Settings" page and "Product Categories" taxonomy When you click on "Settings" tab or "Product Categories" taxonomy, my main Sunshine menu does not open up to reveal all the submenu options. If I click on "Galleries", it shows just fine with all the submenu items visible and "Galleries" highlighted in white/bold. I did some searching and found a support topic which lead me to implement the following:               function sunshine_submenu_show_fix($parent_file) {         global $current_screen;         $taxonomy = $current_screen->taxonomy;         if ($taxonomy == 'sunshine-product-category')             $parent_file = 'sunshine_admin';         return $parent_file;     }     add_action('parent_file', 'sunshine_submenu_show_fix');      This sort of gets there, when clicking on "Product Categories" all the submenu items are now visible but "Product Categories" itself is not bold/white like "Galleries". My goal here is to be able to click on "Settings" or "Product Categories" and have the "Sunshine" submenu items all visible and the respective page show in white/bold.


title: How to determine which custom header image is being shown

text: I'm using a customized version of the Twenty Eleven theme. I want to set a class on the `body` based on which random header image is displayed. Is there some function that allows me to get the name of the custom header image that will be displayed? My goal is to style the text / background / colors based on the image being displayed. **Edit:** I used Brian's answer, placing the `$header_image` code before the `<body>` tag, and also made some changes in header.php. I had to comment out the existing call to `get_header_image()`:               // Check to see if the header image has been removed     //$header_image = get_header_image();      I also changed the header `img` tag to use the `$header_image` variable instead of using a call to `header_image()` to get the file path:               <img src="<?php /*header_image();*/ echo $header_image; ?>"         width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>"         alt="" />


title: Insert shortcode before and after a list automatically

text:
I'm setting up a custom page template and I'm building a widget on it that lists albums with track lists. I use a plugin that allows me to expand text which is what I use to show tracks of the albums on click. My problem is adding the information for different artists each time. The idea is to set up the widget on the page template and then enter the guts lists items into a custom field and then calling it into the widget. The problem for me is using the shortcode from the plugin that's used inside the list items. So what I'd like to do is automatically include the shortcode before and after the child ul of a list item. I'm sure that made no sense so here's the setup. code on page template...

Albums

               <?php echo $albums; ?>

      heres what I call in the custom field minus the shortcode that I need to insert automatically...

header..
       [DDET see track list]

Intro (Album Version) 00:06

What Up Gangsta [Album Version (Edited) 02:57

Intro (Album Version) 00:06

Intro (Album Version) 00:06

       [/DDET]

header..
       [DDET see track list]

Intro (Album Version) 00:06

What Up Gangsta [Album Version (Edited) 02:57

Intro (Album Version) 00:06

Intro (Album Version) 00:06

       [/DDET]
      How can I get the [DDET][/DDET] in there with a function?


title: Get errors from WP_Error to different variables

text: I have added multiple errors in the WP_ERROR. I want to get those errors separately in different variables. With the following code I can get all errors with foreach loop, but how can I assign them to separate variables. The errors I have added are ' **login_error** ' and ' **email_error** '.               <?php         $return = my_custom_function();         if ( is_wp_error($return) ){                   foreach ( $return -> get_error_messages() as $error ) {                 echo $error;              }               }     ?>      I have tried to add this in the above loop:               $login_error = apply_filters('login_error', $error);      $email_error = apply_filters('email_error', $error);       But it assign same error to both variables. Edit: When a form is submitted and any field has error, I'm adding errors this way:               $errors -> add( 'login_error', __( 'Please type your username' ) );     $errors -> add( 'email_error', __( 'Please type your e-mail address.' ) );              if ( $errors->get_error_code() ){                           return $errors;             }      After that, I want to display the above errors next to each of the form field, that's whay I want to get the errors separately.


title: Order by meta_key where value is serialized

text: I'd order post by meta_key but i've a problem with meta_value because is serialized object. I'd order my post per count value.               a:2:{s:5:"count";d:9750;s:7:"timeout";i:1358466733;}      I use below code but order correctly until wp version 3.4.2 after update to 3.5 order by date:                if (have_posts()) :         $args=array(         'meta_key' => 'tweets_count',         'orderby' => 'meta_value',         'showposts' => 10,           );            query_posts($args);           while (have_posts()) : the_post();     //loop      stamp request:               REQUEST:SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 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      Thanks.


title: How to change the wp_upload_dir() path in plugin

text: I am using one plugin to upload all the client files. By default all the uploading files stored in the path wp-content/uploads/-plugin-name- . How to store all my files in my custom directory that somewhere in root of wordpress.