title: Should 3rd Parties Use $wp_scripts/$wp_styles->add_data?

text: Within the `WP_Dependencies` class exists a method named `add_data`. This function adds data to scripts/styles that have been enqueued during the WordPress load. A commonly cited use for this function is to add a conditional when adding stylesheets that are targeted at different versions of IE. For example, to target IE8 and lower:               function test_wp_print_styles() {         global $wp_styles;              wp_enqueue_style( 'test-style', get_template_directory_uri() . '/css/test.css', array(), 1, 'all' );         $wp_styles->add_data( 'test-style', 'conditional', 'lte ie8' );     }     add_action( 'wp_print_styles', 'test_wp_print_styles' );      This will render as:               <!--[if lte ie8]>     <link rel='stylesheet' id='test-style-css'  href='http://trunkosaurus.dev/wp-content/themes/twentyeleven/css/test.css?ver=1' type='text/css' media='all' />     <![endif]-->       When I look through Core, I see a handful of places where this method is used:   * **`WP_Styles->add_inline_style()`** : adds inline style after the referenced stylesheet (done via `WP_Styles->print_inline_style()`)   * **`WP_Scripts->localize()`** : adds a json encoded object (wrapped by the more "public" `wp_localize_script()` function)   * **`wp_plupload_default_settings()`** : adds json encoded object (created from a multidimensional array) for the 'wp-plupload' script (note that this is forthcoming in 3.4)    * When registering/enqueueing scripts and styles Adding data for default scripts (`wp-includes/script-loader.php`) From reading through the uses of the method, it does not appear to have a specific use case. In `wp_plupload_default_settings`, it seems to allow for arbitrary data injection. In `wp_register_script`, it seems to be used to differentiate between header and footer scripts. In `add_inline_style`, it is used to denote inline style that should be added after a specified stylesheet is enqueued. An excellent use for this function would be something like the following code where you are enqueuing an external script but need to send it some config vars, some of which come from the DB:               function zdt_enqueue_add_this() {         global $wp_scripts;              wp_enqueue_script( 'zdt-add-this', 'http://s7.addthis.com/js/250/addthis_widget.js#pubid=myidhere' );              // Contrived example of database call to get a twitter handle stored in the db         $author_twitter_handle = zdt_get_twitter_handle();              $js = "var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @" . sanitize_key( $author_twitter_handle ) . "' } };\n";         $js .= 'var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };';              $wp_scripts->add_data( 'zdt-add-this', 'data', $js );     }     add_action( 'wp_enqueue_scripts', 'zdt_enqueue_add_this' );      This will result in:               <script type='text/javascript'>     /* <![CDATA[ */     var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @tollmanz' } };     var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };     /* ]]> */     </script>     <script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js?ver=3.4-beta4-20731#pubid=myidhere'></script>      Note that this cannot be accomplished with `wp_localize_script` because the `addthis_share` object has properties within properties (I did write about a somewhat hacky way around this before). _EDIT: I was wrong in stating this.`wp_localize_script` handles multidimensional arrays just fine._ This method seems to work really well for the following reasons:   1. It allows you to attach the data to the script handle so it is always properly enqueued with the script. Further, it will be intelligent about deenqueueing the script, script order, and script placement.   2. It allows you to use PHP to send vars to JS.   3. It seems more organized than using `wp_print_styles` to print out some arbitrary script that is acted on later by an enqueued script. There are some things that do not work as expected that worries me about this method. One such issue is that if you use `wp_localize_script` along with `$wp_scripts->add_data`, you can get unexpected results. For instance:               // Contrived example of database call to get a twitter handle stored in the db     $author_twitter_handle = zdt_get_twitter_handle();          $js = "var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @" . sanitize_key( $author_twitter_handle ) . "' } };\n";     $js .= 'var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };';          $wp_scripts->add_data( 'zdt-add-this', 'data', $js );     wp_localize_script( 'zdt-add-this', 'addthis_share', array( 'var' => 'val' ) );      Produces:               <script type='text/javascript'>     /* <![CDATA[ */     var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @tollmanz' } };     var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };     var addthis_share = {"var":"val"};     /* ]]> */     </script>     <script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js?ver=3.4-beta4-20731#pubid=myidhere'></script>      Whereas this script:               // Contrived example of database call to get a twitter handle stored in the db     $author_twitter_handle = zdt_get_twitter_handle();          $js = "var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @" . sanitize_key( $author_twitter_handle ) . "' } };\n";     $js .= 'var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };';          wp_localize_script( 'zdt-add-this', 'addthis_share', array( 'var' => 'val' ) );     $wp_scripts->add_data( 'zdt-add-this', 'data', $js );      Produces:               <script type='text/javascript'>     /* <![CDATA[ */     var addthis_share = { templates : { twitter: '{{title}} {{url}} (by @tollmanz' } };     var addthis_config = { ui_header_color: "#FFFFFF", ui_header_background: "#FA9628", ui_cobrand: "My Site" };     /* ]]> */     </script>     <script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js?ver=3.4-beta4-20731#pubid=myidhere'></script>      The `data` key that is set by `wp_localize_script` is ultimately overwritten by the call to `$wp_scripts->add_data`, whereas if you call `wp_localize_script` twice for the same script, the string will be properly concatenated. While all of this is a really handy way of printing arbitrary script for use with an enqueued script, it makes me think that it should not be widely used because of potential of conflicts. I certainly can see an argument for using this in personal projects where the code will not be used in community plugins/themes. I also looked at Core Trac to see if there was any clues as to the purpose of the function. I found one ticket (http://core.trac.wordpress.org/ticket/11520) (an epic one at that) that explored other ways of adding arbitrary JS. So it seems that there is interest in creating a better way to add arbitrary JS, but not sure exactly if `add_data` should be part of the process. My main question is: should developers be using this function? In some cases (e.g., `wp_register_script`), it seems like a "private" function that 3rd parties should not use; however, in other cases (e.g., `wp_plupload_default_settings`), it seems like a perfectly reasonable way to inject arbitrary JS prior to an enqueued script. I don't imagine there is a "correct" answer to this, but would love to hear what other devs think. I also imagine that there are pieces to this puzzle that I've completely neglected and would love to hear what others have to say about it.


title: uploaded images not going to /uploads folder

text: having a huge problem with a site. i updated the theme to use post thumbnails (that's how old it is) and then when trying to upload an image to use as featured thumbnail: the images process/crunch but then the URLs result in 404s. ![enter image description here](http://i.stack.imgur.com/6nQvQ.png) there isn't anything abnormal in the site's .htaccess. there actually wasn't a wp-content/uploads directory so i made one and the chmod permissions are 0755, so that shouldn't be the issue. i reset the media settings folder to be the default but no images are ending up in that folder. edit: changing the uploads folder to 0777 permissions seems to resolve this. is it safe to leave the permissions this way?


title: Compare the_excerpt() to the_content()

text: Is there a way to compare the_excerpt() to the_content() to know if the_excerpt() is actually showing the entire post content? for instance, if a post were particularly short. ultimately i'd like to have a "Read more" link at the end of excerpts. but i want it to say 1 thing for posts and another for posts of the video format (ie... 'watch the video' instead of 'read the rest'). but at the same time i don't want to manually tack this on after the excerpt, but i have plenty of posts that are short enough they don't need a 'read more' link, since the_excerpt displays the full post. but adding the permalink to the excerpt_more filter isn't quite right since it won't add a link to the video posts that have no other content. so i'm stuck between the two. i hope that made sense. if it didn't it's late and i will try to re-explain in the morning.


title: Wordpress URL rewrite problem

text: blog.com/product/somename In the above URL - how do I tell Wordpress that 'product' is a variable and 'somename' is its value. Then how do I extract that value and use it inside a function I'll create? In short I need to: register variable, check url for variable, extract value, use default post template and generate the_content based on that value, but only if there is a value and only for that url. Right now I'm neither able to register/extract the variable (when I visit the above-mentioned URL I get a 404) nor specify that the_content should only be replaced when the url contains that variable - it simply replaces the content on all regular posts. Here's what I came up with so far:               function product_rewrite_rules(){         add_rewrite_rule('^product/(\d+)/?$','index.php?product=$matches[1]','top');     }     add_action( 'init', 'product_rewrite_rules' );               add_filter( 'query_vars', 'setup_filter_query_vars_product' );     function setup_filter_query_vars_product( $query_vars ){         $query_vars[] = 'product';         return $query_vars;     }               function products_page () {     global $wp_query;     if( isset( $wp_query->query_vars['product'] )) {     $productvalue = $wp_query->query_vars['product'];          echo "product is $productvalue";     }     }     add_filter ('the_content', 'products_page');        What am I doing wrong?


title: How can I edit the slugs of tags?

text: I'm interested in specifying different URL slugs for tags than the text they contain (e.g. changing the slug for a "QnA" tag to "questions-and-answers"). What's the easiest way of making and maintaining these changes for a large number of tags?


title: How do I create a post_id column, for admin posts list?

text: I'm trying to add a column to display the post_id from the wp_postmeta table. I would like to display it in the admin posts list. Here is my code:               add_filter( 'manage_edit-movie_reviews_columns', 'my_columns' );      function my_columns ( $columns ) {       global $post;       $columns['id'] = 'ID';         return $columns;     }     add_action( 'manage_posts_custom_column', 'populate_columns' );     function populate_columns( $column ) {       if ($column == 'id'){         echo $post_id;       }     }      The ID column is visible, but no post_id are in that column- it is just blank. Please can you suggest changes. I'm new to wordpress development so please be gentle.


title: Listing taxonomies from custom post type

text: I have a custom post type with several taxonomies within it Eg. the post type is called `campsites` and the taxonomies are various `counties`: cheshire, staffordshire etc. What I want to do is: list all of the counties and when you click on a county it links through to a page which lists all of the posts within that County. How can I do that.


title: Related posts widget - category

text:
I want edit this widget to display related posts from current category. This code below display only posts from category that I must choose manually. So I want related posts from category ..thanks for help               add_action( 'widgets_init', 'catposts_load_widgets' );          function catposts_load_widgets() {         register_widget( 'Catposts_Widget' );     }          class Catposts_Widget extends WP_Widget {              function Catposts_Widget() {             /* Widget settings. */             $widget_ops = array( 'classname' => 'catposts', 'description' => __('Adds posts from a specific category .', "solostream") );             /* Widget control settings. */             $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'catposts-widget' );             /* Create the widget. */             $this->WP_Widget( 'catposts-widget', __('Category Posts Widget', "solostream"), $widget_ops, $control_ops );         }              function widget( $args, $instance ) {             global $post;             $post_old = $post; // Save the post object.                  extract( $args );                  // If no title, use the name of the category.             if( !$instance["title"] ) {                 $category_info = get_category($instance["cat"]);                 $instance["title"] = $category_info->name;             }                  // Get array of post info.             $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]);                  /* Before widget (defined by themes). */             echo $before_widget;                  // Widget title             echo $before_title;             if( $instance["title_link"] )                 echo '' . $instance["title"] . '';             else                 echo $instance["title"];             echo $after_title;                  // Post list             echo "
\n";                  while ( $cat_posts->have_posts() )             {                 $cat_posts->the_post();             ?>                     <div class="post" id="catpost-<?php the_ID(); ?>">
                                  <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php include (TEMPLATEPATH . "/post-thumb.php"); ?>
<a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_title(); ?>
                                  <?php the_excerpt(); ?>
                              <?php include (TEMPLATEPATH . "/postinfo.php"); ?>

             <?php             }                  echo "
\n";                  echo $after_widget;                  remove_filter('excerpt_length', $new_excerpt_length);                  $post = $post_old; // Restore the post object.     }              function form($instance) {         ?>
                 <label for="<?php echo $this->get_field_id("title"); ?>">                     <?php _e( 'Title' ); ?>:                     <input class="widefat" id="<?php echo $this->get_field_id("title"); ?>" name="<?php echo $this->get_field_name("title"); ?>" type="text" value="<?php echo esc_attr($instance["title"]); ?>" />

                                      <?php _e( 'Category' ); ?>:                     <?php wp_dropdown_categories( array( 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>

                 <label for="<?php echo $this->get_field_id("num"); ?>">                     <?php _e('Number of Posts to Show'); ?>:                     <input style="text-align: center;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="text" value="<?php echo absint($instance["num"]); ?>" size='3' />

                 <label for="<?php echo $this->get_field_id("title_link"); ?>">                     <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("title_link"); ?>" name="<?php echo $this->get_field_name("title_link"); ?>"<?php checked( (bool) $instance["title_link"], true ); ?> />                     <?php _e( 'Make widget title link' ); ?>
                  <?php         }     }


title: Prevent users from changing post status

text: The scenario is this: An agent enters the post data (custom post), but can only do a pending for review or change the visibility of the post. He cannot change the post status manually. I have achived the pending for review, but I cannot hide the "Status: published/pending etc. Edit". How is it possible (if possible)?


title: Custom Posts values in custom post overview

text: I created a custom post type. I have an overview page with Title, Author, Editor. These are defined in the supports array (`'supports' => array( 'title', 'author', 'editor' ),`). Is it possible to add some custom values to the overview, e.g. values from custom posts? BR, mybecks


title: Private feedback on users

text: I am trying to find a way for users to write private/anonymous feedback on each other (similar to ebay or amazon but private, and so that users can view feedback on them and feedback they have sent). I was trying the custom post route with custom fields however there would be no way to (1) aggregate feedback on one user and (2) make it private. For example every month I would want users to fill out a form that displays with dropdown boxes: >   * Select User: User 1/User 2 etc. >   * Rate Performance: Excellent/Good/Poor >   * Rate Reliability: Excellent/Good/Poor >   * Rate Productivity: Excellent/Good/Poor >   * Add a comment via text box > Then to be able to sumbit this (e.g. once a month) and user 1 can see all the feedback on him, user 2 can see all the feedback on her (but not let user 1 see feedback on user 2). **Edited to add a question** Basically I'm wondering what route go down to implement this? I wonder that custom post types with custom fields are the wrong route? Should I be looking at forms, and if so how could I attempt to make these private? Thanks!


title: Metabox repeating fields - radio buttons not saving correctly

text:
I have multiple radio buttons set up inside of a metabox in a custom post type. I have created the metabox like so:                   add_action('admin_init', 'add_meta_boxes', 1);         function add_meta_boxes() {             add_meta_box( 'repeatable_fields', 'Top 10 Movie List', 'repeatable_meta_box_display', 'cpt_top_ten_list', 'normal', 'default');         }              function repeatable_meta_box_display() {             global $post;             $repeatable_fields = get_post_meta($post->ID, 'repeatable_fields', true);             wp_nonce_field( 'repeatable_meta_box_nonce', 'repeatable_meta_box_nonce' );               if ( $repeatable_fields ) :              // set a variable so we can append it to each row         $num = 0;         $second_num = 0;              foreach ( $repeatable_fields as $field ) {         $num++;          <div class=" playbackformat-holder-<?php echo $num; ?> playbackformat-holder">         <form id="playback-form-<?php echo $num; ?>">             <label for="dvd-<?php echo $num; ?>">             <input type="radio" class="playbackformat-holder-radiobutton" value="dvd" name="playback_format[<?php echo $second_num; ?>]" id="dvd-<?php echo $num; ?>" <?php if($field['playback_format'] == 'dvd') { echo 'checked'; } ?>>DVD                               <label for="bluray-<?php echo $num; ?>">             <input type="radio" class="playbackformat-holder-radiobutton" value="bluray" name="playback_format[<?php echo $second_num; ?>]" id="bluray-<?php echo $num; ?>" <?php if($field['playback_format'] == 'bluray') { echo 'checked'; } ?>>Bluray
                      <label for="3d-<?php echo $num; ?>">             <input type="radio" class="playbackformat-holder-radiobutton" value="3d" name="playback_format[<?php echo $second_num; ?>]" id="3d-<?php echo $num; ?>" <?php if($field['playback_format'] == '3d') { echo 'checked'; } ?>>3d
         </form>
     second_num++;     }      And here is my save function to store the data into an array.               add_action('save_post', 'repeatable_meta_box_save', 10, 2);     function repeatable_meta_box_save($post_id) {              if ( ! isset( $_POST['repeatable_meta_box_nonce'] ) ||         !wp_verify_nonce( $_POST['repeatable_meta_box_nonce'], 'repeatable_meta_box_nonce' ) )         return;              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)         return;              if (!current_user_can('edit_post', $post_id))         return;              $old = get_post_meta($post_id, 'repeatable_fields', true);         $new = array();              $playbackFormats = $_POST['playback_format'];                   $count = count( $names ) - 1;              for ( $i = 0; $i < $count; $i++ ) {              // currently only storing the last stored radio value         $new[$i]['playback_format'] = $playbackFormats[$i];              // save movie description          // and however you want to sanitize         if ( !empty( $new ) && $new != $old ) {             update_post_meta( $post_id, 'repeatable_fields', $new );         } elseif ( empty($new) ) {             delete_post_meta( $post_id, 'repeatable_fields', $old );         }          }      The problem I am facing is that , lets say I have three rows. If I set the first to DVD, the second to bluray and the third to 3D only the last value stores as 3D. All other `['playback_format']` store as 'null'. The way I have things set up it looks like things should be saving properly. This is a trimmed down version. I have input fields that are storing correctly, but the radio buttons have been a major issue. It looks like my save function should be storing each `['playback_format']` into its appropriate place in the array. But only one stores. I've gotten it to store the same value for all three rows, but can't get a unique value for each row and not sure why. Any help would be appreciated, as this is the last piece of the puzzle! Thanks! (Screenshot below for a visual aid) ![repeatable rows - visual aid](http://i.stack.imgur.com/rWQi2.jpg) Here is the value of `var_dump($field);` after storing the data in the screenshot above.               array(4) {       ["name"]=> string(116) "http://onecinephile.staging.wpengine.com/wp-content/uploads/2014/01/lon-chaney-phantom-hunchback-penalty-300x280.jpg"       ["select"]=> string(14) "Test #2"       ["url"]=> string(35) "Testing movie description #2"       ["playback_format"]=> string(3) "dvd"      }           array(4) {       ["name"]=> string(103) "http://onecinephile.staging.wpengine.com/wp-content/uploads/2014/01/spencer-tracy-boys-town-300x225.jpg"       ["select"]=> string(14) "Test #1"       ["url"]=> string(35) "Testing movie description #1"       ["playback_format"]=> NULL      }           array(4) {       ["name"]=> string(100) "http://onecinephile.staging.wpengine.com/wp-content/uploads/2014/01/Ronald-and-Madeleine-225x300.jpg" ["select"]=> string(14) "Test #3      ["url"]=> string(35) "Testing movie description #3"       ["playback_format"]=> NULL      }


title: get unserialized array without using get_option()

text: I'm working on a WPMU plugin that cycles through tables in each blog on the network. I can't use get_option to pull the settings array out of the `wp_n_options` tables, so I'm trying to do it by querying $wpdb and then using `unserialize()`. I know the query is successful because I can `print_r` `result`, but it's wrapped in an array, and I can't figure out how to just get the serialized string out of it. Any pointers? ---EDIT--- What it's actually returning is this: `stdClass Object ( [option_value] => ~serialized string~ )`


title: Injecting HTML on (arbitrary) admin pages

text: I would like to create a plugin that is able to inject some html on admin- pages, no matter if these are post, pages, settings or any option page for a plugin. So I am searching for a suitable hook, so that I could run code like this (pseudo-code):               function plugin_inject_html()     {         if( preg_match( '<regexp to parse the url>', $_SERVER['REQUEST_URI'] ) > 0 )         {             echo 'my html here';         }     }     add_action( '<the hook I am searching for', 'plugin_inject_html' );      So my question is: Which action or filter would be suitable to hook in, so that the result of the echo would arrive in the right location of the overall admin-page (inside the `div.wpbody-content`)?


title: Reset Password - change from name and email address

text: When the password reset goes out, the name is 'WordPress' and the from address is wordpress@domain.com. I need to change these to the company name. I'm running WordPress 3.8 multisite and have done the following:   * Updated general settings name and email address for the subsite   * Installed 'WP Change Email' plugin and updated the details However, this has no effect. I think its because the password reset side of things uses different hooks. I'm using the following code (from http://s14.codeinspot.com/q/2472332) in functions.php to customise the password reset title and body:               function my_retrieve_password_subject_filter($old_subject) {         // $old_subject is the default subject line created by WordPress.         // (You don't have to use it.)              $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);         $subject = sprintf( __('[%s] Password Reset'), $blogname );         // This is how WordPress creates the subject line. It looks like this:         // [Doug's blog] Password Reset         // You can change this to fit your own needs.              // You have to return your new subject line:         return $subject;     }          function my_retrieve_password_message_filter($old_message, $key) {         // $old_message is the default message already created by WordPress.         // (You don't have to use it.)         // $key is the password-like token that allows the user to get          // a new password              $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";         $message .= network_site_url() . "\r\n\r\n";         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";         $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";         $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";              // This is how WordPress creates the message.          // You can change this to meet your own needs.              // You have to return your new message:         return $message;     }          // To get these filters up and running:     add_filter ( 'retrieve_password_title', 'my_retrieve_password_subject_filter', 10, 1 );     add_filter ( 'retrieve_password_message', 'my_retrieve_password_message_filter', 10, 2 );      However, I don't know how to extend this to change the from name and email address?


title: Get posts inside Get terms problem

text:
i have a get_terms which loads correctly.   inside of it i have used get_posts. then using get posts i am   trying to get each post tags (and count <= not currently inside this script)               <?php         $categories = get_terms( 'blogs_cat', array(             'type'                     => 'blogs',             'orderby'                  => 'name',             'order'                    => 'ASC',             'hide_empty'               => 0,             'exclude'                  => '1',             'number'                   => '1000',             'pad_counts'               => true              )         );               echo '
';         echo '
';         foreach ($categories as $category) {                  $colorClass = '';                  // COUNT NUMBER OF TAGS AKA: PUBLISHED / NOT PUBLISHED ARTICLES             $termID = $category->term_id;             $taxonomyNAME = $category->taxonomy;             $termSLUG = $category->slug;                  $items = get_posts( array(                 'post_type'   => 'blogs',                 'numberposts' => -1,                 'taxonomy'    => $taxonomyNAME,                 'term'        => $termSLUG                 ) );             $totalPostsCount =  count( $items );                  // WHEN PRINT_R EACH ITEM RETURNS UNIQE ID             foreach ($items as $item) {                 $posttags = get_the_tags($item->term_id);                 if ($posttags) {                   foreach($posttags as $tag) {                     // HERE I GET SAME TAG NAME FOR ALL TAGS ACROSS POSTS (IN THIS CASE ITEMS)                     echo $tag->name;                    }                  }             }                       //print_r($category);             echo '

slug, 'blogs_cat') . '" title="' . sprintf( __( "All Articles By: %s" ), $category->name ) . '" ' . '>' . $category->name.'
 ('.$totalPostsCount.' / p'.$publishedArticle.')

';         }         echo '
';         echo '
';     ?>      . The Issuse is "echo $tag->name;" returns always the same tag.. can anyone help me to spot the problem / offer a better way   i might have gotten mixed with this script. Thanks **EDIT 1 - RESPONSE TO: @tollmanz** when i *"print_r($item);"* inside the foreach i get this   (similer to each post that exist with its own details):               stdClass Object (          [ID] => 875          [post_author] => 1          [post_date] => 2012-06-25 14:34:53          [post_date_gmt] => 2012-06-25 11:34:53          [post_content] => Content Content Content         [post_title] => itle Example         [post_excerpt] =>          [post_status] => publish          [comment_status] => open          [ping_status] => open          [post_password] =>          [post_name] => post-name          [menu_order] => 0          [post_type] => blogs          [post_mime_type] =>          [comment_count] => 0          [filter] => raw      )       . Also... When i _"echo $item->ID;"_ i get the correct post id.   .   BUt when i try to *"print_r($posttags);"*   after this line: *"$posttags = get_the_tags($item->ID);"*   .   **i get nothing... any ideas why?**


title: With WP 3.4 customizer, while using postMessage & working within your JS for one option, can you retrieve current value for another option?

text: I'm currently working with this awesome article by Otto: http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own- themes/ For my question, I have two separately registered settings, and I'd like to see if I can get them to work together within my JS. ![enter image description here](http://i.stack.imgur.com/QPGSg.png) With both settings I can use jQuery bind to do alter things on site in real- time when each setting is changed, as the article explains. However, what I'm curious about is if when I'm working on one option, can I grab the current value from another option? Hopefully, this screenshot will illustrate what I mean. ![enter image description here](http://i.stack.imgur.com/ehS4B.png) Note: In this example, I could probably come up with some workaround to get the currently set font-size with jQuery to determine the current value, but I'm more asking just as a general example if this is possible. Thanks in advance!


title: After moving my site from a dev subdomain, to root, all my custom meta data is gone

text: I just movde my site from a dev subdomain, to the root. I have extensive amounts of data saved in custom meta fields which I created with the WpAlchemy class. All of this data is not appearing in the site (back or front end), although it appears to be in the database. This happened right after attempting to use the search replace plugin to change any lingering urls. This attempt ended in `Fatal error: Out of memory`. I noticed everything was gone, so I swapped out the db for my backup (after doing a manual search-replace for my subdomain). This produced the same result. I think I've read somewhere that data serialization (am I getting this right?) can mess up this kind of thing. Is that whats happening to me here? What steps should I take to get the site up and running ASAP. Currently it is live, and terribly broken :-(


title: Wordpress Site login problem with facebook, twitter and other social media

text: I am running My Wordpress Powered Website on a free hosted platform and the provider blocked PHP curl extension. I want to let visitors login with facebook and other social platforms. I tried with some wordpress plugins (e.g: nextend facebook connect, social connect etc.) But, those plugins requires curl extension to work. Is there any alternatives to activate facebook, twitter connect in my wordpress website for login? Any help or suggestion will be highly appreciated.


title: How can I get the name of term post meta value which equals term id

text: I have a custom taxonomy (location) that is being populated automatically by an advanced custom field on user save. The issue is that it saves the term_id in the postmeta meta_value field. When I echo that field in my archive or taxonomy template it obviously shows me the term_id and not the actual term name (ex. I get 41, instead of California displaying). I have tried multiple things to get this to appear and days and basically any query I do ends up just a blank space displaying on my archive/taxonomy page. Can anyone assist me in how I might retrieve the term name from the term_id being outputted? Thanks in advance!


title: Lightbox popup on WooCommerce add_to_cart action

text: I would like to create a modal 'pop-up' window in WooCommerce to appear when the "Add to cart" button has been clicked. This has to occur _after_ the WC actions that actually add the product to the cart but before/instead of any redirects. I have found several likely/possible hooks, actions and filters which may be useful to me but I am unsure which I need and how to use them properly (sorry I'm a total WooCom n00b):   * `woocommerce_template_loop_add_to_cart`   * `woocommerce_template_single_add_to_cart`   * `woocommerce_after_add_to_cart_button`   * there's also the `add_to_cart_redirect` filter for _$url_ I am also not sure how to actually _trigger_ the lightbox to appear from within PHP! (Okay in HTML I use an element like a hyperlink which has to be clicked, but how to trigger the same thing at a certain point in the PHP execution? -- Do I need AJAX?) Lastly I was planning to use ThickBox as it is bundled with WordPress, is there any reason to avoid this and or a better option available, or is there a lightbox implementation bundled with WooCommerce? Kind thanks for any and all help!


title: Can I make Wordpress use a custom template for a child page

text: I have a custom post type called communities. Then I have the appropriate single-community.php page. Works great! So we want to use some of these "communities" as parent pages. Then underneath them we'd have multiple child pages. Can I have the parent pages use single-community.php and the child pages use single.php or something similar?


title: Change permalink from wp_list_categories

text: **UPDATE:** This helped me:               $cat_name = 'onde-encontrar';     $category = get_category_by_slug( $cat_name );     $taxonomies = array( 'category' );     $args = array( 'parent' => $category->term_id );     $terms = get_terms( $taxonomies, $args );     foreach ( $terms as $term ){     echo "term_id}'>{$term->name}";     }      But this doesn't print **subcategories** , and I want to print subcategories too. Any suggestions? **OLD:** I have this code that works perfectly for what I want, but I want the link that shows the `wp_list_categories`, is the id of the category and not the permalink. For desire that when you click on the category it scroll down and does not change the main page ... My code:               <?php     $category = get_category_by_slug( 'onde-encontrar' );     wp_list_categories('title_li=&child_of='.$category->term_id);     ?>      What it shows me:               São Paulo      But I need:                São Paulo      something like that.


title: Text after more tag in posts

text: Hey, is it possible that i can put a chunk of code somewhere and it will show up after the more tag seperator but within the post ? I mean if i put more seperator after first paragraph then on post areas after that will show up the code i will put.. probably some html with a twitter and rss link. Help is appreicated :) cheers Ayaz


title: Replace all media (images)

text: I created a new theme for my Wordpress site and I need to replace all the media (images) on the site, since I am using all new image sizes (which are larger than the largest on my current site). 98% of the images will use the same names. Each post only contains one (featured) image and there are no images within the content area of the posts, so this makes the job slightly easier. I was wondering what the best (and cleanest) way was to go about doing this. I have considered the following:   * Using a Wordpress plugin   * Manually removing the featured images from all of my posts, deleting them and then manually adding the new images   * Deleting all my media in my uploads folder and replacing them with the new images then re-generating the image sizes via a plugin I was wondering if there were any other easier and cleaner ways to do this. Most of the ways I suggested above would add downtime to my site while I get all this done.


title: change backend header options

text: Wordpress is offering backend pages for header and background under the design tab, which can be activated inside functions.php. Is it possible to customize that options? For example I would like to have the possibility to choose a logo. Or would it be a better idea to not alter that pages and integrate the custom header/background options into my theme's options tabs instead?


title: issue with setting up permalink programmatically

text: I created a plugin that activate my theme programmatically. I want to set default permalink using programming. It does't seems to work with custom post types. it works well with default custom post type. I tried it on admin_footer hook with 9999 priority but not helped. The code i used is:               add_action('admin_footer','default_permalink',9999);      function default_permalink(){        if(get_option('change_permalink')!= 'post_name_permalink') {          global $wp_rewrite;         $wp_rewrite->set_permalink_structure( '/%postname%/' );         $wp_rewrite->flush_rules();          if(function_exists('flush_rewrite_rules')){            flush_rewrite_rules(true);         } //Set default permalink to postname end                update_option('change_permalink','post_name_permalink');        }     }      Please help.


title: Sub-domain or 2nd, temporary different domain?

text: I'm developing a Wordpress site for a website that already exists (that's not currently using Wordpress). The current website cannot be taken down until the new Wordpress site is ready to replace it. I've read the Moving Wordpress codex article and the Giving Wordpress it's Own Directory codex article but I cannot decide, and do not have enough experience to know, which method would be easier/more efficient when it's time to make the website switch?: **Option 1:** Develop the website in a subdomain (ie: http:// wordpress.website.com) **Option 2:** Develop the website on a 2nd, temporary domain (ie: http:// w3bsite.com) Any advice from those who have done either would be appreciated. P.S. The site has already been built locally, using Xampp, but now needs to be deployed online so others involved in the project can populate the site with content.


title: admin_notices not displaying in plugin

text:
I know I'm probably doing something dumb here but I just can't get this to run. I'm trying to set up a little API for my plugin and to create a class to display admin notices a little easier. Here's what I have:               // Send data to class to get HTML for admin notice     $efpd=Efpdd::getInstance();     $plugin_update = $efpd->efpd_admin_notice(         $notice_info = array(             'type' => 'update',             'message' => 'The plugin has just been updated.',             'button' => 'Click for details'         )     );     //wp_die(var_dump($plugin_update)); // Testing output of admin notice HTML code     add_action('admin_notices',function(){echo $plugin_update;});      And in my class, there is this function:               public function efpd_admin_notice($data=array()){         extract($data); // Extracts $message, $type, and $button from $data array         if(empty($message) && !empty($type)){ // If no message was passed through the $data array, create one based on the type of notice passed, also begin the HTML output here             switch($type){                 case 'error':                     $message = 'There\'s been an error!';                     $return = "
\n";                 break;                 case 'update':                     $message = 'There\'s been an update!';                     $return = "
\n";                 break;                 default:                     $message = 'There\'s something wrong with your code...';                     $return = "
\n";                 break;             }         }         if(empty($button)) $button = 'Click Here';         $return .= "
{$message}
\n";         $return .= "
{$button}
\n";         $return .= "
\n";         return $return;     }      So I guess I'm asking, what am I doing wrong to get this admin notice to not show? Is there a workaround to get this to work? Thanks.


title: Sorting by 2 Custom Fields + Post Title

text: So I've successfully sorted my custom post type "property" based on it's city and state using this:               <?php     $querystr = "     SELECT wposts.*     FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta, $wpdb->postmeta wpostmeta2     WHERE wposts.ID = wpostmeta.post_id     AND wposts.ID = wpostmeta2.post_id     AND wpostmeta.meta_key = 'state'     AND wpostmeta2.meta_key = 'city'     AND wposts.post_type = 'property'     AND wposts.post_status = 'publish'     ORDER BY wpostmeta.meta_value ASC, wpostmeta2.meta_value ASC     ";$pageposts = $wpdb->get_results($querystr, OBJECT);?>      Now I'd like to add a third sorter, which would just be the post title (the name of the property). How can I add this in? What is the proper name for identifying the post title as part of the query string?


title: Displaying a message when plug-in is deactivated

text: I'm using the following code to deactivate my WordPress Plugin if the requirements are not met                   public function activate() {             if (!$this->check_requirements()) {                 deactivate_plugins(plugin_basename(__FILE__));                 wp_redirect(admin_url('plugins.php'));                 exit;             }         }      The function activate() is called when the plug-in is activated. I want to add a message to the user explaining what happened. Is there a way to do that?


title: Displaying icon image for WordPress post formats, is there a cleaner way to do this?

text: The code I am currently using in the loop is in this code snippet: https://gist.github.com/1316622 This just seems messy, and long. I am thinking the best method would really be to use CSS sprites and the post class, but for some reason I cannot put my brain around how to do this. I created another gist of the output of my WP loop, so you can see the post format is added to the class of the article. Not sure if that is the easiest method to address this, and am appreciative of any help: https://gist.github.com/1316633


title: How To Pass Array To get_the_category_by_ID() and Get An Array Back?

text: I am trying to pass an array of category IDs to `get_category_by_ID()` in order to get an array of category names back. Since I'm still trying to get this to work I'm just using `var_dump()` on the output. I'm using the values 1, 5, 3 since 5 and 3 are categories I have and 1 is uncategorized, which I need this to work for. I started with this:                   $CatID = array(1, 5, 3,);     foreach ($CatID as $ID) {          $names = get_the_category_by_ID($ID);     }     var_dump($names);      I returned the correct category name for category 3, but nothing else. So then I tried it like this:               $CatID = array(1, 5, 3,);     $x=0;     foreach ($CatID as $ID) {          if ($x==3) break;         $names[$x] = get_the_category_by_ID($ID[$x]);         $x++;     }     var_dump($names);      This time I got this array of errors:               array     0 =>      object(WP_Error)[262]       public 'errors' =>          array           'invalid_term' =>              array               ...       public 'error_data' =>          array           empty      1 =>       object(WP_Error)[261]       public 'errors' =>          array           'invalid_term' =>              array               ...       public 'error_data' =>          array           empty     2 =>      object(WP_Error)[215]       public 'errors' =>          array           'invalid_term' =>              array               ...       public 'error_data' =>          array           empty


title: Why are my widgets not saving when being added to a sidebar?

text: The following is in my `function.php` file. I see the sidebar in my `Appearance > Widgets` page but whenever I drag something on over the sidebar and save it just disappears once I leave the admin area. I've scoured the web and the only solution I seem to find is that I need to disable ALL plugin to find the culprit... which I've done to no avail. If I switch the theme to the WP 2012 theme then it seems to work, only my theme seems to break it.               add_action( 'widgets_init', 'ditto_register_sidebars' );          function ditto_register_sidebars() {         register_sidebar(array(             'name' => __( 'Right Hand Sidebar' ),             'id' => 'rightBar',             'description' => __( 'Widgets in this area will be shown on the right-hand side.' )         ));     }      This is my `sidebar-rightBar.php` file:               <?php     if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('rightBar') ) :     endif; ?>      and how I include it in my theme:               <?php get_sidebar( 'rightBar' ); ?>      Just a quick note, I'm running on version 3.5.2. I've tried to save in both Chrome and Firefox and my javascript console isn't giving me any problems. I've also tried to do it in accessibility mode with no luck. Any help is appreciated.


title: Post meta select input, if statement

text:
I have created a meta box with a select input (drop down menu). It has a few values and I want to display different content depends on which value the user selects. I am just unsure how to display this conditional content with post meta select boxes.               Item One Select:     <select name="item_one" id="item_one">         <option value="option1" <?php selected( $item_one_selected, 'option1' ); ?>>Something 1</option>         <option value="option2" <?php selected( $item_one_selected, 'option2' ); ?>>Something 2</option>         <option value="option3" <?php selected( $item_one_selected, 'option3' ); ?>>Something 3</option>     </select>      Can I do something similar to a checkbox like:               <?php if (get_post_meta($post->ID, 'metavaluehere', true)) { ?>     //do something      <? } else { ?>     //do something else     <? } else { ?>     //do something else     <?php } ?>      I am just unsure the proper way to form this conditional statement with a metabox select input. In plain english I'd want this, using the top example: If option1 is selected do this, else if option 2 is selected do this instead, else if option 3 is selected do this... Any help would be greatly appreciated! Full code here:               <?php     add_action( 'add_meta_boxes', 'post_options_box' );     function post_options_box()     {         add_meta_box( 'post-options-box', 'Post Options', 'post_options_callback', 'post', 'normal', 'high' );     }               function post_options_callback( $post ){         $options_values = get_post_custom( $post->ID );         $item_one_selected = isset( $options_values['item_one'] ) ? esc_attr( $options_values['item_one'][0] ) : '';         wp_nonce_field( 'my_post_options_meta_nonce', 'post_options_meta_nonce' );      ?>
      Item One Select:         <select name="item_one" id="item_one">             <option value="option1" <?php selected( $item_one_selected, 'option1' ); ?>>Something 1</option>             <option value="option2" <?php selected( $item_one_selected, 'option2' ); ?>>Something 2</option>             <option value="option3" <?php selected( $item_one_selected, 'option3' ); ?>>Something 3</option>         </select>
                  <?php         }          add_action( 'save_post', 'post_options_save' );     function post_options_save ( $post_id )     {         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              if( !isset( $_POST['price_meta_nonce'] ) || !wp_verify_nonce( $_POST['price_meta_nonce'], 'my_price_meta_nonce' ) ) return;              if( !current_user_can( 'edit_post' ) ) return;                        if( isset( $_POST['item_one'] ) )             update_post_meta( $post_id, 'item_one', esc_attr( $_POST['item_one'] ) );               }     ?>


title: How to intercept Post Title on Post-Save

text: I am new to WP and I couldn't find this solution by myself. this is my function,               function explodetitletotags() {              global $post;              $title = $post->post_title;              $tags = explode(' ', preg_replace('/[^\p{L}0-9 ]/', ' ', $title));               foreach $tags as $tag {                  global $post;                  $thePostID = $post->ID;                  wp_add_post_tags($thePostID, $tag);              }          }          add_action('publish_post', 'explodetitletotags');           The Function works like a charm except **When the post title in the new single post page updated** , the title always give the previous value, not the value the last time I typed in the input title box. My assumption here is, `$title = $post->post_title;` in my function call the old version of the title from Database instead of the new version, I think why don't just grab the title before it sent to the Database so the title always the latest version, is this okay? If yes, Is there a way to intercept/catch wordpress on Post-Save before it's saved in wp_posts table Database? I am sorry for my English, since it's not my first tongue and Thank You for your help.


title: Automatically adding images to a certain page through the Media Uploader

text: I have a plugin that calls the Media Uploader to allow users to add images to a Page. The uploader is being displayed and taking images fine, but it is not attaching them to Page ID 65 as I wish (or showing images attached to that Page as in the Gallery). Am I missing something, or is this just not possible in WP? Thanks.               jQuery(document).ready(function($){              $('.manage-images-button a.button-secondary').on('click', function(){                  tb_show('Manage Front Page Images', 'media-upload.php?referer=dd-options&TB_iframe=true&post_id=65', false);             return false;              });          });


title: When do I need to use esc_attr when using WordPress internal functions

text: When I am putting a WordPress value inside the attribute tag, for example, the following method does not need `esc_attr` e.g.               // JS code     alert('<?php echo get_bloginfo('name');?>');      the following method does need `esc_attr`               // JS code     alert('<?php echo esc_attr($post->post_title);?>');      What is the convention used?


title: Disable or lock parent pages from being edited in wordpress admin

text: Is there a way to disable or lock parent pages from being edited in wordpress admin? I only want the children pages to be editable.


title: Renaming the Twenty Fourteen Wordpress theme

text: I know the benefits of creating child themes, but it in my case I really would like to create a theme based upon another one without any dependencies to a parent theme. I tried to use a `sed` command to replace all occurrances of 'Twenty Fourteen'/'Twenty_Fourteen'/ 'twentyfourteen' in all files, but that just doesn't seem to be enough, the theme gets broken. Is there a way to do this? Thank you. * * * Update - SOLUTION: Rename all instances of 'Twenty Fourteen', 'Twenty_Fourteen' and 'twentyfourteen' to your desired new theme name, watch out for case-sensitivity, it should work out. Use a code editor that can replace words in a directory, `sed` should also work if you know how to use it properly, unlike me.


title: meta box on custom post type

text: Okay I have look on the site and need more help! I am adding Learndash to my site and need a meta box to show on their custom post type pages. Here is the meta box code I have which works fine for just normal posts;                   // META          $prefix = 'dbt_';     $meta_box = array(         'id' => 'my-meta-box',         'title' => 'Post Customization',         'page' =>  'post',          'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Post Color',                 'id' => $prefix . 'color',                 'type' => 'select',                 'options' => array('orange', 'pink', 'green', 'purple')             ),             array(                 'name' => 'Image URL',                 'desc' => 'Optional',                 'id' => $prefix . 'img-url',                 'type' => 'text',                 'std'  => 'Image'             ),             array(                 'name' => 'Video URL',                 'desc' => 'Optional',                 'id' => $prefix . 'video-url',                 'type' => 'text',                 'std'  => 'Video'             ),             array(                 'name' => 'Link URL',                 'desc' => 'Optional',                 'id' => $prefix . 'link-url',                 'type' => 'text',                 'std'  => 'Link'             ),          )     );          add_action('admin_menu', 'mytheme_add_box');      Now how do I get it to show on all the following post types; sfwd-courses sfwd-lessons sfwd-topics ... Replacing `'page' => 'post',` with `'page' => 'sfwd-courses',` shows the meta box on the courses page but not normal posts. I thought the following should work but does not... `'page' => 'post', 'sfwd-courses', 'sfwd-lessons', 'sfwd-topics',` Please help...


title: Manually updating a plugin , is it overriding the previous settings of the plugin?

text: This is basiscly what i can't figure out ! I have some plugins that cant be updated automatically, so i want to update a plugin manually by replacing it with the newest version through ftp. maybe a noob questions but i really dont know. So does this override all settings i previously made with the plugin ? (since all files are replaced by the new version?)


title: Show full posts in archive

text:
I have an issue where I need to display the full posts in my archive page. E.G. I have >two posts and I would like to have EACH of them displayed in full in the archive page. Thanks! How would I do this with the hueman theme? Here is the contents of the archive.php theme:               <?php get_header(); ?>
              <?php get_template_part('inc/page-title'); ?>         <?php if(function_exists('pf_show_link')){echo pf_show_link();} ?>
                       <?php if ((category_description() != '') && !is_paged()) : ?>
                     <?php echo category_description(); ?>
             <?php endif; ?>                  <?php if ( have_posts() ) : ?>
                     <?php $i = 1; echo '
'; while ( have_posts() ): the_post(); ?>                     <?php get_template_part('content'); ?>                     <?php if($i % 2 == 0) { echo '

'; } $i++; endwhile; echo '
'; ?>
                      <?php get_template_part('inc/pagination'); ?>                  <?php endif; ?>

          <?php get_sidebar(); ?>          <?php get_footer(); ?>      Here is the content.php file: " >
             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                 <?php if ( has_post_thumbnail() ): ?>                     <?php the_post_thumbnail('thumb-medium'); ?>                 <?php elseif ( ot_get_option('placeholder') != 'off' ): ?>                     <img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" />                 <?php endif; ?>                 <?php if ( has_post_format('video') && !is_sticky() ) echo''; ?>                 <?php if ( has_post_format('audio') && !is_sticky() ) echo''; ?>                 <?php if ( is_sticky() ) echo''; ?>                          <?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?>                 <a class="post-comments" href="<?php comments_link(); ?>"><?php comments_number( '0', '1', '%' ); ?>             <?php endif; ?>

<?php the_category(' / '); ?>

<?php the_time('j M, Y'); ?>

             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>
              <?php if (ot_get_option('excerpt-length') != '0'): ?>
                          <?php the_excerpt(); ?>
         <?php endif; ?>
         Thanks for your interest!


title: Extending the user profile

text: Is there any way that developing a Wordpress admin panel like this would be possible? http://deanelliott.me/wp-content/uploads/account-backend.jpg My client wants it to be displayed within the website template aswell. I really don't want to have to outsource this, but I'm stumped as to how to achieve this. Any help would be greatly appreciated.


title: How to get url of a post from admin panel

text: I want to get post url from the back end edit post page, the edit post url is : www.ddd.com/wp-admin/post.php?post=1&action=edit the real post is: www.ddd.com/wp/?p=1 since the user can edit permalink, i need some wordpress parametrs so it will be constant. Looking for this answer:                global $post;      get_permalink($post->ID);      thx all


title: How do I access cPanel features within Wordpress?

text: Is there a plugin that can access cPanel features from within Wordpress? In particular I'd like to be able to:   * View bandwidth, quota and other server info from the WP Dashboard   * Access my webmail   * Access the file manager to edit files (useful for .htaccess, php.ini and non-WP files) I know I can just open a new tab and log on to my cPanel account, but it would be great if it could be integrated some how. If there isn't a plugin to achieve the above, then I suppose an easier way would be for some links to be added to the Dashboard menu (for example webmail and file manager) which would link directly to those sections in cPanel and perhaps open in an iframe. So, to recap... does a plugin exist to achieve the above (or it easy to make one) or if not, does a plugin exist (or how do I create one) that adds these links to the dashboard. Any ideas from people who use cPanel and WP on a regular basis would be helpful.


title: What is a reasonable memory limit for Wordpress

text: Although the accounts on my server generally have a lower memory limit, I've configured my Wordpress user accounts with a memory limit of 32Mb using the php.ini file and `memory_limit = 32M` Unfortunately I've found that I'm still getting the odd memory error, even on small tests blogs. I've had to increase the limit to 64Mb which in my mind seems a little high for normal usage. What should be a reasonable upper memory limit to have on standard Wordpress installs with popular plugins? For your information some of the plugins that I suspect might be causing memory issues are:   * W3 Total Cache   * Role Scoper   * Smush.it


title: WP_Query with checkbox meta_query - Wordpress

text: > **Possible Duplicate:**   >  WP_Query with checkbox meta_query Ok, so I have a custom post type and have used the Verve Meta Boxes plugin to create some custom meta values for the post type. The meta box is called 'Subjects' and has a checkbox list of subjects to assign values to it. For example, I have ticked Math, English and Science. Now I want to perform a WP_Query which will take an array of subjects selected by the user as an array, compare those subjects to those selected for the custom post type, and return posts if any of them match. Here's the code so far:               $subjects_array = explode("_", $_GET["subjects"]);          $args = array(                 'post_status' => 'publish',                 'post_type' => 'any',                 'meta_query' => array(                   // Not sure what type of meta query to do                         )             );               $query = new WP_Query($args);      To cut a long story short, I just need to know if there's a way to perform a meta_query which will compare an array against whatever format the data in the meta box is in? If this is not possible, I just need to know then I'll look at a different way of doing it, but I'm thinking there's perhaps some meta_query ability I don't know about. Any help would be much appreciated.


title: how to know if the post has pagination (<!--nextpage-->) or not

text: i need a solid solution for checking if a post has pagination or not, regardless of the number of current page in the pagination, and even if the post is in the first page of the pagination. the check is inside the loop. thanks.


title: Front End Dropdown Showing All Custom Post Type 'Agent'

text: Title says it all, I pretty much just want to put a dropdown list on the front end that will list all the posts of custom post type 'agent', preferably in alphabetical order, and go to that post when user clicks on it.


title: CSS isn't rendered on a post but just posted as text

text: I have a wordpress.com hosted blog at sergiotapiag.wordpress.com and I can't seem to get my code to be published with my required setting. Wordpress is not rendering my embedded stylesheet but displaying it's contents. I'm using Windows Live Writer 2011 and the Insert Code plugin to format the code. Any ideas on how to tell wordpress to RENDER the html/css i post and not just escape it as text?


title: Fix Admin Dashboard Posts tab

text: I have WordPress v3.5.1 and using a theme from WPZoom. I added an SEO plugin called WordPress SEO which in turn added 4 more columns to my Posts Admin table which caused the columns to squish together making it very hard to see all the posts now. I have tried to change the CSS in the admin CSS but that does not help at all yet when I do change it using Firebug it helps. how can I fix the squished columns? You can see a copy of the image for better understanding at http://justawebbie.com/facebook/post-window.jpg.


title: Frameworks for Premium Theming

text: > **Possible Duplicate:**   >  WordPress frameworks and parent themes I want to get my feet wet with wordpress premium theme development. I see lots marketplaces where developers sell wordpress themes (Such as themeforest.net). My guestion is, do developers use some kind of a wordpress framework that they bought and build all their themes on it, or do they develop their own framework? I assume that not all frameworks that are sold, such as Genesis or Thesis, will allow you to use their framework to build themes to be sold, but I would like to know if there are frameworks which do give you the freedom to sell themes using their framework as the basis?


title: How to install a plugin for a free WordPress site?

text: > **Possible Duplicate:**   >  How can I install a plugin on a Wordpress.com hosted blog? I've a free WordPress (xxx.wordpress.com) blog and now I want to install a plugin like the way I install them with my WordPress site at my own domain. Can't find it in the menu. Isn't this possible with a free WordPress site?


title: RSS Feed for posts containing any term from a taxonomy

text: I imagine the answer to this will be related to this question I asked yesterday: Custom Taxonomy WP_Query for All Terms in a Taxonomy? I would like to output an RSS feed containing all posts that have ANY entry from a particular taxonomy assigned to them. I can do this: http://blog.example.com/feed/?taxonomy=taxonomy-name&term=test-term To return all posts assigned to a particular term, but I would like to have a feed that shows all posts from all terms in that taxonomy. Thanks, Dave


title: wp_allow_comments checking for blacklisted words effectively

text: I have a big list of prohibited words on the DB. The problem Im running to is that no comment is getting through. They are all getting sent to spam. I was looking at comment.php and found the functions that are handling this. I dont wanna modify the core functions but to write my own. I tried something like `add_action( 'wp_blacklist_check', 'my_wp_blacklist_check');` and pad the words with spaces, so words like 'bi' dont conflict with... let say, the word 'combination'. Obviously my action did not work is there something Im missing? a different hook or something? Thank!


title: Want to have the Post editor remembering the last editing position

text: As you probably know the WordPress _theme editor_ remembers its last editing position, but I want my _post editor_ to do the same (it jumps to the top if you save a post/page).... Any tips/hacks how to resolve this ? Help with this is very much appreciated !!


title: Call custom post type by category

text: Ok, I used Custom Post Types Ui to create several custom post types. When setting up the CPT's I checked off that categories were enabled, and then I added a few categories to one of the CPT's. Now I'd like to call one of the categories (upcoming-meetings on a page, but it doesn't seem to be working. Here's my code:                   <?php $cpt = get_post_meta($post->ID, "my_meta_box_select", true); ?>              <?php $temp = $wp_query;          $wp_query= null;          $wp_query = new WP_Query(); ?>               <?php $wp_query->query("post_type= '.$cpt.'&paged=".$paged.'&showposts=5&cat=upcoming-meetings'); ?>      Any help would be appreciated. I looked around some, but didn't quite understand the difference between Categories and Taxonomies. If anyone wants to shed some light on that for me, that would be great as well. Thanks, Matt


title: "Quick Edit" > update clears out my custom meta values

text: I have two custom meta fields that I've enabled for each post, scottb_customHeader and scottb_customTitle These work fine as long as I'm using the full edit feature to edit posts. However, when I click "Quick Edit", then click "Update", my custom meta values for the post are cleared out. What do I need to do to resolve? Code is below...               add_action('save_post', 'custom_add_save');               function custom_add_save($postID){         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $postID;         }         else         {             // called after a post or page is saved             if($parent_id = wp_is_post_revision($postID))             {             $postID = $parent_id;             }                  if ($_POST['scottb_customHeader'])              {                 update_custom_meta($postID, $_POST['scottb_customHeader'], '_scottb_customHeader');             }             else             {                 update_custom_meta($postID, '', '_scottb_customHeader');             }             if ($_POST['scottb_customTitle'])              {                 update_custom_meta($postID, $_POST['scottb_customTitle'], '_scottb_customTitle');             }             else             {                 update_custom_meta($postID, '', '_scottb_customTitle');             }         }     }          function update_custom_meta($postID, $newvalue, $field_name) {         // To create new meta         if(!get_post_meta($postID, $field_name)){         add_post_meta($postID, $field_name, $newvalue);         }else{         // or to update existing meta         update_post_meta($postID, $field_name, $newvalue);         }     }


title: Automatic updates not working/plugins not installing

text: I am trying to run an automatic update from Wordpress 3.0 to 3.02. However, I get the following error message: "Unable to locate WordPress Root directory. Installation Failed" I also cannot install plugins on the same server. The error message for the plugins is quite similar: "Plugin could not be deleted due to an error: Unable to locate WordPress Plugin directory." I have contacted the host but they have not been much help. Any ideas would be greatly appreciated. Thank you! Jeff


title: Remove the Featured Image Meta Box

text: How can I remove the Featured Image meta box? I've tried using the `remove_meta_box` function and specifying the boxes ID but it doesn't seem to work like it does for the other native meta boxes. Here is the specific code I tried:               add_action( 'admin_menu', 'remove_thumbnail_box' );          function remove_thumbnail_box() {         remove_meta_box( 'postimagediv', 'post', 'side' );     }


title: How to add to a user_meta field (append)

text: Is this possible? I want to use Gravity Forms or another hook to somehow write to the END of a user_meta field - not overwrite it. For example... Before:               $purchase_history = get_the_author_meta('purchase_history', $user->ID);     echo $purchase_history; ('Concert in the Park 01/12/2004')      After:               echo $purchase_history; ('Concert in the Park 01/12/2004', 'Pancake Breakfast 05/15/2005')      Any ideas? Thanks.


title: Filter categories using tags

text: I have a website with the following categories:   * Videos   * Pictures   * Stories And I have a lot of tags like: Funny, Awesome, Mind Blowing, Crazy, etc. Is there a way I could filter lets say: Videos tagged as "Crazy"? I know you can do: http://domainname.com/tag/crazy/ But that would retrieve ALL content tagged as crazy, I just want "Videos". I've searched WP documentation without luck. Thanks! Johann


title: Strange problem with HIdden Input field and WPAlchemy

text: I've been going Bananas with this problem for hours trying to figure out what is wrong. I have this code, simple enough and used in a similar manner many times before:               <?php               //  Get the field: on_the_map         $mb->the_field('date_calendar_item_not_available');      ?>       <input type="hidden" id="date_calendar_item_not_available" value="<?php echo (!$mb->is_value('') && !$mb->is_value('NONE')) ? $mb->get_the_value() : 'NONE'; ?>" name="<?php $mb->the_name(); ?>">      Here's the issue, on this one particular WPAlchemy field. The value isn't set into the field even though there is a string of information there, such as:               '2013-01-18,2013-01-23,2013-01-24'      E.g:               <input type="hidden" id="date_calendar_item_not_available" value="" name="_WPAlchemy_Suppliers_Supplier_Details[date_calendar_item_provisionally_booked]">        Now if I follow that hidden field with an identical one the value is output to the second field.               <input type="hidden" id="date_calendar_item_not_available" value="" name="_WPAlchemy_Suppliers_Supplier_Details[date_calendar_item_provisionally_booked]">     <input type="hidden" id="date_calendar_item_not_available" value="2013-01-18,2013-01-23,2013-01-24" name="_WPAlchemy_Suppliers_Supplier_Details[date_calendar_item_provisionally_booked]">      I would like to mention that this may not be a WPAlchemy issue but maybe something I am doing wrong, or maybe something else entirely, as for some reason in Internet Explorer the value is output, but in the other browsers it isn't i.e. Chrome, Firefox and Safari. Am I making a stupid markup mistake?


title: How to update post parent?

text: I have an array of image id's and i want assign them to the specific post:               foreach ($image_ids as  $image_id)         var_dump(wp_insert_post(array('ID' => $image_id, 'post_parent' => $new_post_id), TRUE));      But there occurs error:               object(WP_Error)#252 (2) {       ["errors"]=>       array(1) {         ["empty_content"]=>         array(1) {           [0]=>           string(38) "Content, title, and excerpt are empty."         }       }       ["error_data"]=>       array(0) {       }     }      So is it possible to update the `post_parent` without updating other data?


title: Problem On Retrieving Post Meta Data on Custom Column

text:
I am trying to add Custom post Metadata to a Custom Column. The meta-box has two text fields as Price and Company but When I publish a new post it just shows values from company in Price column and edit box also it retrieves the company value inside the Price box! Can you please let me know why I cant' retrieve the correct value in Custom Column? Am I doing something wrong in saving or retrieving the data?               add_action('admin_init', 'admin_init');     add_action('save_post', 'save_options');     function admin_init(){     add_meta_box(         "product_options",         "product",         "normal",         "low"       );     }          function product_opt(){     global $post;     $custom = get_post_custom($post->ID);     $price = $custom['price'][0];     $coMake = $custom['coMake'][0];          echo 'Price:         <input name="price" value="'. $price . '" style="width:250px;" />';          echo '
Company:         <input name="price" value="'. $coMake . '" style="width:250px;" />';         }          function save_options(){     global $post;     if (!isset($_POST['price']) || $post->post_type != 'product')     {         return $post;     }     update_post_meta($post->ID, "price", $_POST['price']);          if (!isset($_POST['coMake']) || $post->post_type != 'product')     {         return $post;     }     update_post_meta($post->ID, "coMake", $_POST['coMake']);         }                    add_filter("manage_edit-product_columns", "edit_col" );         add_action("manage_posts_custom_column", "custom_col");              function edit_col($columns){     $columns = array(         "cb" => "<input type ='checkbox' />",         "title" => "Product Title",         "price" => "Price",         "coMake" => "Company",         "type" => "Product Type"      );     return $columns;         }              function custom_col($column)         {     global $post;     switch ($column)     {         case "price":             $custom = get_post_custom($post->ID);             echo $custom['price'][0];             break;         case "coMake":             $custom = get_post_custom($post->ID);             echo $custom['coMake'][0];             break;         case "type":             echo get_the_term_list($post->ID, 'type', '', ', ', '');             break;     }        }      Thanks for comments and helps in advance


title: How to retrieve depth of menu into template

text: In wp_nav_menu i use for the menu, with custom walker, i can get the $depth parameter in the start_el function               function start_el(&$output, $item, $depth, $args)       but, outside this wp_nav_menu(), how can i get the depth of the menu for the clicked item ? For instance :   * **Home**   * **level1menuelement1** -level2menuelement1 (first element of first submenu) -level2menuelement2 (second element of first submenu)   * **level1menuelement2**   * ... In that case, i want to know if my post is in a level 1 or not, to display a specific block or not. Is there a codex function allowing to facilitate the retrieving of this depth or is it achieved programmatically ? Thanks


title: DTAP with wordpress + plugins

text: I'm struggling to find a good way to set up a DTAP street. We've have 4 separate environments (Development, Testing, Acceptance and Production) Codewise (so the .php files) migrating is trivially easy just push and pull with version control and all the merging is done for us. But making sure databases migrate changes seems to be a lot harder... The following situation is common: We have a a site which is live, and runs in production. We need to make a change to this site We have a developer who works on the development environment, installs Gravity forms (or some other plugin) and creates some forms. Maybe change a template and changes some pictures. How does he push only his changes to the testing environment? We cannot export/import the whole database because production might have data changes. We could freeze changes to the production databases until the developer is done, but sometime changes take a couple of weeks so that's not really a solution. I've read about a lot of possible solutions, RAMP seems to pop up a lot, but it only works on the default wordpress elements, not gravity forms for example or any other plugin. Surely I cannot be the first to run into this problem, how to migrate database changes of wordpress + custom plugins?


title: How to search for post content and attached file names

text: I need to extend standard WP search functionality so that the search term is also applied to files attached to a post. In other words if user types in "annual report" then search results would include all pages and posts which have this search string in content and also in attached filename? My current code is:               $search_list = array();          $search_query['s'] = $_GET['find'];     $search_query['post_type'] = array('post', 'page');     $search_query['post_status'] = 'publish';     $search_query['posts_per_page'] = '2';     $search_query['paged'] = get_query_var('paged');     $search_query['nopaging'] = false;          $search = new WP_Query($search_query);      Many thanks.


title: Ads Restricted on WordPress.com?

text: I am creating a WordPress blog myself - downloading it and installing it myself - as well as buying a domain name and hosting it using something like `simplynames.com`. I read somewhere though that you can't have adverts on a WordPress blog? Something to do with .org or .com - is this irrelevant if I am hosting elsewhere?? Thanks


title: Custom taxonomies as product variations

text: I am trying to write a custom taxonomy for handling product variations for an ecommerce plugin (DukaPress). What if I was to add another Custom Taxonomy called "Product Variations" to hold the variations' names. People could create any Named variation and then the Variations under that term. Example:   * T-Shirt Colors ( top level taxonomy term )      * Red     * Blue     * Green   * T-Shirt Sizes ( top level taxonomy term )      * Small     * Medium     * Large And so on and so forth... The idea is to not only let people create these taxonomies but also assign product quantities to them. This will be handled by way of a meta box. Then the Meta Box function will create the variations and size fields from checking off the needed variations. The only problem I cannot think of a solution for is that the Meta Box needs to generate the Variation Quantity Meta Box based on what taxonomies are clicked when creating the product in the post edit screen. How can I do that without asking the user to save the draft? Do you know of a way that I can dynamically have the Meta Boxes created? Perhaps place a Meta Box with just a button in it that is Labeled "Create Variations" that adds the correct variations when clicked. Kind of like the default custom fields. Can anyone help with ideas?


title: Getting and calculating averge value of custom fields of the same tag

text: So basically i got this custom field value which is stored in $postrating - and under the database field customfield1. I want to grab the value of that field for all posts that have the tag currently being browsed. Then i want to calculate the average value of those numbers and display on the archive.php page when browing a tag.


title: Send Data to Wordpress from kiosk

text: I need to get a data from kiosk (think specific ATM machine) to wordpress database. Kiosk service providers told me to give them Gateway URL and Request format to send data. Im stuck on this, I dont know which WP API will be able to do it? What will be the gateway url and what request format will it be. I just dont know where to start this from. I will need to receive the data, save it in DB and then display the data in custom plugin and run different functions on it. I know how to do all this functions once I receive the data, but Im stuck on the step where I need to give the Kiosk providers the instructions in what format to send data and what will be the gateway URL. Can you help me with this please? Any directions, where to start and which API to use etc... Thanks a lot in advance :)


title: orderby=meta_value_num creates duplicate posts

text: I have my facebook likes stored in a custom field named fb_likes. my wordpress post order is sorted by this field, like this.                'meta_key' => 'fb_likes',      'orderby' => 'meta_value_num',      'order' => 'DESC',      'ignore_sticky_posts' => 1,      'posts_per_page' => $wp_query->get('posts_per_page'),      'paged' => $paged      This seems to work fine at first glance, but if you click through the pages, you notice, that some posts are displayed two (or even three) times, even though they're in the database only one time. Also the post order is messed up and seems to change on its own. When I use meta_value instead of meta_value_num it works fine, but then there's the problem that it sorts like this -> 9,5,4,39,38,37,26 - you get the idea. So I need meta_value_num to work as intended. what could be the problem? EDIT: I use the following code to write the facebook likes to the meta_value of fb_likes. If I could just somehow write to the meta value like this "001" instead of this "1". Then I could easily use orderby=meta_value and wouldn't even need meta_value_num. Is there a way to write to the database like this? 1 like -> 001, 21 likes -> 021               {             if($post->post_type == 'draft') continue;             $fb = json_decode(file_get_contents('http://graph.facebook.com/?id='.get_permalink($post->ID)));             if( !isset( $fb->likes) && isset($fb->shares) )             {                 $fb->likes = $fb->shares;             }             //$fb->likes = isset($fb->likes) ? $fb->likes : 0;             $this->log("post_id: ({$post->ID}) \npermalink: ".get_permalink($post->ID) . "\nfb_likes:". $fb->likes . "\n");              update_post_meta($post->ID, 'fb_likes', (int)$fb->likes);         }


title: Multi language for static website

text: I built a very simple/informational/static website using WordPress. I know WordPress is meant mostly for blogs but I used it to build a static website nonetheless. Since I have English, French and Spanish clients, I want them to be able to switch to their preferred language. There is no content translation needed as I already have the translated content. All I want is: 1) On home page, an option to switch languages (ex: mysite.com/en, mysite.com/fr, mysite.com/es.) 2) Since there is text in my homepage header icon, I will need to have a different header icon for each language. What is the easiest way to go along ? Thank you !


title: Can't pull metadata for a term in my theme's function.php

text: I have a strange issue where I've attached custom metadata to a Woocommerce product category using the KC Settings plugin and for some reason, I can access the data just fine in a separate plugin that I wrote as well as Debug Bar's console but not in my functions.php Here's what the working code (in its most basic form) in the console and plugin looks like:               global $woocommerce;     echo (float) get_metadata( 'term', 14, 'latitude', true );      Unfortunately, it just returns a '0' instead of the actual value when executed from functions.php. I typecast it since I need it to return a number but PHP interprets the value of the metadata as a string. Why will this work in a plugin as well as in the console, but not in the functions.php? EDIT: using `get_metadata()` on a post works just fine. Why is it the terms object that causing the issue? EDIT 2: Even more confusing is the fact that I've written out a wpdb query to manually pull it and I just get a white page when I try to add an item to the cart. This query works perfectly in the console however. `$wpdb->get_var( "SELECT meta_value FROM $wpdb->wp_termmeta WHERE term_id = 14 AND meta_key = 'latitude'" );`


title: Is there any way to add a "custom field" to the CPT archive page?

text: as per my title I have a CPT with an archive. I'd like to have my archive main page (the back end) displaying two custom fields that would allow me specifying the "meta tag description" and "page title" for the archive page itself (and not the single post underneath). Clearly I can't add a custom field per se, so I was wondering what other solution it may be available? Would the metabox fit the bill? EDIT: reading some of the comment below, I suspect I need to make a change in the "core", but this is something a bit more complicated. Thanks Andrea


title: add_action for saving a custom menu

text: Say you have custom menus enabled with your WP theme. Is there any action associated with saving a menu once you've arranged it accordingly? To further clarify: say you've arranged a menu with some links and some posts, how might you get the titles of the posts in said menu upon saving (clicking the "Save Menu" button)?


title: Problem: retrieving parent category’s first post

text:
I have a problem checking if a post's category has a parent category, and if so retrieving the first post post of that category. Inside the the_post part: This is my code:                   foreach((get_the_category()) as $childcat) {                 $parentcat = $childcat->category_parent;                 $parentcat_name = get_cat_name($parentcat);         }              echo "ID of parent category: ".$childcat->category_parent."
";         if ($parentcat) {   // is there a parent? If so, this is a child post:              $tmp_post = $post;  // assign orginal post to tmp_post variable for later use               //link name of parent category to first post in parent category         global $post;         $the_slug = 'my_slug';         $args = array(              'category' => $parentcat,              'numberposts' => 1,              'order' => 'ASC'              );          $my_posts = get_posts($args);         if( $my_posts ) {         $parentpost_link = $my_posts[0]->guid;         }             ?>
<a href="<?php echo $parentpost_link ?>"><?php echo $parentcat_name; ?>
       * * * The strange thing is that this works ok with one or two categories. While on another occation, when in a child category post, it fails to find that there is a parentcategory. There is a similar problem with identifying a parentcategory's first childcategory, but I suppose the reason is similar to my problems with this one. What I want is:   1. To get the ID of the childcategory, either the one that the current post belongs to, or the only child category of this post. Then I make a slideshow consisting of all the posts in this category   2. If the current post is a child-category, I need the ID of that category. The posts should not belong to more than max 2 categories: if the first found is the wrong one, I continue to find the next, which should be the correct one.   3. If the post is in a child-category, I also want to find the permalink to the first post in the parentcategory, for navigation. This last task has also been a great difficulty. Strangely, this works perfectly with the first parent-child categories I set up, but not so with the other categories, although the database structure is correct.


title: making sense of admin-ajax

text: So I'm working with ThemeTrust's "reveal" theme, and there is an ajaxed in chunk-of-content that I'm really trying to change (grab custom meta fields (images) + insert into a slideshow). As far as I can tell the following piece of code grabs the content from the normal tinymce box and drops it in the `#projectHolder` div - but I can't figure out how to piggyback my php code on this request.               function loadProject(projectSlug) {      // Scroll to the top of the projects         jQuery("#projectHolder").load(               MyAjax.ajaxurl,         {                        action : 'myajax-submit',                        slug : projectSlug         },         function( response ) {            }     );     }      I suppose my answer lies somewhere in the 1500+ lines of `wp-admin/admin- ajax.php` but that seems awful daunting...


title: How do I add support to my theme for custom menus?

text: I've read a few tutorials on how to add the functionality of the custom menus added in version 3.0 to my theme but they all seem to differ somewhat, and I'm not sure whether they contain superfluous code. In addition I read that the code to register your theme as menu-compatible changed between the RC and the public release. What's the simplest way of adding support for custom menus to my theme?


title: To enqueue or not to enqueue

text: What is the best way to link to a CSS file in WordPress? **Method 1:** Use the following whenever needed               <link href="<?php echo get_template_directory_uri(); ?>/my-style.css" rel="stylesheet" type="text/css" />      **Method 2:** Use enqueue as follows               add_action('wp_enqueue_scripts', 'load_my_style');          function load_my_style () {         wp_register_style('my-style', get_template_directory_uri() . '/my-style.css');         wp_enqueue_style('my-style');     }      Please also let me know why a certain method is better than the other. Thanks. **EDIT** And for style.css, should I use method 1 or method 2?


title: Change Page Template Based on Category

text: How can I display a post with a certain category in the page template instead of default category template. For an example, I want to show all posts under category "Scott" with the page template ("page.php").


title: Set default text for the_search_query();

text:
This is the code in my searchform.php:
         <form method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">             <?php _e( 'Search', 'reddle' ); ?>
                 <input type="text" class="field s" name="s" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />
             <input type="image" src="/images/search.png" alt="Search" class="submit" name="submit" class="searchsubmit"  />         </form>
      And I use this to call the search box in my templates: `<?php get_search_form(); ?>` I would like to use something like `value="<?php the_search_query(); ?>"` instead of `value="Search..."`, so that on search results pages, the search box is filled with the "search query" instead of the default placeholder text. The problem with using `value="<?php the_search_query(); ?>"` is that the search box is blank on all other pages (i.e. there's no placeholder text). Is there a way to set the default for `the_search_query();` so that when it's not a search results page _some default text_ is shown? For example, something along the lines of `value="<?php the_search_query( 'Search...' ); ?>"` (DOESN'T WORK!) * * * As of now, this is how I am doing it:
         <form method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">             <?php _e( 'Search', 'reddle' ); ?>
                      <?php if ( is_search() ) { ?>                 <input type="text" class="field s" name="s" value="<?php the_search_query(); ?>" onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />                      <?php } else { ?>                 <input type="text" class="field s" name="s" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />                 <?php } ?>
             <input type="image" src="/images/search.png" alt="Search" class="submit" name="submit" class="searchsubmit"  />         </form>


title: Missing tags, unexisting tags in search form within products, please help

text: Could you check this link? Bathroom fittings | Slavine za kupatilo On the right side there is search form and for "Cena" (That is Price for artical, on Serbian) there are 3 tags. One of them is unexisting, "5310", and I am wonder how to remove it. Through dashboard option Post Tags I could find no even one tag even if I set in Screen Options to show 999 tags. What am I supposed to do? Thanks in advance, kind regards. Ivan


title: Change the display of Settings API (do_settings_sections)

text: I am working on a plugin which uses Wordpress Settings API. I notice that the functions `do_settings_sections` (and `do_settings_fields`) display the fields using TABLE. How do I change its formatting? (I want to use DIV instead of TABLE)


title: Wordpress Premium Theme download

text: I want to use the theme in the http://theme.wordpress.com/themes/organization/ But I don't want to use it with a wordpress.com blog. This is a premium theme and I would like purchase, download and use it on my own domain. But I can't find a download link. Is it possible?


title: Set cookie then immediantly refresh the page

text: I wrote a small WordPress plugin (mobileesp-for-wordpress) that will redirect mobile users to the mobile site. It's based on mobileesp. The plugin itself works fine the problem is I added an option to view the full site. This function works by checking for a cookie and if the cookie is there don't redirect the user to the mobile site. This also works but the user must click the link twice. Once to set the cookie and the second time to take them back into the WordPress site. The full code can be found here but I think this is the relevent part.               $get_cookie_check = $_GET['view_full_site'];     if(isset($get_cookie_check)){         if($get_cookie_check =='true'){             //set the cookie             setcookie("mobileesp_wp_full_site", 'true', time()+86400, "/", $domain);         }     }     //cookie variable     $full_site_cookie= $_COOKIE['mobileesp_wp_full_site'];           //make sure the target url is set and full site cookie isn't set     if((get_option('mobileesp_wp_target_url') != '') && ($full_site_cookie !="true")){         //check for a mobile browser and redirect the user      }      } The temporary solution would be to check for the cookie on the mobile site then redirect them but is there a better way to do this.


title: Filter specific shortcode output?

text: Is there a hook in WordPress that I can use to filter the output of a specific shortcode? Something like this:               add_filter('shortcode_output', 'my_filter_function', 2);          function my_filter_function ( $output, $shortcode ) {         ....     }      Where `$shortcode` would be something like `[my_schortcode]` or even better, shortcode and its attributes separated into an array.


title: Rewriting permalinks with custom posts

text: I've created a custom post type, let's call it 'product'. The site is also bilingual, without any plugins, where I place localised pages under parent language pages, such as:   * English      * Page 1     * Page 2     * Page 3   * French      * Paginer 1     * Paginer 2     * Paginer 3 And so on. This means that my URLs are like `/%language%/%pagename%`, eg `/en/page_1`. My custom post has bilingual fields for simple localisation but the problem is getting the correct language passed to their public page. For example the page where I list the custom posts exists in all languages and creates a URL like `/%language%/parent_page/%custom_post_name%`, eg `/en/parent_page/a_custom_product`. The weird thing is that the links work perfectly but WordPress doesn't a rewrite of the URL so that it becomes `/%post_type%/%custom_post_name%/` eg `/product/a_custom_product` and because we've now lost the language part I can't localise it. I've created a function for the filter `generate_rewrite_rules`:               global $wp_rewrite;          $wp_rewrite->add_rewrite_tag( '%lang%', '(.+?)', 'lang=' );          $n  = array(         '([\w]{2})/products/([^/])/?'   => 'index.php?pagename=$2&lang=$1'     );          return $n + $r->rules;      I've also flushed the permalinks and what not, I'm just interested to why WordPress rewrites the URL and how I can stop it becoming the former.


title: Get custom post fields from multiple metaboxes

text:
I'm registering multiple metaboxes in my write posts panels. In functions.php:               $meta_boxes[] = array(         'id' => 'products',         'title' => 'Products',         'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types         'context' => 'normal', // normal, advanced, side (optional)         'priority' => 'high', // high, low (optional)         'fields' => array(             array(                             'name' => 'something',                 'id' => $prefix . 'something',                 'desc' => 'some description',                 'type' => 'checkbox'                   ),                      //continue with other fields                  )                );          //another metabox      $meta_boxes[] = array(         'id' => 'customers',         'title' => 'Customers',     //etc...      I'm able to get all the values of fields in a post using:               $custom_field_keys = get_post_custom_keys();     foreach ( $custom_field_keys as $key => $value ) {         $valuet = trim($value);              if ( '_' == $valuet{0} )             continue;             echo $value . ":
";             echo get_post_meta($post->ID, $value, true) . "

";     }      How can I get the names and values of all fields within a metabox that I specify. For example get all values of fields in metabox id "products".