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

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!


Image quality based on image size

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.


Using "Read More" link with custom excerpt

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');


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

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(); ?>


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

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");'));


Missing Update Link to 3.02/3.03 on Dashboard

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.


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

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?)


Add validation and error handling when saving custom fields?

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' );


Dynamically add a keyword to url with a specific template

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.


How to setup a membership system in Wordpress?

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.


How do I move a Wordpress site to another server?

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');


Get an uploaded attachments local server path?

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?


add a woocommerce shop to every buddypress user

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.


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

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';


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

![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?


Removing strip_tags not working on nav_menu_description

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?


WP plugin management

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.


Redirect Admin User in Dashboard

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;     }


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

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.


Post per page not working

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();          ?>


Multiple homepage layouts as selected by user from theme options

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?


How resource intensive is wp_register_script()?

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.


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

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.


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

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.


Post/page without slug

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?


Widgets not expanding on wordpress 3.3 widget dashbord

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?


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

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(); ?>`?


Custom Same Page Search

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.


Display authors Whos write in category

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.


Related posts widget

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


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

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?


Why is the_content() not displaying the content?

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?


Redirecting old site links to new site

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 ?


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

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


Show specific category posts on Genesis framework home page

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.


Adding a 'style=' bit to image_send_to_editor output

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.


adding image to post thumbnail from another server

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.


Login/logout in header

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?


Order by title without taking into account 'the'

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! :)


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

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?


How to get larger version of author avatar

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?


How to output number of comments with link to comments

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; ?>


BuddyPress user bio in profile

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?


How Can I Put Meta_Compare in the Database-Query?

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 . '%'      ));


get current page number with wp_link_pages()

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;     }


Content hooks vs User hooks

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.


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

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.


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

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?


Setting a featured image while creating the post

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


How to loop custom post type posts by author?

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


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

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


add_action hook for completely new post?

> 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.


Initialize WordPress environment to use in command line script

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


pre saved posts query from db options table

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?


Append HTML to an LI of wp_list_categories

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


Display Taxonomy Image on single.php

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;     ?>


Allow Users Access to Custom Post Type Only

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.


WordPress Featured Post Slider

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?


Random home page background images with caption 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:


conditionally echo <br /> in meta box data loop

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 :)


Multiple loops in Genesis

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.


Loading shortcode with ajax

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?


How to add custom field option with menu?

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.


HeadSpace2 double title on homepage

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`?


Replacing string with a variable in php

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');      }


How do I go back to wordpress 3.5

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)


Custom options for a Custom post type

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


Get 1st parent category id from post

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?


Function to pull data from user meta not working

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;


If category is in parent category?

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.


Ability to comment on tags that represent a certain "issue"

I was chatting with a non-techy friend who doesn't even use wordpress...she told me in some blogs, specially activism ones, there are some issues being repeatedly discussed, sometimes she likes to comment on the "issue" not on the post. "issues" are represented by tags usually or categories. so i was wondering, is there a way to comment on "tags" or have discussion via nested comments ? and what do u think of the concept as a whole, not only the technicalities. Thanks for feedback


list all child categories that apply to current post even if those cats are empty? everything I tried just shows "post not found" - Have alphabetical listing and trying to create A B C D hyperlinked listing A - All categories that child of A B - All categories that child of B etc


Widgets are not showing after moving domain

I recently moved my wordpress installation to a new domain. Everything worked fine; all my images, posts and plugins copied across fine. My widget setup seems to be gone after moving domain. I can see the setup in the database but nothing on the page. Is it some manual thing you have to do to get the widgets to follow?


Is it possible to upload text files (e.g. JSON) to wordpress blog in any way?

I want to show some code but it needs to be in a raw format, is it possible to upload a simple text file? I'm aware of the file type restrictions but if there is a nifty trick to do this it would be great.


wordpress superfish dropdown menu

I am learning how to integrate superfish drop down menus in wordpress and i am following this tutorial http://kav.in/wordpress-superfish-dropdown-menu I am using this theme with superfish integrated http://kav.in/blog/wp- content/uploads/dload/axtra_with_superfish.zip Has anyone else successfully been able to make the menus show?.


Custom image sizes ignored in WP 3.5

Since migrating to WP 3.5 I discovered that my custom image sizes get ignored - whenever I try and output one of them WP just defaults to the original image instead. Kind of frustrating... Any idea where to start? functions.php -               add_theme_support( 'post-thumbnails' );      add_image_size( 's', 145, 999 );     add_image_size( 'm', 300, 999 );     add_image_size( 'l', 455, 999 );     add_image_size( 'tablet', 1024, 9999 );     add_image_size( 'browser', 1920, 9999 );      The original media sizes in WP admin is set to 0x0. Also tried reseting these in case WP chose to disable image sizes altogether for some reason. index.php -               // Inside the loop     $size = 's';     $image = wp_get_attachment_image_src(get_field('thumbnail'), $size);     echo $image[0];      The field 'thumbnail' is a custom field I've created. It stores the ID of the attachment. Edit: This seems to be a bug   http://core.trac.wordpress.org/ticket/22985


How to enable wpautop for XMLRPC content

I'm using Wordpress XMLRPC support. The content fetched through an **XMLRPC** client does not have the automatically added `<p>` tags, whereas pages rendered on the blog of the Wordpress install do. Is there an easy way to get the `<p>` tags coming through the **XMLRPC** content as well?


WordPress Theme Creation

I have a HTML site that I would like to turn into a WordPress theme and I was wondering if people could pls point me to the best available Wordpress themes that can be used as a skeleton base for this HTML site? I want something that represents the latest version of WordPress, and that is a good base to start from. Any help/sites would be appreciated. Thanks.


Wordpress, IIS7, SQL Server 2008, not showing posts (displays 'Nothing Found...') and only shows counts in admin - how to fix?

I recently installed WordPress on IIS 7 and wired it up to SQL Server 2008R2. The installation went fine. Right off the bat, I can see on post is present (just in the count) but none are listed; I added a few posts. In the admin menu, under posts, I see that there are six published posts "Published (6)". However the list below this is empty. Also trying to view these on the site, by selecting the category returns > **Nothing Found** > > Apologies, but no results were found for the requested archive. Perhaps > searching will help find a related post. I have re-installed the database, overwrote the PHP/SQL files and re-installed WP. Problem persists. I tried the Settings/Permalinks suggestions here and. No change. The suggestions here relate to not being able to write to the .htaccess file. Not an issue for me, and I am not seeing the error of not being able to save. (To verify, I saved, exited, navigated to the same Permalinks page and my settings were saved). I even set the Permalinks to to default and removed the Web.config rewrite rules:               <?xml version="1.0" encoding="UTF-8"?>     <configuration>       <system.webServer>         <rewrite>           <rules>             <rule name="wordpress" patternSyntax="Wildcard">                 <match url="*"/>                     <conditions>                         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>                     </conditions>                 <action type="Rewrite" url="index.php"/>             </rule>          </rules>         </rewrite>       </system.webServer>     </configuration>      No change. (Added them back in). I set SAVEQUERIES=TRUE in wp-config.php and I can see the contents of some of the posts in the log file. > ie. Hi there! I'm a bike messenger by day, aspiring actor by night, and this > is my blog. I live in Los Angeles, have a great dog named Jack... Enabled the php_sqlsrv_53_ts_vc9.dll extension and disabled phpsqlsrv.dll I have seen other posts that refer to changing some security settings as the system may be detecting a potential SQL injection attack. However those posts are related to an Apache-related installation, and cannot locate any references in my version. I retried this with WP 3.21 - same issue. I can click on the month link (March) then see that the post count beside Uncategorized. Once I click on the link, I see the Nothing Found message again. Retried with 3.31, and noticed the following in Windows/Temp/php53_errors.log: > [07-Mar-2012 21:00:51 UTC] WordPress database error 42000 : [Microsoft][SQL > Server Native Client 10.0][SQL Server]Incorrect syntax near 'wp_users'. for > query SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE > ''wp_users'' made by display_setup_form, pdo_wpdb->query, > pdo_wpdb->_post_query, pdo_wpdb->print_error Upon installation, and tracked it down to wp-content\mu-plugins\wp-db- abstraction\translations\sqlsrv\translations.php. In this case, adding extra single quotes around the table name was causing the error, so I commented out the line:                   // SHOW TABLES         if ( strtolower($query) === 'show tables;' ) {             $query = str_ireplace('show tables',"select name from SYSOBJECTS where TYPE = 'U' order by NAME",$query);         }         if ( stripos($query, 'show tables like ') === 0 ) {             $end_pos = strlen($query);             $param = substr($query, 17, $end_pos - 17);             // quoted with double quotes instead of single?             $param = trim($param, '"');             if($param[0] !== "'") {                 //$param = "'$param'";          <----------- commented out             }             $query = 'SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ' . $param;         }      Now, the SQL statement reads > SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE > 'wp_users' instead of > SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE > ''wp_users'' Retried the installation - problem persists, but this time no SQL error message. **-- Update --** Forgot to mention that I am using this with the WP DB Abstraction (implied by ... > wp-content\mu-plugins\wp-db-abstraction\translations\sqlsrv\translations.php ... above. Is there another way to get this to work with SQL Server?


How can I print out a single stylesheet or javascript link?

I know I can use `enqueue_script` and `enqueue_style` to register scripts and stylesheets, however I'm trying to print out just the link to the adminbar css:               <link rel='stylesheet' id='admin-bar-css' \     href='http://mysite.com/wp-includes/css/admin-bar.css?ver=20111209' type='text/css' media='all' />      I could just include that text on my page but I was hoping for something like               wp_print_script('admin-bar-css')      Is there such a thing?


Where to add offset

I want to use the offset function to skip the first post and i have this code inside which i need to put an offside=1 , but wherever i insert it, I receive the error...any idea where i can add it inside this code below?               <?php      $recent = new WP_Query( array(          'tag' => get_option('gd_slider_tags'),          'showposts' => get_option('gd_slider_num'))      );      while($recent->have_posts()) : $recent->the_post();?>


bbPress plugin: forum lists not showing in correct order?

I'm running Wordpress 3.3.1 and bbPress 2.1 (plugin, not standalone) my forums are are not being listed in the front page archive or forum summary pages in the correct order; I double checked many times the ordering number, but no matter what, the forums will display in their own order which is neither alphabetical, cronological (date created/updated) or other. I can't just figure it out. I've tried also re-arranging forums with simple page ordering plugin, no success. I've disabled my custom theme and tried with TwentyTen. I've disabled all my other plugins, but situation hasn't changed. All my forums were imported from a previous bbPress 1.x standalone installation. Forum works overall fine, except by this bug that disallows me to arrange the order of the forums in the archives... I've posted this question also on the bbPress forums, but so far we haven't found a solution: http://bbpress.org/forums/topic/bbpress-2-plugin-forum- order-doesnt-work-not-appearing-in-correct-order thanks


How to make "more" or "continue reading" links on excerpts nofollow?

I tried to make each one of my post excerpt's link to the full post "nofollow" like this:               <a href="<?php the_permalink() ?>" rel="nofollow">→ Continue Reading      However, that doesn't seem to work. I'm pretty new to WP / PHP, so what do I need to do?


Displaying database data as pages (or similar)

I have a friend that has a big database of cars (lets say 4000 entries). Now he wants to add this info to his website. Initially I played with the idea of creating a page for each car, but this ends up in almost 10 000 pages being created (as the user has to select `BMW -> M3 -> 1995 -> Car` info). This makes for a very slow website. How to convert this to WordPress? Is Javascript an option? **Database:** (I did not create this design, just trying to help them out) There are 5 tables:   * Brand -> Contains car makes (BMW, Toyota, Audi)   * Model -> Contains model for each brand (BMW -> M3, Toyota->Corolla)   * Year -> Contains year of manufacture for each model (M3 -> 1990, M3 -> 1995)   * Motor -> Contains info about motor type/size for each year (M3->1995->V8, M3->1995->V12)   * Info -> Contains info about each motor (power output, general problems, and so on) In other words, they want the user to be able to select `Brand->Model->Year->Motor->Info`. Ex: `BMW -> M3 -> 1995 -> V8 -> Info` (display). After you click BMW, all the models BMW made is displayed.


facebook like on twenty eleven

I'm using the twenty-eleven theme, and want a Facebook-like button. I insert the code into `content-single.php` as follows: At the beginning:

      And then, inside the loop, after the call to `the_content()`:

      The buttons appear fine in FF, Chrome. and IE9, and even IE7(!). But in IE8 - they don't appear at all. The `div` is there, but it doesn't get filled with the `iframe`. When I insert the same code in a twenty-ten theme, it appears fine in IE8. Has anyone run into this problem? What am I doing wrong?


Network Admin "You do not have sufficient permissions to access this page."

I have had trouble logging into WP-Admin with my admin account. I have reset my password, and I can now log-in to WP-Admin, but cannot reach Network Admin (/wp-admin/network), instead receiving "You do not have sufficient permissions to access this page." What do I need to do to restore the permissions the account had before the password reset?


Update post meta not working on wp_postmeta

I am trying to update post meta values but it does't work. Only function that is working is get_post_meta and add_post_meta but Update wont work at all. Also I tried to change the values using wpdb->update but that wont work either. Here is the code.               function rating_system_callback(){          if(  !wp_verify_nonce(  $_POST['nonce'] ,'star_rating_nonce' )){         wp_die('No nonce found.');     }     if(record_check_and_add($_POST)){         $total_user_voted = get_post_meta( $_POST['post_id'], 'no_of_user_voted', true );                   if(empty($total_user_voted)){             add_post_meta($_POST['post_id'], 'no_of_user_voted', 1, true);         }         $new_user = $total_user_voted + 1;         update_post_meta($_POST['post-id'], 'no_of_user_voted', '58');                   if(empty($total_votes_for_post)){             add_post_meta($_POST['post_id'], 'total_points_for_post', $_POST['clicked_on'], true);              }         $new_points =  $total_votes_for_post + $_POST['clicked_on'];         update_post_meta($_POST['post-id'], 'total_points_for_post',$new_points);              $whole_avg = round($new_points / $new_user, 1) ;              $avg = get_post_meta($_POST['post_id'], 'whole_avg', $whole_avg, true);         if(empty($avg)){             add_post_meta($_POST['post_id'], 'whole_avg', $whole_avg, true);              }         update_post_meta($_POST['post-id'], 'whole_avg',$whole_avg);         wp_die();     }      }


Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title

I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the same day (formatted like YYYY- MM-DD) to then sort those by title, and finally sort by title if the custom field has not been filled out (older items). So, I tried it hundred different ways with a WP_query and it does return most of the results as I want them - but in this case it's only returning the items that have the meta_key of publication_date. All other items are being ignored and not displayed. I tried a meta_query using a relation of "or" and compared the publication_date as EXISTS and NOT EXISTS, but that returned 0 results for me. Also, the site is running 3.5.2 still and they do not want to upgrade. Here is my most recent query that gets me the posts that have the publication_date custom field displayed in the correct order:               $term = get_queried_object(); // find the term of the taxonomy page we are on     $wp_query = new WP_Query( array(     'post_type' => 'resource',     'tax_query' => array(         array(             'taxonomy' => 'resource_types',             'field' => 'slug',             'terms' => $term->name,         )),           'meta_key' => 'publication_date',     'orderby' => 'meta_value_num',     'order' => 'DESC',     'paged' => $paged,     'posts_per_page' => '10',     ));      I also tried using wpdb and running a SQL query, but I really am not sure how to accomplish what I want doing that. If someone could help me out that would be awesome! Thanks in advance.


How can I place a page link to the sidebar admin bar?

Im trying to create a function that place my page link http://mypage.com/mypage in the Admin Sidebar, not in the top Admin Bar like the code bellow does know.               function toolbar_link_to_my_page( $wp_admin_bar ) {         $args = array(             'id'    => 'my-page',             'title' => 'My Page',             'href'  => 'http://mypage.com/mypage',             'meta'  => array( 'class' => 'my-personal-page' )         );         $wp_admin_bar->add_node( $args );     }     add_action( 'admin_bar_menu', 'toolbar_link_to_my_page', 999 );      Can anybody give me a hint on how to solve that...


Prevent Wordpress installing plugins and themes via Admin

When I initially set up WP, I had entered my FTP details in the Admin so that I could add plugins and themes directly from Admin. However, I believe this compromises the website as I have found malware in the plugins and themes folders on many occasions. Please can someone advise me on how I can revoke WPs FTP access? I don't want WP to be in control of adding plugins and themes and would rather do this via my FTP client. Cheers


Subscribe registers to all comments from a category

I tried many plugins in order to automatically (from user profile panel) subscribe registers to comment notification for post in a specific category. Do you have any tips to do that ?


Is WP Importer Safe on Multisite?

Is it safe to allow users of a multisite to use WP importer? I'm assuming importer can only create pages, posts and users (if I allow them to add users to their site), but my concern is whether a hacker can create an account and import malicious code.


Generating rel=prev and rel=next only on wordpress categories

I was trying to remove the **rel=prev** and **rel=next** tags from my website as my SEO gut suggested. I found those functions which perfectly do the magic:               remove_action('wp_head', 'start_post_rel_link', 10, 0 );     remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);      however, after a while my SEO guy suggested to leave it on a categories section where over there it's necassary as far as SEO. is there a simple way of implementing the **rel=prev** and **rel=next** tags **only on a categories** pages?, e.g: **www.website.com/category/category- name** and remove it from all other post types? (post, page, homepage etc etc) Thanks, GIl


What is the best way to sanitize data?

I've read several topics about this and different ppl have different views on the best practice. In terms of WP, how do I store data to DB the safest way? This is one insert I'm using now:                 $result = $wpdb->insert($table_name ,        array(          'arena' => $galleryData['arena'],         'year' => substr($galleryData['season'], 2),         'copyright' => $galleryData['copyright'],         'description' => $galleryData['description'],         'path' => $galleryData['path'],         'fk_brand_id' => $galleryData['brand']       ),        array( '%s', '%d', '%s', '%s', '%s', '%d' ));      Reading a book, another way of inerting data is doing this:               $sanitized_sql = $wpdb->prepare(“       ’INSERT INTO my_plugin_table SET field1 = %1$d, field2 = %2$s, field3 = %3$s’, 32, ‘Aaron Brazell’, ‘Washington, D.C’);     $wpdb->query( $sanitized_sql );      Do I still need to sanitize data using `wp_kses` or `mysql_real_escape_string` ? I'm just confused on what method is the better for safely storing data to DB. I found one answer here: http://stackoverflow.com/questions/2127009/using- wordpress-can-some-one-tell-me-the-best-way-of-sanitizing-input **So should I or should I not sanitize data before input?**


If current user is admin or editor

How can I check to see if the current logged in user is an admin or an editor? I know how to do each singularly                 <?php if( current_user_can('editor')) {  ?>          stuff here for editors     <?php } ?>         <?php if( current_user_can('administrator') { ?>         stuff here for admins     <?php } ?>      But how do I work those in together? Ie. user is admin or editor?


Creating themes using the one Plugin (Toolkit)

I'll try my best to explain what I'm trying to achieve. I haven't been developing with Wordpress for a while and I've hit a bit of a wall. I'm looking to get into making Premium Wordpress Themes. Each theme is going to consist of custom post types (e.g. portfolio, slideshow, events). I'm trying to create a SINGLE plugin which holds these custom post types and only includes the custom post types the theme uses. E.g. a theme may only use the portfolio custom post type. I'm achieving this so far by adding this to the themes function.php file.               add_theme_support( 'custom_portfolio' )      Then, within the plugin, i'm using:               require_if_theme_supports( 'custom_portfolio', PLUGINROOT . '/inc/post-types/portfolio.php' );      I'm trying to make these themes not 'lock' the user in. If they are to change themes, the custom post types are still visible, so they can accesss the data, even if they may not work accordingly. Obviously, the custom post types will fail to load because the theme won't have support for 'custom-portfolio'. How can I achieve this? Thanks.


How to fetch form data and show it to my page?

I'm new to wordpress, & trying to create a simple form from of my use, and wanna do it by plugins . so I created a plugin for that but that is not showing the values of my form. there is a option also that, sometime it is showing the value on the top of the form, and the body part is showing 404 error page. please help to to create a form and fetching the value from it in OOP style. I've written this part of the code               $name = $_POST['name'];     $password = $_POST['mail'];     echo $name . ' ' . $password;          function show_form( $atts ){        $form_details="";        // get attibutes and set defaults             extract(shortcode_atts(array(                     'type' => 'text',                     'name' => 'name',                     'value' => 'Submit'            ), $atts));         // Display info               $form_details = '<form name = "myform" action "" method = "POST">';         $form_details .= '<input type = "text" name = "name" value=""/>';         $form_details .= '<input type = "text" name = "mail" value="" />';         $form_details .= '<input type = "submit" name = "submit" value = "Save"/>';         $form_details .= '</form>';              return $form_details;     }     add_shortcode('form', 'show_form');      and if you can suggest me any tutorial or book I'll be grateful to you .! Thank You .!


Settings API: Change position of custom setting field

I've searched high and low on Google and this site for an answer to this and am quite surprised to find nothing about it anywhere I've added a custom setting to the General settings tab using `add_settings_field()` but the field appears at the bottom of the page. I'd like the field to appear below the Email field but I can't find any documentation or anything on how to change the position of it Is there a filter on the settings field I can hook on to manipulate the order in which the fields are displayed and inject my custom field where desired?


how to add home icon instead of text in wordpress menu

i need to add "home.png" icon image as home button instead of text for example ![enter image description here](http://i.stack.imgur.com/r2P3O.png) i searched this question in google and find out a way, but that didn't work. the method mentioned in those sites are   1. enable css class in screen options in apperance>>menu   2. write a class "home-icon"   3. in style.css insert this class. i wrote the code as  .home-icon{ background-image:url(images/home.png); } i followed this site but this didn't work for me. what is the problem in this method? or any other alternative ideas?


Styling own template

I have an own template here where the sidebar looks different than the others: the sidebar is BELOW right the main content and not on the side. My code:
<?php echo get_sidebar()?>
      I know this is CSS, but can you help how to structure the index.php and page- slug.php to have the same design for all pages.


How to fix empty dashboard issue in WordPress?

A site of my company uses blog on WordPress 3.3.1 with theme based on Twenty Ten. Last week I upgraded Apache and PHP on our production server. Afterwards the dashboard refused to work. When a user logs in, a blank dashboard appears. A menu with links is still present, but none of the links work, so one cannot create new posts etc. In the page source I see the following message: > **Fatal error** : Access to undeclared static property: WP_Screen::$this in > **blog/wp-admin/includes/screen.php** on line **706** There were no changes to WordPress configuration made and no new plugins installed. How to fix the issue?


Adding an image slider in the header of my site

I am new to WordPress. Can you please suggest the steps to insert an image slider in my site's header? I don't know how to insert the code or where.


how to localize the number of wordpress post views?

I want to display post view in localize number. I add these function in function.php to do so               function make_bangla_number($str)     {         $engNumber = array(1,2,3,4,5,6,7,8,9,0);         $bangNumber = array('à§§','à§¨','à§©','à§ª','à§«','à§¬','à§','à§®','à§¯','à§¦');         $converted = str_replace($engNumber, $bangNumber, $str);              return $converted;     }          add_filter( 'the_views', 'make_bangla_number' );      But I am unable to show the number in localize. Whenever i call the_views it shows the english number. Any idea how to show the post view number in localize language? For further info here is my post view function:               // function to count post views.     function setPostViews($postID) {         $count_key = 'views';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }     }     // function to display number of post views.     function the_views($postID){         $count_key = 'views';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');             return "0 View";         }         return $count.' à¦¬à¦¾à¦°';     }      I have Bangla language pack installed and my site CHARSET is also UTF-8. Bangla language pack does all but can't convert the English number into bangla number. So I using that code. With that i can convert the date number in Bangla but unable to convert the views. So I am here.


Pretty Link Lite Plugin on WP Multisite

I have a subdirectory install of the WP multiste and I'm trying to use the Pretty Link Lite Plugin to create shortlinks. I'm also using the MU domain mapping plugin to map each subdirectory site to a domain name. The pretty link manager creates shortlinks such as:               domain.com/shortlink       //base domain     domain.com/sub/shortlink2  //subdirectory domain      Is there any way to create a shortlink for:               mappedDomain.com/shortlink      as you would expect this plugin to accomplish?


Wordpress options text format

Wordpress converts my theme options text with smart quotes. I know that to remove problem from posts etc:               remove_filter('the_content', 'wptexturize');          remove_filter('the_excerpt', 'wptexturize');          remove_filter('comment_text', 'wptexturize');      But how to remove this effects when saving into Wordpress options api?


Custom query, works, but I get a "Notice: Undefined offset: 0..."

My custom query works, but in debugging mode I get this error:               Notice: Undefined offset: 0 in /storage/content/24/150624/mydomain.com/public_html/wp/mysite/wp-includes/query.php on line 2232       This is what my query looks like:               <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>          <?php      global $post;          $args = array(     'tax_query' => array(     array(         'taxonomy' => 'machinecategory',         'terms' => $term,         'field' => 'slug',         'operator' => 'IN'     )     ),     'posts_per_page' => -1,     'post_type' => 'machine',     );          $my_query = new WP_Query($args); ?>     <?php if ($my_query->have_posts()) : ?>     <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>     <?php the_title();?>      <?php endwhile; ?>     <?php endif;?>          <?php wp_reset_query(); ?>      What could be wrong?


Link post images to post

For some reason I can not find any good solution to making the post images link to the post. I found a script on http://wpguy.com/plugins/linked-image/ which works - but does not remove the old link, instead it wraps the old link and the image in a new a tag. What I want is for the old link to be removed so the image is only wrapped in one a tag. This is the script I currently have:               function wpguy_linked_image($content){              $searchfor = '/(]*\/>)/';         $replacewith = '$1';              if (is_single() === FALSE){             $content = preg_replace($searchfor, $replacewith, $content, 1);         }         return $content;          }          add_filter('the_content', 'wpguy_linked_image');      Does anyone have an idea?


Replace Unwanted Space in Post Content URL

I have a Wordpress site with a couple hundred posts. The posts were being created with batch processing and a piece of code was being inserted dynamically. I found an error in the URL of one of the hyperlinks being inserted into the post content. Every URL has a space instead of the desired "-" character. I'm trying not to manually fix each post. As you can see, part of the URL below has a space in it and is causing 404 errors in all of the different posts. SQL sees it like this:                               Google sees them like this:                               Unfortunately, as you can see, the URLs aren't the same, so I can't do a find an replace. I'm hoping someone has some savvy SQL operation to find the space and replace it with the appropriate "-" character. I'm thinking that I could say something like this: Replace any blank space in the field with the "-" character, unless the blank space belongs to the "a href" string. SQL Table -> wp_posts Field -> post_content Maybe there's a .htaccess solution? Thanks in advance for the help!