title: My default search is not working

text: I am using a fucntion to search my `post_meta` which i store with every post, But the problem is that when i search `title`, `tags`, content then the search not work. I think my new `function` just override the default search of wordpress. Here is my code               function custom_search_query( $query ) {         $custom_fields = array(             // put all the meta fields you want to search for here             "post_state",             "post_region",             "post_country"             );         $searchterm = $query->query_vars['s'];         // we have to remove the "s" parameter from the query, because it will prevent the posts from being found         $query->query_vars['s'] = "";         if ($searchterm != "") {             $meta_query = array('relation' => 'OR');             foreach($custom_fields as $cf) {                 array_push($meta_query, array(                     'key' => $cf,                     'value' => $searchterm,                     'compare' => 'LIKE'                     ));             }             $query->set("meta_query", $meta_query);         }     }     add_filter( "pre_get_posts", "custom_search_query");      So where is i am wrong. Any idea how can i search every thing. My custom `post_meta`,`title`,`tags`,`categories`,`content`.


title: Two columns in homepage each with one category

text: I modifying a wordpress template to be left with two columns on the main page with the following structure: ![enter image description here](http://i.stack.imgur.com/BjgbD.png) The first 4 are of a category and the last 4 of another The index code is: http://pastebin.com/dMC0saBN The page is (Columns are made, but all they do is repeat the post. They haven't order or filter)


title: Child-theme breaks site

text: So, I have a child-theme with nothing but the required CSS file in it. Once I activated this child-theme my entire site is down. I end up with 2 questions:   1. How can activating a child-theme with nothing but a CSS in it break my site?   2. How can I revert to my original theme? These are the errors the site gives me: > **Warning:** `require_once(/wp-content/themes/interio_child/admin/options- > framework.php) [function.require-once]:` failed to open stream: No such file > or directory in `/wp-content/themes/interio/functions.php` on line 54 > > **Fatal error:** `require_once() [function.require]:` Failed opening > required `'/wp-content/themes/interio_child/admin/options-framework.php' > (include_path='.:/usr/lib/php:/usr/local/lib/php')` in `/wp- > content/themes/interio/functions.php` on line 54


title: Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL's?)

text: My show notes for a podcast will be entered as a new post (like a blog post) in Wordpress (.org - hosted through bluehost, domain registration at godaddy). The site is www.michellefit.com, but the URL specific to a page (and very long and complicated) and does not include my actual web address within it (not sure if this is an issue for what I'm trying to achieve). Now, I want to be able to say in the podcast, "for the show notes on this episode, go to www.michellefit.com/6" (for a direct link to Episode 6 of the podcast, rather than the other two options 1) giving out the ENTIRE URL or 2) telling them to go my site, then to the Podcast tab, THEN scroll down the list of shows to find this particular one). NEED: A step-by-step process to make this happen :-) And I am NOT a techie. I have been researching this online for more than a month and have not yet been able to pinpoint an answer. Thanks for reading this post, and I hope you can help! :-)


title: Custom time field won't sort regardless of format

text: I'm using a custom fields plugin for WordPress (Advanced Custom Fields) and am using a time picker field set to format: "h:mm tt". Using a typical WP query, I'm attempting to sort by "start time" in ascending order, but the returned lists of posts seems to sort on ascending numerical value (i.e. 12:00 PM would appear after 6:00 PM). I checked the custom field data and it's definitely being saved as a UNIX timestamp (start time of '1383224400' for example). I've passed a few combinations of arguments to query_posts but nothing I've tried has worked. Here is the query I'm using:               <?php $args = array(         'post_type' => 'friday_event',         'orderby' => 'meta_value_num',         'meta_key' => 'start_time',         'order' => 'ASC',         'nopaging' => true     );     query_posts( $args );     while ( have_posts() ) : the_post(); ?>      Any ideas what I might be doing wrong? I've tried using a custom 'meta_query' where I set 'meta_value' to a variable and do a custom compare, but I still can't get the posts to sort correctly. Any help is very much appreciated!


title: Should I escape the attributes when using get_month_link?

text: I am not sure should I use `esc_attr()` with `get_month_link()` like this:               <a href="<?php echo esc_attr( get_month_link( get_the_time('Y'), get_the_time('m') ) ); ?>">     <?php the_time( get_option( 'date_format' )  ); ?>      Or should I code it like this (without escaping):               <a href="<?php echo get_month_link( get_the_time('Y'), get_the_time('m') ) ; ?>">     <?php the_time( get_option( 'date_format' )  ); ?>      So security wise which is the best option? Thank you.


title: create page for listing custom post type comments

text: I have a custom post type and I want to create a page which will automatically list all the comments posted under my **single-{my-post-type}.php**. What is the best practice for creating something like ? Should I create a custom page called let's say single-my-post-type- comments.php and put there the neccesarry code ? Is this possible in wordpress? Thank you !


title: Combining external feed into post loop

text: I don't even know where to start on this. I would like to combine an external JSON or XML feed into the post loop and sort it by date. The page will need to auto-load the next posts and have the ability to filter by category. I'm not sure if the best way to do this is to create a custom post type for this external feed and create a post for each item.


title: I have no images in an activated wp theme

text:
With this line everything works fine - (as a **Non-Wordpress** index.php):               <link href="style.css" rel="stylesheet" type="text/css"/>       When I activate the file as a wp theme and replace above line with:               <link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet" type="text/css"/>      everything is ok, except - there are no images. For example - a div with an image:

      **images** folder is inside theme's folder.


title: How to show more post at a given category?

text: I need to show more post at the category `state` (with `tag_ID=21`), for example, I set the number of post show at homepage is 6, but I want 10 post when archive `state`, is there any way to add a filter in `functions.php`? Maybe `posts_per_page` and `wp count posts` is helpful. ---Edit--- My Code in `functions.php` is:               function change_numberposts( $query ) {         // Only modify the main query         if( $query->is_main_query() ){             // Category 21             if ( $query->is_category( array( 21, 'shuoshuo', '说说' )  ) ) {                 $query->set( 'posts_per_page', 10 );             } else {             $query->set( 'posts_per_page', 6 );                  }         }     }          add_action( 'pre_get_posts', 'change_numberposts' );      I also tried               is_category( 21 )     is_category('21')     is_category('shuoshuo')      The only work case is               is_category()      which will output 10 posts in each category. I also noted that `is_category( 21 )` is work for the permalinks set to be numeric. Since my permalinks is self-defined: `/%year%/%monthnum%/%day%/%postname%.html`, how to make the above code behaved as expected?


title: Update all posts at once

text: I have added a custom taxonomy to my posts, that will get a value by iteself on post_update action. What will be the SQL query to update all my posts at once so that the taxonomy value is added to each of them. Also will updating from SQL call the update_post action of wordpress?


title: Best way to modify content from index.php to single.php?

text: My blog has simple posts including a youtube videos. For example:                     and index.php will echo content ( ) I want that the permanent link of this post ( single.php ) displays:                     .. it's the same video but with different width and height. What will be the best and easy way? ( should i use and try to work the excerpt and content someway? ) That also leaves to another question: how to show some content in the index.php and different content in the single.php page ? Many thanks, Pedro


title: WooCommerce permalinks

text: I got the following question: When I go to a WooCommerce category, the link displays like this:               **http://www.example.com/product-category/** category/ Where the bold text is the link like it is and the rest is the product category that needs to be shown. When i go into WooCommerce settings and I go to the pages tab, I got an option to change productcategory slugs. If I fill the following in this textfield: `%product_cat%` the links shows as follows:               **http://www.example.com/** category/category/ What I want to show in my links is:               **http://www.example.com/** category/subcategory/product Is there any way to do this?


title: Sub domain redirection to taxonomy

text: Hi all I want to use sub domain for my taxonomy like that : http://taxonomy.domain.com/apple map to http://www.domain.com/taxonomy/apple I add this to my vhost                   RewriteCond %{HTTP_HOST}    ^taxonomy\.domain\.com [NC]         RewriteRule ^/(.*)$        http://www.domain.com/taxonomy/$1 [L]      And add a wildcard to my dns configuration. The redirection works but I want to use only rewrite but not redirection. So I want to use the target page but still have the subdomain url. So taxonomy.domain.com/apple is map but not redirect to the taxonomy url Any help? thanks in advance


title: How to internationalize the sub menu name "categories" in Custom post type?

text: I'm trying for translation. I made a plugin with custom post type everything is okay. Only one thing i can't able to translate which is `categories` sub menu menu in custom post type.               $args = array(             'labels' => $labels,             'public' => true,             'menu_position' => 4,             'has_archive' => false,             'taxonomies' => array('category','mypost')     );      for the `$labels` i translated easily but here for the category i can't able to translate. If i do __() in the array of taxonomies then the category is not at all coming because that might be translate so the wordpress can't able to recognize the argument. How to translate categories sub menu in my custom post type menu? Is there any way to rename it? Because from the rename i guess i can translate


title: Is it possible to Schedule Attachments in Wordpress?

text: As it's fairly well known, it is possible to schedule Posts in Wordpress for publishing. Also Attachments are actually Posts (in the more internal, technical meaning). So the question that bothers me right now is: Is it possible to schedule attachments as well? Like for example that a Photo-Gallery grows over time?


title: Is it possible to have different header style blog titles in different categories?

text: For my category titled 'mindset' I would like to use the following style on my post header:               background: none repeat scroll 0 0 grey;     border-bottom: 5px solid #83990A;      However for my 'news' category I would like to use the following style:               background: none repeat scroll 0 0 grey;      Any ideas of the coding I could use? Thanks.


title: Ordering users of a specific role by last name

text:
I'm trying to display a list of authors by their last name. I can get the list to display but as yet I don't seem to be able to order the list by last name. Any help would be greatly appreciated. Josh               <?php         $args  = array(         // search only for Authors role         // order results by display_name         'orderby' => 'meta_value',         'meta_key ' => 'last_name',         'role' => 'guest-teacher'                        // check for two meta_values         );         // Create the WP_User_Query object         $wp_user_query = new WP_User_Query($args);         // Get the results         $authors = $wp_user_query->get_results();         // Check for results         if (!empty($authors))         {             echo '
';             // loop trough each author             foreach ($authors as $author)             {                 // get all the user's data                 $author_info = get_userdata($author->ID);                 $url = get_author_posts_url($author->ID);                ?>
<a href="<?php echo $url; ?>"><?php echo $author_info->last_name; ?>
                      <?php             }             echo '
';         } else {              }         ?>


title: How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?

text: This may be a duplicate of this question - Changing the priority of a custom taxonomy's metabox but I can't work out how to apply that answer. I'm unsure what my custom taxonomy div label would be and how to get it to apply to only a custom post type. I have a custom taxonomy, created with register_taxonomy and I would like to make the taxonomy box appear inbetween the post title field and the editor field in the wp-admin add/edit post area, for a set custom post type. Usually you can change CPT order in the admin menus with a priority field, but I don't think there is one for taxonomies... Thanks


title: Users can't upload images on frontend if they haven't got access to the wp backend

text: I let users create posts and upload/attach images to that post via the **frontend**. This works fine. However, when I restrict the access to the Wordpress backend (/wp-admin/) via a code snippet like this one               function wpse_11244_restrict_admin() {         if ( ! current_user_can( 'manage_options' ) ) {             wp_die( __('You are not allowed to access this part of the site') );         }     }     add_action( 'admin_init', 'wpse_11244_restrict_admin', 1 );      or (EDIT) with a redirect code               function redirect_non_admin_users() {         if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) {             wp_redirect( home_url() );             exit;         }     }     add_action( 'admin_init', 'redirect_non_admin_users' );      the Media Upload does not work anymore ("Error" Message). This problem has been discussed elsewhere: > I figured out that if the role didn't have that access [to the backend], it > also killed their ability to upload files on the front end. Is there a way to prevent users to access the backend without killing their ability to upload images on the frontend? Thank you!


title: How to show different categories in different pages?

text:
I have this webpage with blog and a page with latest news. Right now both pages are showing the same category. How do I separate them? so that one page show category 1 and the other show category 2? code for category_blog.php                              <?php if ( is_active_sidebar( 'category-sidebar-widget-left' ) && is_active_sidebar( 'category-sidebar-widget-right' ) ) { ?>
          <?php } elseif ( is_active_sidebar( 'category-sidebar-widget-left' ) ) { ?>
          <?php } elseif ( is_active_sidebar( 'category-sidebar-widget-right' ) ) { ?>
          <?php } else { ?>
          <?php } ?>

                                   <?php echo single_cat_title( '', false ); ?>

                  <?php if ( have_posts() ) : ?>                                       <?php while ( have_posts() ) : the_post(); ?>                 <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           <?php _e('In', 'tm_myid_text'); ?> <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           <?php echo tm_viewcounter_display(get_the_ID()); ?>

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php echo excerpt(300); ?>

                                 <a href="<?php the_permalink() ?>">                                                                           <?php _e('Read More', 'tm_myid_text'); ?>

                 <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
           this is the index code:               <?php      /* Template Name: Home 5 */     ?>          <?php get_header(); ?>

                                    Recent Posts

                  <?php if ( have_posts() ) : ?>                                       <?php $wp_query = new WP_Query( array(                                                      "cat" => "",                                                      "posts_per_page" => "",                                                      "post_type" => "post",                                                     "paged" => get_query_var('paged') ? get_query_var('paged') : 1                                                     )                                                                                );                 while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                      <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           In <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           /*<?php echo tm_viewcounter_display(get_the_ID()); ?>/*

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'Full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php the_content(); ?>

                                 <a href="<?php the_permalink() ?>">                                                                            <?php comments_number(__('(0) Kommentarer ', 'tm_myid_text'), __('(1) Kommentar', 'tm_myid_text'), __( '(%) Kommentarer', 'tm_myid_text') );?>

                      <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
               <?php get_template_part( 'sidebar_left' ); ?>                    <?php get_footer(); ?>


title: Shortcodes Ultimate pulse my widget in sidebar

text: I have create my website with sidebar is good for along time. In the recent day, I activate shortcodes Ultimate plugin with my website. I love this shortcodes but It effect with widget in sidebar. It had pulse an image in wedget. example : http://www.trattown.com/th/hotels/%E0%B8%A3%E0%B8%B2%E0%B8%A1%E0%B8%B2%E0%B8%A2%E0%B8%B2%E0%B8%99%E0%B8%B2-%E0%B8%A3%E0%B8%B5%E0%B8%AA%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%97-%E0%B9%80%E0%B8%81%E0%B8%B2%E0%B8%B0%E0%B8%8A%E0%B9%89%E0%B8%B2/ How to fix it? Why I know that Shortcodes Ultimate is Trouble cause when I deactivate it. My website is ok.


title: How to set permalink structure via functions.php

text: I'm setting up a Wordpress Network and wanted all new sites to have the same permalink structure (i.e. "/%year%/%monthnum%/%postname%/"). I'm wondering if this is possible to do via hooks or hacks in functions.php, without having to rely on users to choose that structure.


title: date.php shows all posts. how to fix it?

text:
I am using the following function for **category.php**. It's working fine.               function cat_page_list(){     /*     post : returns the post for category page     */           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $cat1 = get_query_var('cat');         $cat_name = get_category($cat1)->name;         $args = array('cat'=> $cat1, 'posts_per_page' => 3, 'paged' => $paged );                 query_posts( $args);          if(have_posts()) :             print ('
');                  while (have_posts()) : the_post();                     $excerpt = get_the_excerpt();                        $date = explode(",", get_the_time("F,j,Y", "", "", false));                     print('

');                                      print('
                                                                              ' . $date[1] . '
' . substr($date[0], 0, 3) . '
');                         print ('
');                                 the_title('
', '
');                         print ('
');                                                            print ('
');                         print ('

');                             if (strlen(get_the_content()) > 100) {                                 $content = get_the_content();                                 echo str_replace(' ', '

', substr($content, 0, 300)). "....";                                    echo '
Read More';                             }                             else { the_content(); echo "
"; }                             print ('

');                              print('

');                 endwhile;                 if (function_exists("pagination")) {                     pagination();                 }             print ('
');         endif;           }      it's working fine and showing the 3 posts per for peroper categories. Eg: if click the **category 1** and it shows post under **category 1** and if click the **category 2** and it shows post under **category 2** Now I want to do the same design on my **date.php**. so I created the function named               date_page_list();          and changed the following codes only.          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $cat1 = get_query_var('cat');         $cat_name = get_category($cat1)->name;         $args = array('cat'=> $cat1, 'posts_per_page' => 3, 'paged' => $paged );        TO                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array('posts_per_page' => 3, 'paged' => $paged );       now the problem is when I call the `date_page_list();` it shows all the post from the blog. How can I fix this.?? Any help will be very much appreciated. the following code works properly and giving the proper post for the proper dates. but I need to do the same style as my **category.php**               <?php      $date1 = get_query_var($query_string.'date');     get_posts( array ('posts_per_page' => 10 ) );     while ( have_posts() ) : the_post(); ?>
     <?php the_time( get_option( 'date_format' ) ); ?>
     <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

     <?php endwhile;     wp_reset_query();?>


title: Disqus plugin issue

text: I have a problem with the Disqus plugin: comments don't load. But, when I resize the window of Google Chrome or Firefox, comments load and display correctly. This is very strange. You can test here. You see that comments don't load and when you resize the window, comments load. Do you have a solution for this problem?


title: Custom list of categories that is sortable by count

text: So I am attempting to use bootstrap with wordpress. Inside my left column my design called for a large box and then 4 smaller ones below. Those boxes would hold information about a category. There would be an image, then below that the title of the category and then the count of post within that category. I would like to be able to sort it dynamically and have the category with the most related posts show up in the larger box. Where I am stuck at is calling the individual objects (title, img, count) for each category. Is this possible or do I need to forget about the sorting by count and just call individual objects by the category id? The site is located at datalitigationblog.com Thanks in advance.


title: Where to populate custom terms in custom taxonomy in plugin?

text: I have a plugin that successfully creates a custom taxonomy for a custom post type. What I'd like to do, is on activation (or wherever works), create a default set of terms for the custom taxonomy. I've successfully done this before by using `wp_insert_category` in a function called upon plugin activation. That same function isn't working for the custom taxonomy, though. My guess is that it is because the custom taxonomy isn't registered yet when the function gets fired. I can't seem to find out where to hook the function so that it works with a custom taxonomy. I've tried calling the function from `wp_loaded` also and I curiously get `Call to undefined function wp_insert_category()` That puzzles be as well because I thought that hook meant all of Wordpress was loaded. Any advice would be greatly appreciated. Thanks.


title: Can I just copy and duplicate a WordPress installation?

text: I have a virtual server at Strato with Plesk 11 installed. There I got offered to install WordPress and created a blog. All fine. It has created a "/wordpress" folder on my server's `httpdocs` directory. Say, I wanted to have a second installation of WordPress on the same server, running a different blog. Can I just go and duplicate the WordPress subdirectory? Is everything that is needed for WordPress inside that folder?


title: How to Add Custom CSS to the Media Thickbox?

text: I've added a couple of custom fields to the Edit Media screen, but when these are displayed in the WP Media Thickbox (when adding images from the Edit Post screen, for example), the styling is gone. Is there a hook to add my custom CSS to the Thickbox Iframe when it loads?


title: Query Custom Post Type and sort by year

text: How do I create a page template were I can query all the posts from the Custom Post Type - let's say - "project" and order the results by year, displaying the year value at the beginning of each group .


title: Usage of custom post types in a custom admin menu

text: This question is a little hard to explain but i will try to be as clear as i can: I have a custom theme that i am presently working on, within this theme i have added a top level menu in wp-admin with 5 submenus below it. In one of these submenus i wish to add custom post types where admin user can create and edit posts and not have to go through the default WP process of Posts >> Add New. The reason i want to do it this way is that the custom post types will contain hooks to include certain calls to an API (user tokens, keys, xml etc) and i want to avoid the confusion of the end user creating posts away from what are to be core functions of my theme. At present i have no code worked out, (im not asking for it either) as you may understand googling on the lines of "custom post types admin menu" etc just throws back all sorts of irrelevance, do any of you gurus have a pointer where i can get a heads up on how to implement this?. Regards Martin


title: Wordpress subdomain wp-admin redirects to main domain

text: we have a wordpress installation running on address www.example.com. We wanted to have a development site for it as a subdomain, so we created a subdomain dev.example.com on cpanel. Created a duplicate of its database and replicated the files to the directory root of dev.example.com. Then modified wp- config.php to point to the duplicate db. Now the problem is, when we try to access dev.example.com/wp-admin, it redirects to https://www.example.com/wp- login.php?redirect_to=https%3A%2F%2Fdev.example.com%2Fwp-admin%2F&reauth=1 Anybody can help me with this?


title: Make page tab link to pdf

text: I'm sure this is ridiculously simple, and I'm just missing something very basic. I have a CV as a pdf. I'd like to have the tab that says CV open up that CV as a pdf. I do not want to embed it as a Google Doc or anything. **EDIT:** Including link to my site. http://adamgoodkind.com/. I'd like the "CV" tab to bring up the pdf.


title: Multiple portfolios and single item in two of them (ideas?)

text: I’m creating a theme at the moment and has come to a point to decide what is the best solution to have implemented for a theme with multiple portfolios. If there is a project that is in the two of them, and its single page is clicked, where will the Back to Portfolio link points to? Is there a way for the back button to refer to that portfolio from which the item is viewed?               $back =$_SERVER['HTTP_REFERER']      Doesn’t seem to work correctly because say that the admin has clicked Preview Page on the Single Item admin page, and click Back To Portfolio, it will navigate him back to the admin panel =\ How do you guys deal with items in multiple portfolios? I can’t wrap my head around it. Any help will be greatly appreciated!


title: Image quality based on image size

text: Is it possible to set the image quality based on the image size? I'd like to have better image quality for larger images (80) - and worse for small thumbnails (30). I was expecting a parameter at `add_size` to control that - but there is none. If it matters: I'm using ImageMagick.


title: Using "Read More" link with custom excerpt

text:
The following functions.php edit (contributed by helgatheviking on the themeshaper forums) allows the use of a "Read More" link with custom excerpts. My problem is simply this: I'm inept at editing functions.php code, but I'd like to safely remove the "wrap excerpt in p tag" portion of this script. How would I do so? Thanks. Original script is found here: http://themeshaper.com/forums/topic/enclosing- excerpt-in-paragraph-tag-038-adding-a-custom-read-more-link               // excerpt read more links and wrap excerpt in p tag     function all_excerpts_get_more_link($post_excerpt) {         return '
' . $post_excerpt . '
' . '
ID) . '">' . 'Continue Reading &raquo' . '
';     }     add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');


title: Pagination does not work on Custom Post Type archive while trying to get load more function working

text: Im trying to get a load more function to work with a custom post type on an archive page. I use this plugin and customized it a bit so it works with a custom post type. http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/ Currently pagination doesn't work so that the plugin can't load more items. It says "inbeeld/page/2/ 404 (Not Found)". So my question is why does the pagination do not work? This is the register_post_type code.               $inbeeld_args = array(         'label' => __('In Beeld'),         'singular_label' => __('In Beeld'),         'public' => true,         'query_var' => true,         'show_ui' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => array("slug" => "inbeeld", 'with_front'=> false, "pages" => true  ),         'has_archive' => true,         'supports' => array('title', 'editor', 'taxonomy', 'thumbnail'),         'taxonomies' => array('teams'),         'add_new' => _x('Nieuw', 'In Beeld'),         'add_new_item' => __('Voeg Nieuw In Beeld Toe'),         'edit_item' => __('Bewerk In Beeld'),         'new_item' => __('Nieuw In Beeld'),         'view_item' => __('Bekijk In Beeld'),         'search_items' => __('Doorzoek In Beeld'),         'not_found' =>  __('No In Beeld found'),         'not_found_in_trash' => __('No In Beeld found in Trash'),         'pages' => true     );     register_post_type('inbeeld',$inbeeld_args);      And this is my loop. I removed some code that nothing has to do with my question.               <?php          $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $query = new WP_query(array('post_type' => 'inbeeld','paged' => $paged, 'posts_per_page' => 2  ));     while ($query->have_posts()) : $query->the_post();     ?>       <li>         <?php the_title(); ?>       </li>          <?php endwhile; wp_reset_query(); ?>


title: Why is the phone number a hyperlink on desktop sites, in my widget?

text:
Here is the `widget` function from a widget I created. For the phone number, I don't understand why it is making it into a hyperlink on desktop sites, using the value of the if before (`$gplus`) for the hyperlink. Please can someone explain?               class phone_social extends WP_Widget {              function phone_social() {             parent::WP_Widget(false, $name = __('Phone and social widget', 'phone_social') );         }              function form($instance) {             if( $instance) {                 //$title = esc_attr($instance['title']);                 $email = esc_attr($instance['email']);                 $facebook = esc_attr($instance['facebook']);                 $twitter = esc_attr($instance['twitter']);                 $gplus = esc_attr($instance['gplus']);                 $telephone = esc_attr($instance['telephone']);             }              else {                 $email = '';                 $facebook = '';                 $twitter = '';                 $gplus = '';                 $telephone = '';             }     ?>
             <label for="<?php echo $this->get_field_id('email'); ?>"><?php _e('Email:', 'wp_widget_plugin'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('email'); ?>" name="<?php echo $this->get_field_name('email'); ?>" type="text" value="<?php echo $email; ?>" />

             <label for="<?php echo $this->get_field_id('facebook'); ?>"><?php _e('Facebook URL:', 'wp_widget_plugin'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('facebook'); ?>" name="<?php echo $this->get_field_name('facebook'); ?>" type="text" value="<?php if(empty($facebook)) { echo "http://";} else { echo $facebook; } ?>" />

             <label for="<?php echo $this->get_field_id('twitter'); ?>"><?php _e('Twitter URL:', 'wp_widget_plugin'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('twitter'); ?>" name="<?php echo $this->get_field_name('twitter'); ?>" type="text" value="<?php if(empty($twitter)) { echo "http://";} else { echo $twitter; } ?>" />

             <label for="<?php echo $this->get_field_id('gplus'); ?>"><?php _e('Google Plus URL:', 'wp_widget_plugin'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('gplus'); ?>" name="<?php echo $this->get_field_name('gplus'); ?>" type="text" value="<?php if(empty($gplus)) { echo "http://";} else { echo $gplus; } ?>" />

             <label for="<?php echo $this->get_field_id('telephone'); ?>"><?php _e('Telephone ', 'wp_widget_plugin'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('telephone'); ?>" name="<?php echo $this->get_field_name('telephone'); ?>" type="text" value="<?php echo $telephone; ?>" />
     <?php          } // end 'form' function              function update($new_instance, $old_instance) {             $instance = $old_instance;             // $instance['title'] = strip_tags($new_instance['title']);             $instance['email'] = strip_tags($new_instance['email']);             $instance['facebook'] = strip_tags($new_instance['facebook']);             $instance['twitter'] = strip_tags($new_instance['twitter']);             $instance['gplus'] = strip_tags($new_instance['gplus']);             $instance['telephone'] = strip_tags($new_instance['telephone']);                  return $instance;         }              function widget($args, $instance) {              extract( $args );             $telephone = $instance['telephone'];             $email = $instance['email'];             $facebook = $instance['facebook'];             $twitter = $instance['twitter'];             $gplus = $instance['gplus'];                  echo $before_widget;             echo '
';                       if( $email ) {                   echo '';               }                   if ( $facebook ) {                  echo  '';               }                  if ( $twitter ) {                  echo  '';               }                   if ( $gplus ) {                  echo  '';               }                   //If you add an ID to your link inside the wp_is_mobile() conditional, do you see that same ID on the front end?             if( $telephone ) {                 if ( wp_is_mobile() ) {                      echo  "$telephone
";                     //tel:$telephone                 }                 else {                      echo '
' . $telephone . '
 ';                  }             }                   echo '
';             echo $after_widget;         }     }        add_action('widgets_init', create_function('', 'return register_widget("phone_social");'));


title: Missing Update Link to 3.02/3.03 on Dashboard

text: Since upgrading to WP 3.0.1, a couple of my sites no longer display the update link to 3.02/3.03 on the Dashboard or on the Updates page. On one site, I tried re-applying permissions, but this didn't change a thing. There are no plugins related to 'hiding' update/nag messages. All the sites have been around since 2.7.


title: Meta Boxes: 'admin_init' or 'add_meta_boxes' hook?

text: When setting up meta boxes in a custom post type I've been do so using the `add_meta_boxes` hook, e.g.               add_action('add_meta_boxes', 'meta_box_setup');     function meta_box_setup()     {         add_meta_box(              'mb_movie_review',              'Movie Review Details',              'display_movie_review_mb',              'movie-reviews',              'side',              'high'          );     }      But I've just read this tutorial which does the following using the `admin_init` hook, like so...               add_action('admin_init', 'meta_box_setup');     function meta_box_setup()     {         add_meta_box(              'mb_movie_review',              'Movie Review Details',              'display_movie_review_mb',              'movie-reviews',              'side',              'high'          );     }      This is the first time I've seen it done using the `admin_init` hook. **Question** The latter method (using `admin_init`) **does** work but ...   * is this the **_preferred_** method? (i.e. more optimized?)   * just a **_different_** way of achieving the same results, or    * a **bad** way to add meta boxes? (if so, why?)


title: Add validation and error handling when saving custom fields?

text:
I have a function that defines a custom field on a post type. Say the field is "subhead". When the post is saved, I want to do some validation on the input, and display an error message on the post edit screen if necessary. Something like:               // Handle post updating     function wpse_update_post_custom_values($post_id, $post) {              // Do some checking...         if($_POST['subhead'] != 'value i expect') {                  // Add an error here             $errors->add('oops', 'There was an error.');              }              return $errors;          }      add_action('save_post','wpse_update_post_custom_values',1,2);      I'm trying to hook this to the save_post action, but I can't figure out how to handle errors. There doesn't appear to be an error object passed into the function, and if i create my own WP_Error obj and return it, it's not respected by whatever mechanism spits out errors on the post edit page. I currently have an on-page error message inside my custom meta box, but this is less than ideal--I'd rather have a big, red, up-at-the-top error like WP normally displays. Any ideas? **UPDATE:** Based on @Denis' answer, I tried a few different things. Storing errors as a global didn't work, because Wordpress does a redirect during the save_post process, which kills the global before you can display it. I ended up storing them in a meta field. The problem with this is that you need to clear them out, or they won't go away when you navigate to another page, so I had to add another function attached to the admin_footer that just clears out the errors. I wouldn't have expected that error handling for something so common (updating posts) would be this clunky. Am I missing something obvious or is this the best approach?               // Handle post updating     function wpse_5102_update_post_custom_values($post_id, $post) {              // To keep the errors in         $errors = false;              // Do some validation...         if($_POST['subhead'] != 'value i expect') {                  // Add an error here             $errors .= 'whoops...there was an error.';              }              update_option('my_admin_errors', $errors);              return;          }      add_action('save_post','wpse_5102_update_post_custom_values',1,2);               // Display any errors     function wpse_5102_admin_notice_handler() {              $errors = get_option('my_admin_errors');              if($errors) {                  echo '

' . $errors . '

';              }             }     add_action( 'admin_notices', 'wpse_5102_admin_notice_handler' );               // Clear any errors     function wpse_5102__clear_errors() {              update_option('my_admin_errors', false);          }     add_action( 'admin_footer', 'wpse_5102_clear_errors' );


title: Dynamically add a keyword to url with a specific template

text: I'm working on a site that is going to have two parts. Its going to have the regular marketing website and its going to have lots of landing pages constantly being drafted up to test things. My questions is how do I categorize the landing page template to automatically insert a /lp/ at the end of the url so we always know its a landing page. So instead of www.website.com/page1 I want it to be www.website/lp/page1 and I want that done as soon as they pick that specific landing page template. Ive built my template and everything works great I just don't know how to get the /lp/ to dynamically appear.


title: How to setup a membership system in Wordpress?

text: I have been setting up a wordpress for a business memberships, where the business sign up and list their company information to our site. Once they become a member their company listing and what they offer is supposed to be listed on in certain categories (which will be populated on the homepage). I need to know how to create a membership page for sign up. So when the person signs up they are listed in a certain category that will be listed on the home page. Hope I gave enough details on this matter. Im using version 3.0.3. I would appreciate any help/advice. Thanks a lot.


title: How do I move a Wordpress site to another server?

text: i'm using this sql.. but it does not work               UPDATE wp_options SET option_value = replace(option_value, 'http://old.com, 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl';          UPDATE wp_options SET option_value = replace(option_value, 'http://old.com', 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl';          UPDATE wp_posts SET guid = replace(guid, 'http://old.com,'http://new.com');          UPDATE wp_posts SET guid = replace(guid, 'http://old.com','http://new.com');          UPDATE wp_posts SET post_content = replace(post_content, 'http://old.com, 'http://new.com');          UPDATE wp_posts SET post_content = replace(post_content, 'http://old.com', 'http://new.com');          UPDATE wp_faquestion SET QuestionAnswer = replace(QuestionAnswer, 'http://old.com, 'http://new.com');          UPDATE wp_faquestion SET QuestionAnswer = replace(QuestionAnswer, 'http://old.com', 'http://new.com');          UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old.com, 'http://new.com');          UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old.com', 'http://new.com');


title: Get an uploaded attachments local server path?

text: All the wordpress functions for retrieving media details seem to give you the web url of a file uploaded. I want to the local server drive/folder path, ideally relative to the install of wordpress. I have the attachment id value to hand so can parse that to a function, if only I knew what it was. Is this possible with a function built in that I've missed? If not does anyone have anything pre-written for this function?


title: add a woocommerce shop to every buddypress user

text: I'm creating a social network site with buddypress and woocommerce. I want to enable every member to purchase from others and to sell their products online. > That is, every user must assigned to a woo-commerce category at the time of > signup and their products will be listed in the sub of category. For every > category, there should be a separate pay-out account (like paypal). I want to achieve this without using the buddypress-multisite feature. What I am after: > I want an idea behind it, any code snippets, examples or plugins. All answers and suggestions are welcome. Thanks in advance.


title: How to link to theme options page from anywhere in admin?

text: I've managed to add my own menu to the admin bar. I want the first menu item to link to my theme's options page. For example, is this 100% bulletproof or is there a direct method?               echo 'Theme Options';


title: WP 3.3 How to Add Menu Items to the Admin Bar?

text: ![enter image description here](http://i.stack.imgur.com/dfnwT.png)I've just installed the Yoast SEO plugin and noticed that a new flyout menu was added to the admin bar once the plugin was activated. Anyone know is there is a tutorial or example on how this is done?


title: Removing strip_tags not working on nav_menu_description

text:
So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp_nav_menu call in header.php to call the custom walker. Added text to the descriptions. All good... but then I decided I wanted to add breaks via HTML... Dammit they're being stripped out. Oh, right, I need to turn off that filter. So I do, via the correct line in functions.php. ONly, it doesn't work. The HTML is still being stripped. Before I go on, here's the walker I'm using with the filter removal line after it:               #new walker to enable description text under menu items.          class description_walker extends Walker_Nav_Menu         {           function start_el(&$output, $item, $depth, $args)           {                global $wp_query;                $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                     $class_names = $value = '';                     $classes = empty( $item->classes ) ? array() : (array) $item->classes;                     $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );                $class_names = ' class="'. esc_attr( $class_names ) . '"';                     $output .= $indent . '
ID . '"' . $value . $class_names .'>';                     $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';                $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';                $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';                $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                     $description  = ! empty( $item->description ) ? '
'.esc_attr( $item->description ).'
' : '';                     if($depth != 0)                {                          $description = $append = $prepend = "";                }                      $item_output = $args->before;                 $item_output .= '';                 $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;                 $item_output .= $description.$args->link_after;                 $item_output .= '';                 $item_output .= $args->after;                      $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                 }     }          ## Function to stop HTML removal from menu descriptions         remove_filter('nav_menu_description', 'strip_tags');      More info: The HTML is recorded in the database, so it's present there... just not on output. This is in Wordpress 3.3. For clarity, here's the code that calls the menu in header.php:                           <?php                  wp_nav_menu( array(                     'theme_location' => 'primary',                     'depth' => 0,                     'walker' => new description_walker())                     );                 ?>      I have that sinking feeling I'm missing something basic and just need a new pair of eyes on this... any ideas?


title: WP plugin management

text: We have a wordpress MU install, one thing I'm missing is some sort of plugins version management. Currently, when auto-updating a plugin, I need to place full trust the developer that the plugin won't break anything, something I'm not always 100% comfortable doing. Is there any kind of plugin manager or plugin deployment process that allows me to easily roll back plugins the previously installed version.


title: Redirect Admin User in Dashboard

text: I am currently trying to setup a redirect so that my admin users are redirected to a page other than the dashboard within the wordpress administrator interface. If I leave out my conditional, the redirect works, but then it also redirects non-administrator users as well and I don't want this. Here is the code I have within functions.php               add_filter('login_redirect', 'dashboard_redirect');     function dashboard_redirect($url) {       global $current_user;       get_currentuserinfo();       $level = (int) $current_user->wp_user_level;            if ( $level > 10  ) {         $url = 'wp-admin/edit.php';       }            return $url;     }


title: How to add a custom field in the advanced menu properties?

text: Is it possible to add a custom field to menu items? What I want to do is be able to add a field for 'French Navigation Label' and a 'French Title Attribute' in the wp menu interface.


title: Post per page not working

text: I have 2 parent categories are app and game. Beside them has child categories. My code get 6 post from 2 parent categories with orderby post date and order DESC, but post per page not working. Please help me solve this problem. Here my code :               <?php           $args = array(          'cat'=> 42,     'orderby'          => 'post_date',     'order'            => 'DESC',     'posts_per_page' => 6,          );          $the_query = new WP_Query( $args );          while ( $the_query->have_posts() ) :           $the_query->the_post();          ?>


title: Multiple homepage layouts as selected by user from theme options

text: I am working on a theme which will enable users to select multiple layouts from the theme options panel. What I did so far is to create multiple theme files, depending on each theme, put it in a directory and let the user select an option from the themes panel. Then relate the option and include it in `front-page.php`. All is working fine, except for a custom post type: _portfolio_. It gave me the results I needed using this loop :               global $wp_query;          $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('post_type=portfolio&paged='.$paged);     if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();  ?>      It did as required, output the posts, but it made the navigation disappear and pagination broke as well. Pagination is giving a 404 on page 2 (it is considering this as the main query maybe...) So for that I used this function:               function alter_query_portfolio($qry) {        if ( ! is_main_query() ) {            if ( 'portfolio' == $qry->get( 'post-type' ) ) {                     $qry->set('post_type','portfolio');            }              }     }             add_action('pre_get_posts','alter_query_portfolio');        It didn't fixed it. What should I do about it?


title: How resource intensive is wp_register_script()?

text: I'm trying to use the `has_shortcode()` function to only load certain scripts when there is a shortcode in the post's content, with this code:               wp_register_script( 'shortcode-js-file' , FILE_URI, array( 'jquery'), '', true );          if(isset($post->post_content) && has_shortcode($post->post_content, 'shortcode_name')) {       wp_enqueue_script( 'shortcode-js-file');     }      So in the above code, I'm registering the script on all pages, whether there is that shortcode in the post or not, and if there is that shortcode, then I'm enqueuing the script for it. What I want to know is whether I should put the `wp_register_script` inside the `if` statement or not. If it is not too resource intensive then I would rather leave it outside, as I want to put all the `wp_register_script` code together in one function. PS. To showcase my problem clearly, I didn't add the hook and functions that I'm using, as it's not important for what I want to inquire.


title: Is it necessary to use a WordPress nonce when allowing users to download public data?

text: I am using jQuery `.load()` to load the next page of WordPress posts after a button is clicked. The next page of posts is public data (no access restrictions on it whatsoever). Should I use a WordPress nonce check in this situation? If so, then please explain why. Thanks in advance.


title: Continuous Login Sessions For Super Admins Across Multi-Site Network of Sites

text: I've looked around on WPSE, and WordPress.org and Google. Can't seem to find much information on this topic. Is it possible to enable continuous login sessions across all WordPress Multi- Site linked domains for Super Admins only? It's really quite a hassle to manage all the linked sites, and having to re- authenticate each time, and always entering the same information each time. If anyone has input on this, whether it be good or bad feedback regarding my question, I would like to learn more information on this topic.


title: Post/page without slug

text: I have posts that are full posts with page content and images, etc. Then I have potential future posts, which I still want to list on my category pages, but that do not have content yet and do not deserve their own page. I want to be able to set their slug to nothing, or to a standard "null" sort of value that I can query on, so that I don't add links to page stubs. Everything I am finding on the subject is about how to remove custom post type slugs or about stubs in the Wordpress documentation. Is there any way to make "stub" posts that don't actually have a permalink? (no post_name in the db) Thanks for reading. **Edit** To clarify, I do not mean for these posts to be hidden from the public. I want them to show on my category pages, without a link to a single post page. Aside from not having a link, they should be just like a full, finished post. In concept, they are published posts - they are just not fleshed out yet. However, in some places I need to be able to query all of the finished posts, or all of the stubs, separately. **Why?** I have a map showing the locations of all of the posts, finished and stub. I want them all to show on the map, but only the ones with a full write up should actually have a link to "single" page. The stubs should only show on the map, and not have links. At some time in the future, I will go back to some of the stubs and write more about them, at which time they would get a link as well. Leaving the slug blank was a transparent way of showing that a stub doesn't have its own page, I thought. I was also concerned that marking them as Draft would have consequences when I tried to list the stubs. I also use the post status in my workflow, so re-using the draft status for something other than actual draft status will cause confusion. I will use Review Pending instead, but perhaps you can see why I was looking for more of a solution and less of a workaround. TL;DR?


title: Widgets not expanding on wordpress 3.3 widget dashbord

text: I updated to WordPress 3.3 (manual update) and cleaned browser cache. Widgets dashbord stop working when tring to expand dynamic sidebars for custom theme when it works for previous wordpress 3.2 installation (using register sidebar on functions.php) I have tried to install Hotfix 0.8 exension and now it works for twentyten theme but not for my custom theme. What can I do?


title: How can a 'scripts' directory be hooked into wp_head();?

text: So I'm trying to get my head round `<?php wp_head(); ?>`. I understand that it loads in the stuff needed for plugins etc., but I'm using a theme that seems to be using it to load in scripts for theme elements as well. There's a folder within my theme called 'scripts' that appears to have all of the javascript needed for the theme. In the outputted code is all of the javascript files etc. So my question is: How do I hook in a javascript file (or anything for that matter) into `<?php wp_head(); ?>`?


title: Custom Same Page Search

text: I've added a custom form to one of my page templates. It submits to itself `$_SERVER['REQUEST_URI']` in hopes I can grab the `$_GET` values and modify my query using `pre_get_posts`, but instead it goes to 404. So to clarify, I don't want to use search.php, I want it to post back to my page template and modify my query to show the "filterd" results instead of 404ing. I've tried using `pre_get_posts` to test if it's 404 or search, but I also don't want to stop anything else from 404ing. So how can I use a query on the same page / url / page template without needing to reply on `search.php` or having my query cause a 404? So with the custom search form in place the url is currently `http://mydomain.com/page-slug/?year=1111` - and I want to modify the query on the specific page depending on the `$_GET` value.


title: Display authors Whos write in category

text: i have block that display all category in custom post type of my site like this:-               $cat = get_terms( "progamdvideo_c", $args ) ;      now in post type i add article, each article have authors, how can display him in this block.


title: Related posts widget

text: I need a widget that does displays the following for related posts   * Post Title   * Thumbnail Preferably it displays related posts _by category_. * * * So far I tried these widgets, which are partly working or don't working (with WP v3.3): **Partly working:**   * "Related Links by category": works, but no thumbnails   * "Posts by same category widget": works, but no thumbnails   * "Widgets of Posts by Same Categories": works, but no thumbnails **Not working** :   * "YARPP - Yet another related posts plugin": shows up, but nothing related.   * "ELI's Related Posts Links and Widget": doesn't even show up in the widget list   * "Related Posts widget": doesn't show up in the sidebar


title: How can I test how fast or slow my wordpress website it?

text: I have my FIRST wordpress website and I love it, however I'm not sure if it's my browser (Firefox 8.0.1 for Mac) or my computer or the website itself but it's going really slow. MY SITE is in the finalizing stages and I want to make sure it's smooth. This is my first wordpress site so I can see myself adding a lot of things and maybe slowing it don that way? First off, is it slow for you guys? Where is a good site, plugin or article about how to determine how slow/fast your wordpress site it? Is there a handy plugin that can speed it up? Is there somewhere I can check to see how big my site it? What might be a specific thing slowing it down?


title: Why is the_content() not displaying the content?

text: in my wordpress site, the_content() is not showing the content, but $post->post_content shows it, why this is happening? and how can I use the_content again?


title: Redirecting old site links to new site

text: I'm hoping one of you WP gurus can help me out here... I have a website. Let's call it Jack.com I'm re-branding Jack as a girl, so I've made another website website - Jill.com I want all existing links that are spread out over the net to be redirected to the equivalent, sister page eg. Jack.com/article_12 needs to redirect to Jill.com/article12 Also, If the user types in or clicks on "Jack.com/article_12" but they arrive at Jill.com it's going to leave them a bit confused. So I'd like to intercept the forwarding with a nice visual page that says "Thanks for visiting, Jack is now a girl called Jill, you are being forwarded to Jill.com/article12" and then redirect the user onto their destination after 5 seconds or so on that intermediate page. I'm an experienced developer, but WordPress is a total alien to me and I've never had to do this kind of thing before... Can one of you clever people out there explain how I'd go about doing that ?


title: How to restrict the editors from viewing/editing pages created by admin?

text: In the backend, how can I restrict the editors (user with editor role) from viewing/editing pages created by admin (and/or by administrator role)? I know that the editor role in WordPress have "edit_others_pages" capability, but I need a function for a custom capability like: "edit_others_pages_except_admin" :) I don't want to use a huge/complicated plugin just for that! Thanks! I searched for a solution more then 1h :D


title: Show specific category posts on Genesis framework home page

text: My site has Genesis framework and a child theme. I want to show specific category posts on my home page content area. I used the simple post query               query_posts(‘post_status=publish&cat=33&wp_get_recent_posts()’);      in my `genesis/lib/structure/loops.php` file right above the `do_action( ‘genesis_before_post’ );`, but it makes no sense . So at last I used this grid loop but using this I am still unable to show category specific posts on home page as it is not taking the category attribute. The main problem is this: by clicking on a particular post link the post doesn’t open on a separate page it redirects to the same page.


title: Adding a 'style=' bit to image_send_to_editor output

text: The best thing I liked about the new v3.5 media manager was being able to insert images to a post hosted by an external site like photobucket using "Insert from URL". I normally format my image inserts manually and was hoping "Insert from URL" would reduce some of my work. Unfortunately I can't add anything to the img src tag that is generated. Specifically I use the alignright class alot but this is ignored in the RSS feed so if I republish my blog post on a non-wordpress powered site the images aren't floated. I want to add an extra style="float:XXX" to the code that is sent to the editor to cover that issue. If $align is 'right' then it outputs float:right and so on. I am doing this as a personal plugin and I got it activated but it doesn't output anything when I use "Insert from URL" I've searched all these help sites and really haven't found anything exactly as I need and my experience level with PHP and wordpress is kind of low (I understand the concepts but have trouble with the syntax) The closest I got was this previous question: Need help building a filter to edit the output of “image_send_to_editor” Here is the function I have so far and any hints or tips on what I am doing wrong will help me.               add_filter('image_send_to_editor', 'dlb_filter_fl',10,8);          function dlb_filter_fl ($html, $id, $caption, $title, $align, $url, $size, $alt) {          if ($align == 'right');          $html = '<img src="' . $url .  '" class="' . $align . '" style="float:right" />';               return $html;     }      I could be using the wrong filter. I'm not sure. Right now the code is active and get no fatal errors but it doesn't add anything to my img scr tag.


title: adding image to post thumbnail from another server

text: i have a image gallery site, each post in site have thumbnail and image in post, now i want get _file server_ for uploaded image.   how can i add thumb image from another server? or how can i change the destination image uploader to file server?   or any other solution.   tnx 4 adv.


title: Login/logout in header

text: I am looking to move the login / logout / my account / register details currently situated under my menu bar to above the menu bar. Essentially I want to add the details just after the header. What do I need to add to my `functions.php` file in my child theme for this to work?


title: Order by title without taking into account 'the'

text: I currently have episodes from a TV Show that feature bands playing, so for example I have:   * Moby    * The Dandy Warhols   * The Kooks My wp_query looks like this:               $loop = new WP_Query(array('post_type' => 'episodio', 'cat' => '9', 'posts_per_page' => 90, 'orderby' => 'title','order' => 'ASC'  ));      But I want to order them like this, alphabetically, without taking into account 'the':   * The Dandy Warhols   * The Kooks   * Moby There are a lot of records in the database, so it's not very practical and/or efficient to get everything into an array, remove 'the', order again and then going through the array to display the data. Is this possible in WP_Query? Maybe through a filter? Thanks a lot in advance! :)


title: When replacing #site-title with an image - why must it be located in root?

text: I needed to replace the `#site-title` text with an image and I found a great blog post explaining this: http://bentcorner.com/replacing-wordpress-twenty-eleven-site-title-with-an- image/ But it appears that the image to be placed in `background: url(/header.png) #fff no-repeat;` must always lie in the root directory (`~/public_html`). I am using a Twenty Elven **child** theme and I tried to place the image file in the `images` subdirectory of the child theme, but when I do this no image is visible. So far, the solution described in the article only works if the image is placed in the root directory. Why is that? Is there a way to allow the image to be placed in the images subdirectory of the child theme?


title: How to get larger version of author avatar

text: I am trying to incorporate author avatars into my posts by doing `<?php echo get_avatar( get_the_author_meta('ID'), 150 ); ?>` but I can't go larger than 50x50px without it getting stretched (since the image is only 50x50px). It is using the BuddyPress thumbnail of the avatar. How can I get it to use a larger thumbnail version or is there another function I can try?


title: How to output number of comments with link to comments

text: If there are comments, I want to wrap the amount eg "5 comments" in the link to the comments section of the post, but when I add the echo for comments_link it errors.               <?php comments_number(      '',      'With: 1 Comment',      'With: % Comments' );      ?>      Think I'm having trouble dipping in and out of php and html. Any help would be very much appreciated. ==== EDIT ==== Not sure if get_comment_count is still used but I've got it working using the below:               <?php $comment_count = get_comment_count($post->ID); ?>     <?php if ($comment_count['approved'] > 0) : ?>With: <?php comments_popup_link(      '', // No comments exist, you would probably want to display a link here in order for people to add the first comment     '1 comment', // 1 comment, usually phrased differently     '% comments' // > 1 comment     ); ?>     <?php endif; ?>


title: BuddyPress user bio in profile

text: I am trying to figure out how to have a user bio in the user profile using BuddyPress. For example, on this page http://buddypress.org/community/members/johnjamesjacoby/activity/just-me/ where it says "I help lead the BuddyPress and bbPress projects. I also like puppies, potato chips, and a good nap." I'm assuming it's default behavior since it's on the BuddyPress site, but if it's not, that might be why I'm having issues. Is that a BuddyPress plugin? How can I get that implemented?


title: How Can I Put Meta_Compare in the Database-Query?

text: Yes, I know that this can easily be done with built in wp_query but I need this in Wpdb query. I have a custom field and I need to display posts where this field does not exist. By the way can I get the same results with a normal wp_query? The code is below:                $posts = $wpdb->get_results( $wpdb->prepare(      "SELECT ID, post_title, post_name FROM wp_posts      INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)      INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)      INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id =      wp_term_taxonomy.term_taxonomy_id)      WHERE      wp_term_taxonomy.term_id = 1      AND wp_postmeta.meta_key = 'my_meta_key'      AND META_COMPARE = 'NOT EXISTS'      AND post_type = 'post'      AND post_status = 'publish'       AND post_title LIKE %s ORDER BY post_title ASC",      $letter . '%'      ));


title: get current page number with wp_link_pages()

text:
I would like to get only the current page number (without HTML). I'm using               wp_link_pages( array ( 'pagelink' => '%' ) );      How can I do that? I'm also using this code in my theme:               function single_split_page($defaults) {     $args = array(     'before' => '

' . __('Pages','theasd'),     'after' => '

',     'pagelink' => '%',     );     $r = wp_parse_args($args, $defaults);     return $r;     }


title: Content hooks vs User hooks

text: This is more of a theory question than a question with a direct answer. I've been working with different actions for firing functions when a post is updated or deleted and when users are updated or deleted. For the actions, `publish_post` and `before_delete_post` for the posts and `personal_options_update`, `edit_user_profile_update` and `delete_user` for the users. With post update you get access to the values that are currently set and the values the new values at the same time to make any changes you see fit before anything happens. With user update you only have access to the new information and only after it's already been set. **Is there a reason for this difference or is this just inconsistent?** ...and don't get me started on publish_{custom_post_type} vs before_delete_post.


title: Which hook should I use for this scenario regarding the registration process and account/profile update?

text: I would like to run a PHP script "ONLY" when a user successfully fills out the WordPress Registration form and submits it as well as when a user updates their profile. Here's what I have so far,               Registration     ----------------     function soapConn() {         if (!isset($_POST['submit-btn'])) {              } else {             // If pressed, run the script                  // Should I check for validation here? Such as if the inputs are empty?                  require_once locate_template('include/xxxx.php', true);         }     }          add_action('registration_errors', 'soapConn');                    Update user profile     -------------------          add_action( 'profile_update', 'my_profile_update', 10, 2 );          function my_profile_update( $user_id, $old_user_data ) {          require_once locate_template('include/xxxx.php', true);     }      By doing it this way, it could save me the trouble from listening to the registration/profile update submit button in the PHP script file. Can someone please assist and confirm that this is the right way to approach this problem? Thank you for your time.


title: How to add multiple images to a custom post type single post?

text: I have created a custom post type and I need to add multiple images to every single post, so I can create a loop and use them in a slider. So far my search on Google etc. has turned up nothing. What's the cleanest way to add a metabox to the custom post type, so I can add images to the post and create a loop to display them in a slider/gallery?


title: Setting a featured image while creating the post

text: I am creating a post with wp_insert_post/wp_update_post. The post should have a featured image. But to set a featured image I need the postID. The problem is I do not have any postID. What I am doing is. I create a "profile page" for every user. Therefore the user just updates his data in the backend. The post is created automatically out of the data. I tied things like:               set_post_thumbnail( wp_insert_post($post), $thumbnail_id );      But is does not work. Surprisingly `set_post_thumbnail( wp_update_post($post), $thumbnail_id );` works. But in case I want to create a pot the first time, I need wp_insert_post. I can provide the full code on request. Any ideas? Thanks and regards Nico


title: How to loop custom post type posts by author?

text: Maybe I'm not doing things the proper way, but it seems to be working very well. Also, this question title is so confusing. I don't know how to ask the question. Perhaps someone can help edit? Thanks. Question: I have a custom post type: "employee" Every "employee" CPT has a CPT Post with: "Firstname Lastname" + bio + image + metadata. Example: John Doe (id=1234) I have a single-employee.php template that outputs the single employee. Everything works great. Here's the hard part: the way this is setup, I HAVE TO separate employees from authors. So that's why I created a CPT. However, many employees are also registered blog authors. So they actually have blog posts that do exist. * _How can I loop through the employee CPT and output a UL of all blog posts by a single employee? *_ Thank you


title: Link to most recently created category of custom taxonomy in primary navigation menu

text:
I have a custom taxonomy called Issues (like magazine issues) with categories named after the title of each issue. I created a page called "Current Issue" and added a link to it in the main navigation of the site. This is the loop I have in the page template now:               $categories = get_terms('issue', 'orderby=count&order=asc');      foreach( $categories as $category ):       ?>
<?php echo $category->name; ?>
      <?php      $posts = get_posts(array(      'post_type' => 'issue_posts',      'taxonomy' => $category->taxonomy,      'term' => $category->slug,      'nopaging' => true,      ));      foreach($posts as $post):       setup_postdata($post);       It does order the categories and posts appropriately, but this pulls in all the posts for all the categories. I need the link to show only the posts from the most recent category. Thanks in advance for any help


title: add_action hook for completely new post?

text: > publish_post Runs when a post is published, or if it is edited and its > status is "published". Action function arguments: post ID. -Plugin API Documentation I've added the publish_post hook to a WordPress plugin that I'm writing. The function called by the hook itself, is meant to change the categories of several posts using the wp_update_post function. This hook does not work however as the result returned from running wp_update_post is always 0. My best guess is that running wp_update_post causes another instance of my hook to run because it re-publishes the post...which I believe brings about the **"...or if it is edited and its status is "published""** of the statement above. Is there any other action-hook that I can use that will only be called when the post added is completely new and not edited?               <?php      /*       Plugin Name: Category Switcher Plugin      Plugin URI: http://www.example.com      Description: When a new post is created this plugin will cause the       Version: 0.1      Author: Me      License: GPL2      ?>     <?php     class categoryShifter {       function shiftCategories($post_ID) {              $maxNumPostsFirstTeir = 4;              $first_teir_cat = "Fresh News Stories 1";         $second_teir_cat = "Slightly Dated Stories 2";                $firephp = FirePHP::getInstance(true);              $firephp->info('BEGIN: categoryShifter.shiftCategories()');              $firephp->log($post_ID, 'post_ID: ');         $firephp->trace('trace to here');                  $first_teir_id = categoryShifter::getIDForCategory($first_teir_cat, $firephp);          $second_teir_id = categoryShifter::getIDForCategory($second_teir_cat, $firephp);              $firephp->log($first_teir_id, '$first_teir_id');         $firephp->log($second_teir_id, '$second_teir_id');                 $qPostArgs = array(           'numberposts' => 100,           'order' => 'DESC',            'orderby' => 'post_date',           'post_type' => 'post',           'post_status' => 'published',            'category_name' => $first_teir_cat         );              $firstTeirPosts = get_posts($qPostArgs);            $firephp->log($firstTeirPosts, 'got posts:');              $firephp->log(sizeof($firstTeirPosts), 'sizeof');                   // NOTE: This appears to work.         for($i = sizeof($firstTeirPosts)-1; $i > $maxNumPostsFirstTeir-4; $i--)          {           $newCats = array($second_teir_id);           $editingId = $firstTeirPosts->ID;           $result = wp_set_post_categories($editingId, $newCats); /* NOTE: Doesn't work presently... returns an array with the $second_teir_id in it. */           $firephp->log($result, 'Result');          }                        /*         $my_post = array();         $my_post['ID'] = 132;         $my_post['post_category'] = array($second_teir_id);                   $firephp->log('Before', 'Before');          if(wp_update_post( $my_post ) == 0) {             $firephp->Error('Fatal Error, Post not updated', 'error');         }         $firephp->log('After', 'After');         */         return $post_ID;       }                 function getIDForCategory($cat_name, $logger) {         $logger->Info("Begin: getIDForCategory()");              $cats = get_categories();                    $whichCatId = "";              foreach($cats as $single_cat) {           if($single_cat->name == $cat_name) {            $whichCatId = $single_cat->term_id;            break;           }         }         $logger->Info("End: getIDForCategory()");         return (int)$whichCatId;       }     }          /* Hook Post Creation */     /* add_action('publish_post', array('categoryShifter','shiftCategories')); */     add_action('wp_insert_post', array('categoryShifter', 'shiftCategories'));     ?>      I've switched to using the wp_insert_post hook for the time being...but I still can't get the wp_set_post_categories function to change the categories of the posts. I understand that I will probably need to update this code so that it takes into account the existing categories of the post and only modifies the ones specified by the plugin, but for now it's really just an alpha.


title: Initialize WordPress environment to use in command line script

text: I have a command line script for maintaining a wordpress plugin and have to load the wordpress core to be able to access wordpress functions. This problem is very similar to Initialize WordPress environment to use in a real cron script. Though it differs from it as the referred question is supposed for use with a (real) cron script which can be accomplished otherwise then by starting a command line php script. As the referred question is already answered and this answer is not satisfying my needs I started this question. So what it is necessary in a command line script to initialize the wordpress environment? **Related**   * Initialize WordPress environment to use in a real cron script


title: pre saved posts query from db options table

text: I found a question about magazine style front pages that queries always only 1 post (or custom_post_types, etc.) from a whole load of different categories, tags or custom taxonomies. I thought about this for a while and came with something like this as a start.               function pre_saved_posts() {         if (             ! is_admin()             OR ! current_user_can( 'edit_posts' )         )             return;              global $post;              // Option-Name         $opt_name = 'theme_post_ids';         // get data from DB         $db_option_value = get_option( $opt_name );         // If there's nothing in the DB, create an array, else add the ID to the array of post_IDs         empty( $db_option_value ) ? $post_ids = array( $post->ID ) : $post_ids .= $post->ID;              // get posts         $posts = get_posts( array( 'include' => $post_ids ) );              // DB-Option @Option-Table updaten or add         empty( $db_option_value ) ? add_option( $opt_name, $posts ) : update_option( $opt_name, $posts );     }     // Do it when a post is updated     add_action( 'save_post', 'pre_saved_posts', 20 );       Would be displayed like this:               $some_posts = get_option( 'theme_post_ids' );     foreach ( $some_posts as $post )     {         // possible for ex.: $post->ID, $post->post_content, $post->post_title, etc.     }      It's not tested and only an example, but maybe there's someone interested in extending this. I still question myself how much sense it makes, but i could imagine that there's one large multidimensional array that contains subarrays for different requests ex.               $some_posts = get_option( 'theme_post_ids' ); $home_posts = $someposts['home'];      If this would be stored in a `global $var`, maybe there could be some performance increase. Ideas/Suggestions/Whatever?


title: Append HTML to an LI of wp_list_categories

text: Im currently using `<?php wp_list_categories('child_of=4&title_li='); ?>` to echo out a list of my categories. I'm wondering how I could append some html (specifically an » to the end of each LI within the link. See this screenshot for an example of what I'm trying to do: http://nikibrown.com/uploads/4662272c3f00c669b17952c10d21901c.png


title: Display Taxonomy Image on single.php

text: I'm using Taxonomy Images, and I can't figure out how to display a category's associated image on a single.php. Essentailly, when a user is viewing a post that utilizes the single.php template, it should display the post's category's image. Right now, it just doesn't display anything. This is the code that I'm using:               <?php          $image_id = apply_filters( "taxonomy-images-queried-term-image-id", 0 );         if ( ! empty( $image_id )):         print apply_filters( "taxonomy-images-queried-term-image", "",  array(             "image_size" => "large"         ) );         endif;     ?>


title: Allow Users Access to Custom Post Type Only

text: I am in a similar situation to this person, only I need a bit more hand- holding. I don't have a good understanding of php but can cut and paste code with the best of them. I have Justin Tadlock's Members plugin, and have set up a custom post type and associated custom taxonomies in my functions.php file. Here's what I'm trying to accomplish:   * User registers and is set as **Contributor** by default.    * User can now see **only** this custom post type and can make an entry to this post type, but not publish it.   * User can only see and edit their own post(s). If possible, I need specifics on what and where to add to my post type registration function. I understand it involves 'map_meta_cap' and 'capability_type' but I don't know how to write the code or where to put it in the function. Once the capabilities are established I can add them as custom capabilities in the Members plugin.


title: WordPress Featured Post Slider

text: Alright, I have almost finished up a clients project in WordPress, but I have hit a wall. I am not really great with jQuery (and I have yet to find a plugin to achieve what they are looking for). The client wants an automatic slider on the homepage that pulls in featured posts out of their five categories. I have scoured the net for plugins to achieve the "look" they want, but to no avail. The look in question can be seen here. Does anyone know how to go about this?


title: Random home page background images with caption text

text:
all. I am developing a Wordpress theme and I need to have a random background image display on the home page with specific text for each image. I have installed the Background Manager plugin (http://wordpress.org/plugins/background-manager/), but it only supports displaying an overlay on image sets, and I don't see an easy way to customize it. As an alternative, I found this website article (http://wpdevsnippets.com/full-page-screen-background-image-slideshow-easy/), which covers a basic script to show random background images. The only way I can imagine to make it work for the site is to add a custom content type to Wordpress for background images, and then allow for a featured image and an excerpt for those content items. Where I'm lost is in how to call these images from a template page (outside of the loop), and then later on, within the page content, call the title or caption from the image that was randomly selected. Here's all of the code from that other site's example. Any help or pointers would be a huge help. HTML:

      CSS:               html, body {         height: 100%;     }     #full-bg img {         position:fixed;         top:0;         left:0;         height:100%;         width:100%;         z-index:-10;         opacity: .9;     }      Javascript:


title: conditionally echo <br /> in meta box data loop

text:
I am working on a Thematic child theme and using the WPAlchemy Meta Box Class to create an 'Artwork Info' meta box that I want to conditionally echo like this at the end of each post: Title   Medium   Dimensions   Additional Info   My instance of the class is defined like this in `functions.php`:               $prefix = 'wpf_';     $artinfo_mb = new WPAlchemy_MetaBox(array     (         'id' => '_custom_meta', // underscore prefix hides fields from the custom fields area         'title' => 'Artwork Info',         'template' => STYLESHEETPATH . '/custom/artwork-meta.php',         'context' => 'normal',     ));      And here's an example of the HTML for each field, located in `artwork_meta.php`:               Title
         <?php $mb->the_field('title'); ?>             <input type="text" style="width:99%" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>
      I am using this function in `functions.php` to print the data in each post via an array of the fields:               function display_artwork_info() {              global $artinfo_mb;          $artinfo_mb->the_meta();         $values = array('title','medium','dimen','additional');               echo the_content();                // loop through and conditionally echo the value with a line break         foreach ($values as $val) {             if ($val != ''){                 $mb->the_value($val);                 echo '
';             }         }      }      add_action('thematic_post', 'display_artwork_info');      All works fine except the `foreach ($values as $val)` always echoes the line breaks, even if the field's value contains no data. For example, if the 'medium' and 'additional info' fields are empty, the HTML echoes like this:               Title

     Dimensions
      Is there something wrong with my loop? Am I using the wrong WPAlchemy function to echo the meta data? Thanks in advance :)


title: Multiple loops in Genesis

text: So I wanted to create two loops on my homepage. One that would display the page's own content, and then a grid loop straight beneath it for fetching the two latest posts from the 'news' category. I couldn't really find a way to do it so I hacked around until I got it working, but I'm not sure this is the right way to be doing things, can anyone tell me what improvements I can/should make to this code? Here's a screenshot of what I have: http://s18.postimg.org/knrq6sert/2013_11_13_22_55_58.png Theme: Metro Template: page-home.php               //* Add support for Genesis Grid Loop     //remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'child_grid_loop_helper' );          function child_grid_loop_helper() {         if ( function_exists( 'genesis_grid_loop' ) ) {                  global $post;              // arguments, adjust as needed         $args = array(             'post_type'      => 'post',             'posts_per_page' => 2,             'post_status'    => 'publish',             'paged'          => get_query_var( 'paged' )         );              /*         Overwrite $wp_query with our new query.         The only reason we're doing this is so the pagination functions work,         since they use $wp_query. If pagination wasn't an issue,         use: https://gist.github.com/3218106         */         global $wp_query;         $wp_query = new WP_Query( $args );             genesis_grid_loop( array(                 'features' => 0,                 'feature_image_size' => 0,                 'feature_image_class' => 'alignleft post-image',                 'feature_content_limit' => 0,                 'grid_image_size' => 0,                 'grid_image_class' => 'alignleft post-image',                 'grid_content_limit' => 100,                 'more' => __( '[Continue reading...]', 'genesis' ),             ) );         }     }          //* Remove the post meta function for front page only     remove_action( 'genesis_after_post_content', 'genesis_post_meta' );          genesis();`      Two things I have not figured out yet.   1. How to change the headings of the grid loop from `<h2>` to `<h3>`. I had to style the `<h2>` on that screenshot so that they would be 1.5 rem rather than the default 3 rem. But ideally they would be `<h3>`.   2. How to remove the post author from those two posts in the grid loop. Any help appreciated.


title: Loading shortcode with ajax

text: I'm trying to load a slideshow if the browser is a certain screen size - i.e. I don't want the slideshow to load on smaller, mobile screens. The slideshow plugin provides a shortcode:               <?php echo do_shortcode('[metaslider id="8302"]'); ?>      But when I try to load it with .load(), it just spits out the string and doesn't run the php. So, looking around it seems that there's a couple of posts related to this: call shortcode in javascript Why might a plugin's 'do_shortcode' not work in an AJAX request? But unfortunately I don't have a high enough reputation to contribute comments to those, so I'm opening a new question. I wonder if anyone can help explain this to someone in a very simplified way to someone who is not good familiar PHP?


title: How to add custom field option with menu?

text: Please take a look at below image. ![enter image description here](http://i.stack.imgur.com/Wbevp.png) Here we can see URL, Navigation Label & Title Attribute under Menu Structure >> Home. I need there a more option called "Data Description". I have a task to write menu code like below with wordpress.               [Navigation Label]      Is there any option to display my menu dynamically like this? Also It should support "current-menu-item" class on current page. I'm a wordpress theme developer & also have some knowledge of plugins development, If there are any way please suggest me.


title: HeadSpace2 double title on homepage

text: I started using HeadSpace2, a meta plugin for WordPress, and it works great so far. I even managed to get the Google description that I wanted with it. Let's call my website for "HomePage", and the head title is "Funny Stuff".   When people access the front page, it shows up as `HomePage | HomePage | Funny Stuff`.   If people click a link to a post, it says `Funny Stuff | HomePage`. How do I fix so it only says `HomePage | Funny Stuff` and not `HomePage | HomePage | Funny Stuff`?


title: Replacing string with a variable in php

text: I have following code in my plugin of Wordpress:               wp_localize_script('ffd_js_script', 'myAjax', array(                 'ajaxurl' => admin_url('admin-ajax.php'),                 'idinfo' => $myoptionValue[idinfo],                 'index1' => $myoptionValue[id1],                 'index2' => $myoptionValue[id2]                 )             );      I want to replace               'index1' => $myoptionValue[id1],     'index2' => $myoptionValue[id2]      with               for($i=1; $i<= $myoptionValue[fieldcount]; $i++)             {                 $arguments .= ',"index"'.$i.'=>'.$myoptionValue[id.$i];             }      So that I have                       wp_localize_script('ffd_js_script', 'myAjax', array(                 'ajaxurl' => admin_url('admin-ajax.php'),                 'idinfo' => $myoptionValue[idinfo]                 $arguments                 )             );      Apparently I'm thinking it might be as simple as this, but it isn't, where is my mistake? EDIT: full code:               require( plugin_dir_path( __FILE__ ) . 'menu.php');     require_once( plugin_dir_path( __FILE__ ) . 'getuser.php');          add_action( 'wp_enqueue_scripts', 'ffd_load_scripts' );          function ffd_load_scripts()     {     $myoption =  get_option( 'fixformdata_options' );     $myoptionValue = maybe_unserialize( $myoption );            $arguments = array();     for($i=1; $i<= $myoptionValue[fieldcount]; $i++)     {         $arguments['index'.$i] = $myoptionValue['id'.$i];     }          wp_register_script('ffd_js_script', WP_PLUGIN_URL.'/FixFormData/js/ffd_js_script.js', array('jquery'));     wp_localize_script('ffd_js_script', 'myAjax', merge_array(array(         'ajaxurl' => admin_url('admin-ajax.php'),         'idinfo' => $myoptionValue['idinfo']),$arguments)         );          wp_enqueue_script('jquery');     wp_enqueue_script('ffd_js_script', plugin_dir_url(__FILE__) . 'js/ffd_js_script.js');      }


title: How do I go back to wordpress 3.5

text: With wordpress 3.6 my getmecooking recipe plugin, now goes back to my website for each ingredient. I have a slow internet connection. Can I go back to 3,.5 or stop it from doing this (the recipe entry is like a blog format)


title: Custom options for a Custom post type

text: I have created a custom post type called "Product" with 2 custom fields "Size" and "Color" , I would like the "Size" to be limited to "Small", "Medium" and "Large" , How to I create this list of pre specified values which show up in a Custom Meta box populating an option field ? Praveen


title: Get 1st parent category id from post

text: I have this structure for my categories:               Issue 4            - News                - Supporting our troops                - Breaking news          <?php     $category = get_the_category();     $parent = $category[0]->term_id;     ?>      This code gets the top level category ID from "Breaking News" which is Issue 4, missing out News its direct parent category. How could I get the category ID for "News", its direct parent category and not the top level category?


title: Function to pull data from user meta not working

text: So I am attempting to create a series of functions that calculate a price based on a client level I have set for each customer. Some customers may have a special deal. To do this, I created a custom meta field in the user meta that allows me to assign either High, medium, or low to that client. I then created a function meant to determine what the client level is and use that for the price calculations. If a client is not logged in, or a field is empty, the default is set to High I tried two versions of this function and put it in a plugin to test with a simple echo statement, but neither seem to be changing the result to anything besides high, despite the meta field being set to low. if you can help me figure out what I am missing, that would be great. First Attempt:               function get_client_lvl () {         $user_id = get_current_user_id();         If ($user_id == 0) {             return 'high';         } Else {             $client_lvl= get_user_meta($user_id, wpcf-client-lvl, true);              if (empty($client_lvl)) {                 return 'high';             } Else {                 return $client_lvl;             }         }     }          $client_lvl=get_client_lvl();          echo $client_lvl;      Second Attempt               function get_client_lvl () {         $user_id = get_current_user_id();         $client_lvl= get_user_meta($user_id, wpcf-client-lvl, true);              If ($user_id == 0 || empty($client_lvl)) {             return 'high';         } Else {             return $client_lvl;         }     }          $client_lvl=get_client_lvl();          echo $client_lvl;


title: If category is in parent category?

text: I have function that check what is main top category of post. So i have category tree like this               Foo     -bar     --foobar     cat2      and if post is in foobar, my function post_is_in_descendant_category shows me "foo" and i can style that post with style-foo.css. What i want now is to make this same possible for styling category page "foobar". Wordpress functions in_category works only for posts. So, my code `if ( in_category( 'foo' ) || post_is_in_descendant_category( get_term_by( 'name', 'foo', 'category' )) || is_category('56') )` doesn't work for subcategories.