title: How can you make permalink work for custom post type and taxonomy?

text: I have spent days now trying to figure this out, StackOverflow is my last resort. All I want is the following: http://www.mydomain.com/my-post-stype/my-top-level-category/my-sub-level- category/my-page.html For posts this is insane easy, just adding /%category%/%postname%.html as a permalink does the trick. However for custom post type this seems insane tough. I have a registered post_type **project**. And a taxonomy **project_category** Now I like my permalinks to turn out as               /project - Overview of projects in all categories.     /project/CATEGORY - Overview of projects within that category.     /project/CATEGORY/SUBCATEGORY - Overview of projects within that subcategory.     /project/CATEGORY/SUBCATEGORY/postname - The actual post.      Probably wp_rewrite needs to help me out here tho I have no clue how. Can anyone help me out?


title: Cleanest way to code "Custom Write Panels/Meta Boxes"?

text: As with anything in Wordpress it seems there are 20 way to do something, but after several weeks of extensive searching I really haven't found more then a couple tutorials floating around that really mirror each other in writing conventions which always makes me a little uneasy when this is the way I learn so I wanted to make a post and ask you guys, the community, what you think?.... Even if you just have a favorite resource such as a tutorial on the web, that would be very useful. I feel Like Ive combed over them all, but often it seems like asking a specific group of experienced people typically renders better results so here I am. *PS - Ive tried DeluxeBlogs class, and it worked fine, but at the moment what Im really trying to do is learn the most "correct" way to go about writing my own meta boxes from scratch. Thanks, SB ----- **EDIT 1 : Example of one of my current meta boxes** -----               <?php     // Register Custom Post Type Meta Boxes -- Description Field     add_action( 'add_meta_boxes', 'store_description_meta_box_add' );     function store_description_meta_box_add()     {         add_meta_box( 'epr_store_description_meta_id', 'Product Description', 'store_description_meta_box_cb', 'epr_store', 'normal', 'high' );     }          function store_description_meta_box_cb( $post )     {         $values = get_post_custom( $post->ID );         $textbox = isset( $values['meta_box_description_text'] ) ? esc_attr( $values['meta_box_description_text'][0] ) : '';         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>             <textarea name="meta_box_description_text" id="meta_box_description_text" style="width:100%; height:100px;text-align:left;">                 <?php echo $textbox; ?>             </textarea>         <?php        }          add_action( 'save_post', 'epr_description_meta_box_save' );     function epr_description_meta_box_save( $post_id )     {         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;         if( !current_user_can( 'edit_post' ) ) return;              $allowed = array(              'a' => array(                  'href' => array()              )         );              if( isset( $_POST['meta_box_description_text'] ) )             update_post_meta( $post_id, 'meta_box_description_text', wp_kses( $_POST['meta_box_description_text'], $allowed ) );     }     ?>      ----- **EDIT 2 : Example of how to remove indentation after saving w/ Chris' help** -----               <?php     // Register Custom Post Type Meta Boxes -- Description Field     add_action( 'add_meta_boxes', 'store_description_meta_box_add' );     function store_description_meta_box_add()     {         add_meta_box( 'epr_store_description_meta_id', 'Product Description', 'store_description_meta_box_cb', 'epr_store', 'normal', 'high' );     }          function store_description_meta_box_cb( $post )     {         $values = get_post_custom( $post->ID );         $textbox = isset( $values['meta_box_description_text'] ) ? esc_attr( $values['meta_box_description_text'][0] ) : '';         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>             <textarea name="meta_box_description_text" id="meta_box_description_text" style="width:100%; height:100px;text-align:left;"><?php echo esc_attr($textbox); ?></textarea>         <?php        }          add_action( 'save_post', 'epr_description_meta_box_save' );     function epr_description_meta_box_save( $post_id )     {         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;         if( !current_user_can( 'edit_post' ) ) return;              $allowed = array(              'a' => array(                  'href' => array()              )         );              if( isset( $_POST['meta_box_description_text'] ) )             update_post_meta( $post_id, 'meta_box_description_text', wp_kses( $_POST['meta_box_description_text'], $allowed ) );     }     ?>


title: Listing custom post type items from a couple of custom taxonomies

text: I know I have asked a similar question in the recent past ( **Listing all custom post types using a specific term on the said term's template page, in groups**), but in this case, the template is more complicated. This is what I have on a website's front page.               <!---Front page videos-->     <div class="twelve columns clearfix" id="clips">     <!---Code to output front page videos-->     <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $the_query = query_posts(         array(             'post_type'=>'video',             'posts_per_page'=>90,             'orderby'=>'date',             'paged'=>$paged         )     );     // ...     ?>      " > " rel="bookmark"> 'front-thumb') ); else { ?> " title="" rel="bookmark"> ID, 'jetpack-post-views', true ); ?> ', '' ); ?> '; $count = 0; } else $count++; ?> Either by using just this template or creating a couple of others, I'm supposed to output results from four different taxonomies called video- categories. How do I do that? I have tried to fix the code I was given two months ago in the linked question, but I was getting errors. This would more or less save me. Thank you in advance.


title: how to resize thumbnail image

text: I am using this function to re-size my thumbnail , add_image_size( 'portfoliolarg', 120, 120, true); the image is corp and resize I just want to resize my Image


title: How can i share codes on my blog?

text: I want to add `<code>` tag to my post, easily. For example, Adding code is very easily in Stackoverflow and other sites. Basically, we can add codes between apostrophes (``) I need something like that for Wordpress . Maybe i can use shortcode function for this. For example : `[code="<b>Hello</b>"]` will show exactly like this : `<b>Hello</b>` In summary, i'm sharing a lot of HTML and PHP codes with my readers on my blog. I need an easily way to share them. Is it possible, like stackoverflow's apostrophe method ? Or maybe shortcodes ? Thanks...


title: Use a shortcode to display custom meta box contents

text: Is this possible? If so, can someone point me towards a clear tutorial? I have a column of content I want to float right of the_content, so I'd like to be able to use a shortcode to put that content in the post for a page. I've found the following (but want to modify it for get_post_meta):               function get_custom_field_fn() {          global $post;       $custom_field_value = get_post_meta($post->ID, 'cf_name', true);       return $custom_field_value;      }           add_shortcode('cf_name', 'get_custom_field_fn');      I'm guessing that I need to change a few things but not sure which things to change. My custom meta boxes will have 8 fields. I'm also guessing that my shortcode will need to allow for the post/page ID and I also need to interject some HTML in the function.


title: Saving data for different custom posts

text: I have three different posts types registered:               register_post_type( 'foo' , $args );     register_post_type( 'bar' , $args );     register_post_type( 'baz' , $args );      When I am creating a new, say, "foo" post, I only want to save the meta box for "foo", what do I do? add_action('save_post', 'save_details'); So, if my post_type were called "foo_post":               add_meta_box(          $id,          $title,          $callback,          // SPECIFY THE POST TYPE HERE!!!         "foo_post",          $context,          $priority,          $callback_args );      What do I do to save only "foo post" meta box when I am creating / edit a "foo post" page?


title: wp_insert_post not completing when run via cron

text: I have created a plugin that accesses an XML feed that contains articles and saves the articles from that feed as posts. You can set a time interval for the plugin to run via WP cron and access the feed to see if there is any new content. The plugin works and has worked on multiple sites, however, on this one site it's hitting a snag. Each article on the feed has a id number. The way the plugin works, is when a new article is imported, the plugin grabs the id number associated with the article and saves it to the post_meta table. That way, on each subsequent run, the plugin looks to the postmeta table to see if the article id exists. If it doesn't, it imports the article and creates a new post, if it does it doesn't do anything. I've run into an issue where, when run via cron, the plugin isn't saving the article id to the postmeta table, and as a result is creating duplicate articles. When run manually, everything works fine. I've narrowed down the issue to be the call to `wp_insert_post`. I make a call to `wp_insert_post` to save the post, and expect it to return an post id number, but it doesn't return anything. Upon further investigation, when run via cron, everything gets hung up in the `wp_insert_post` function in 'post.php'. It makes it down to the call to `do_action('save_post', $post_ID, $post);`. It enters the `_save_post_hook` function, but doesn't return. It just stops there, for some reason. No errors are being thrown and it looks like all the code in _save_post_hook is being executed. I have no idea why this is happening and don't really know where to go from here, as I've spent days looking at this and don't know what is going wrong. Any help is appreciated.


title: How to link external javascript files?

text: I am working on a custom Wordpress theme for my bosses website. I have everything working perfectly so far except for one thing... the external javascript files will not work. I followed the exact advice from the links here and here, but it still does not work. I have searched the codex, checked source code, used firebug... i have no idea why this is not working. Unfortunately, due to an NDA, I am not allowed to give you any of the actual code from the site, or a link to it. So I will have to explain as best as I can. I have used the wp_enqueue_script() to include the files in the functions.php file. The script tags in the head are as follows:               <script type='text/javascript' src='http://www.xx.com/wp-includes/js/jquery/jquery.js?ver=1.4.4'></script>     <script type='text/javascript' src='http://www.xx.com/wp-content/themes/twentyten/scripts/custom.js?ver=3.1'></script>      So the files are loading, but they just are not working. I was wondering if the "?ver=3.1" at the end of my custom.js file might have anything to do with it? The code from my functions.php file:               function twentyten_custom_scripts() {     if ( !is_admin() ) // instruction to only load if it is not the admin area     {         // register your script location, dependencies and version         wp_register_script('custom_script', get_bloginfo('template_directory') . '/scripts/custom.js', array('jquery') );        // enqueue the script         wp_enqueue_script( 'jquery' );         wp_enqueue_script('custom_script');     }     }     add_action('template_redirect', 'twentyten_custom_scripts');      I am really lost at this point. I even changed all my               $('#elem').hide();       to               jQuery('#elem').hide();       in the custom.js file according to the codex wp_enqueue_script no conflicts wrappers section here, still nothing. Oh, and I am needing this file to load into all of my PAGES, but not on my Blog, as I have multiple "static" pages set up for the main site. I hope that makes sense. Thanks in advance. Joe.


title: current-menu-item not working with custom post type

text: I'm a wordpress newbie and I have annoying problem. I have a few custom post types (capability_type=post). Two of them i created with "Custom Post Types" plugin and when i put its categories in navigation menu they are working well. When clicked it gets current-menu-item. The problem is with one of the other post type (Events) which is created by "Events Manager" plugin. When its categories are included in navigation menu, and clicked they don't get class current-menu-item ... there is nothing starting with current in classes. Can anyone help me pleace? Link to the site: http://ideas4web.eu/sedmicata.com/ Look at the big red navigation and Events li and its sub-menu. I've read This post but i can't figure it out how to make it work. Print screen in admin area here


title: wp_schedule_single_event running twice

text: I have set up a meta box with a checkbox, so when checked and the post is saved, a scheduled event is registered to send an email to all users (around 1200) in the background. Sometimes the emails get sent twice, which would suggest the scheduled task is running twice (both emails seem to come around the same time, one after the other) Below is my code, is there anything wrong here?               function my_project_updated_send_email( $post_id ) {              if ( wp_is_post_revision( $post_id ) )             return;              if(isset($_POST['send_to_members']) && $_POST['send_to_members'] == "on" && $_POST["post_status"] == "publish"){             $subject = @$_POST['send_to_members_subject'];             $marks_message = @$_POST['send_to_members_message'];                  wp_schedule_single_event(time() + 30, 'sendnewpostemail_action', array($post_id, $subject, $marks_message, time(), ""));         }          }         add_action( 'save_post', 'my_project_updated_send_email' );          function sendnewpostemail($post_id, $subject, $marks_message, $time, $preview_email = ""){     ...     ...         $users = get_users(array(                         'meta_query'    => array(                                 array(                                         'key'       => 'receive_new_post_email',                                         'value'     => 'yes'                                     )                             )                     ));                      if($users){                     add_filter( 'wp_mail_content_type', 'set_html_content_type' );                     foreach($users as $user){                         wp_mail( $user->data->user_email, $subject, $content );                     }                     remove_filter( 'wp_mail_content_type', 'set_html_content_type' );                  }     }


title: How do I add a listbox to the TinyMCE editor?

text: I am having trouble adding a list box to the TinyMCE editor in Wordpress. I have already read entirely through this question but it did not get me all the way there: How i can i add a split button or list box to the WordPress TinyMCE instance. That solution only alerts the value in a dialog box. I want to actually insert the shortcode into the TinyMCE editor and I can't figure out how. I am successfully able to add custom buttons and listboxes to the TinyMCE editor, and the buttons work but the listbox does not. Here's my functions.php code:               // add shortcode buttons to the tinyMCE editor row 3     function add_button_3() {        if ( current_user_can('edit_posts') &&  current_user_can('edit_pages') )        {          add_filter('mce_external_plugins', 'add_plugin_3');          add_filter('mce_buttons_3', 'register_button_3');        }     }     //setup array of shortcode buttons to add     function register_button_3($buttons) {        array_push($buttons, "dropcap");        array_push($buttons, "divider");        array_push($buttons, "quote");        array_push($buttons, "pullquoteleft");        array_push($buttons, "pullquoteright");        array_push($buttons, "boxdark");        array_push($buttons, "boxlight");        array_push($buttons, "togglesimple");        array_push($buttons, "togglebox");        array_push($buttons, "tabs");        array_push($buttons, "signoff");          array_push($buttons, "fancylist");        array_push($buttons, "arrowlist");        array_push($buttons, "checklist");        array_push($buttons, "starlist");        array_push($buttons, "pluslist");        array_push($buttons, "heartlist");        array_push($buttons, "infolist");         array_push($buttons, "columns");        return $buttons;     }     //setup array for tinyMCE editor interface     function add_plugin_3($plugin_array) {        $plugin_array['fancylist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['arrowlist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['checklist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['starlist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['pluslist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['heartlist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['infolist'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['signoff'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['dropcap'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['divider'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['quote'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['pullquoteleft'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['pullquoteright'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['boxdark'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['boxlight'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['togglesimple'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['togglebox'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['tabs'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['columns'] = get_bloginfo('template_url').'/js/customcodes.js';        return $plugin_array;     }     add_action('init', 'add_button_3'); // add the add_button function to the page init      And here is my JS for adding the listbox to the TinyMCE editor:               // Creates a new plugin class and a custom listbox     tinymce.create('tinymce.plugins.columns', {         createControl: function(n, cm) {             switch (n) {                 case 'columns':                     var mlb = cm.createListBox('columns', {                         title : 'Add a Column',                         onselect : function(v) {                             tinyMCE.activeEditor.windowManager.alert('Value selected:' + v);                         }                     });                          // Add some values to the list box                     mlb.add('One Third', 'one_third');                     mlb.add('One Third (last)', 'one_third_last');                     mlb.add('Two Thirds', 'two_thirds');                      // Return the new listbox instance                 return mlb;                  }             return null;         }     });     tinymce.PluginManager.add('columns', tinymce.plugins.columns);        What do I need to change in the JS for it to actually add the shortcode to my editor instead of just displaying the value of the listbox in a modal dialog?


title: Using plural-only translation of register_post_status() in plugin

text: tl;dr: My plugin wants to translate strings from core or other plugins that use _n_noop(). How? This question related to this plugin and is sort of a follow up to this question. My plugin adds "{status} (n)" (e.g. "Drafts (10)") to the admin menus for any post type. It supports any post status added with `register_post_status()` because it grabs all statuses with the `get_post_stati()` function (not the irritatingly similar `get_post_statuses()`). When someone registers a post status with `register_post_status()`, one includes a `label_count` value in the `$args` that is perfect for what I need. I'd always like to display the _plural_ label count in the menu and use `sprintf()` to drop in the count value. Here's a truncated excerpt of the **current plugin code** (that first `sprintf()` is the thing I'm looking to change):               <?php     // an array of all the statuses     $ps_statuses = get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' );          // a filter for the list of statuses for anything people want to do that's plugin specific     $ps_statuses = apply_filters( 'psmi_statuses', $ps_statuses );          // Get status counts of all post types     $ps_status_counts = wp_count_posts( $ps_type_id );          foreach( $ps_statuses as $status ) {              $ps_status_id = $status->name;         $ps_status_count = $ps_status_counts -> $ps_status_id;              // If a status has any posts, show it         if( $ps_status_count > 0 ) {             // Get the plural post status label             $ps_status_label = $status->label_count['plural'];             $submenu[$menu][] = array(                 sprintf(                     $ps_status_label,                     $ps_status_count                 ),                 'read',                 sprintf(                     '%1$sedit.php?post_status=%2$s&post_type=%3$s',                     get_admin_url(),                     $ps_status_id,                     $ps_type_id                 )                  );         }     }      This works fine, but it's untranslatable. I can see that when WordPress registers the post stati **in core (in`/wp- includes/post.php`)**, it uses the `_n_noop()` function to allow for plural translations:               register_post_status( 'draft', array(         'label'       => _x( 'Draft', 'post' ),         'protected'   => true,         '_builtin'    => true, /* internal use only. */         'label_count' => _n_noop( 'Draft (%s)', 'Drafts (%s)' ),     ) );      However, I haven't been able to figure out how to get the translated string working. I think I need to use `translate_nooped_plural()`, but I haven't been able to get that to work (and really, I just want to use the plural string even if there's only one post in a status). Secondly, I'm really lost what text domain I should use because the statuses could be coming from core, a custom call or `register_post_status()`, or a plugin like edit flow.


title: Why does Wordpress stores widget options in a multidimensional array?

text: I have a widget with 6 different options. When I use `get_option`, it gives me a multidimensional array, with all my options inside the inner array, like so:               $options = get_option('widget_widgetname');     var_dump($options);      And the output for `var_dump` is:               array(2) { [2]=> array(5)                 {                   ["string"]=> string(6) "Search"                   ["title"]=> string(12) "WDSearchForm"                   ["show_wrapper"]=> string(0) ""                   ["animate"]=> string(0) ""                   ["animateWidth"]=> string(2) "80"                 }                 ["_multiwidget"]=> int(1) }      Therefore, in order to use the options, I would have to do `$options[2]["optionName"]` rather than the desired `$options["optionName"]`. Why does Wordpress does that? Is it always going to be under "2"? Is there a better way to retrieve those options?


title: WP supersize not displaying when different languages flags are selected

text: I've got a very strange problem with this website. The background slides appear when your English flag but when its switched to The Spanish flag or Other flag the backgrounds don't appear. Link to website Code thats generating the flags               <?php                     // SELECTOR DE IDIOMAS                     //                     function language_selector_flags(){                         $languages = icl_get_languages('skip_missing=0&orderby=code');                         if(!empty($languages)){                             foreach($languages as $l){                                 if(!$l['active']) echo '';                                 echo '';                                 if(!$l['active']) echo '';                             }                         }                     }                     //if ( is_page(array( 'pagename', 'pagename', 'pagename','pagename'))) {                         language_selector_flags();                     //}                     ?>      The backgrounds are generated by a plugin called wp_supersized. I'm slightly confused as to why it doesn't just work unless some html is been changed when the language flags are activated. Thanks for any help.


title: Associate Page with User

text: We currently have a setup where anyone can register as a user and their own 'page' gets created manually by admin. We need a menu option to be something like 'View Your Page' and direct a user to their own page. I can't get my head around it as there is no current link between the user and the page that's created manually...any thoughts? Thanks.


title: Changing 2011 theme header image based on user dropdown

text:
I posted earlier about changing my site's CSS based on user-choice from a drop-down and storing it in a cookie, which I think I have now resolved, and sort-of have working at the following address http://somethingoriginal.net. However I am trying to change the header image alongside the theme and it is proving much more difficult than I first thought. I basically want to do this in my header.php file:               if(day theme)      use day css (DONE)      setDayHeader()     if(night theme)      use night css (DONE)      setNightHeader()      I have tried calling this from in functions.php which unfortunately does nothing, I know it is being called as I have checked using echo statemnets:                   function setDayHeader(){              //Set header to day header              $args = array(              'width'         => 1000,              'height'        => 288,              'default-image' => get_template_directory_uri() . '/images/headers/SomethingOriginalSun.png',              );             add_theme_support( 'custom-header', $args );                   }          function setNightHeader(){              $args = array(              'width'         => 1000,              'height'        => 288,              'default-image' => get_template_directory_uri() . '/images/headers/SomethingOriginalTheMoonAndStars.png',              );              add_theme_support( 'custom-header', $args );            }      And tried changing it directly within the HTML of the header.php file, starting here:
               by changing the following line:                   <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />      Either by replacing **header_image()** with a variable or replacing it with a URL directly, but this just seems to make my header image disappear completely. I thought it was best to make a separate post for this as it now addresses different functionality than setting my stylesheet. Thanks.


title: %page%/number didn't return 404 but redirect to /%page%/

text: I've got page, for eg. /about/ when after slash I put some numbers (not letters) I still get this same page. I really want 404 there. Why? What to do to avoid that? SEO itp...


title: Get an image from the media library. Struggling with the code?

text:
Struggling with this code, the conditions work, the only way I can get the wp_get_attachment_url is to loop through it but then this outputs as many images from the media library and I only want one?
       <?php         if ($imgurlbase != '' ) { ?>              <img src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $imgurlbase . $imgfromtv; ?>&h=62&w=75" alt="<?php echo $programme; ?>">                      <?php } elseif ($imgurlbase == '' ) { ?>                      <?php         $args = array(             'post_type' => 'attachment',             'numberposts' => -1,             'post_status' => null,             'post_parent' => null,             );          $attachments = get_posts( $args );                               foreach ( $attachments as $attachment ) {                              if ($attachment->post_title == $programme) {                                 echo wp_get_attachment_url($attachment->ID);                             }                         else {                         echo '';                         }                          }                   ?>                                <?php } ?>


title: Best way to show map of tagged posts?

text: This seems so simple that I'm tearing my hair out. I want to add a page with a map showing all the posts with a particular tag. I want each marker to pop up with the title and the preview, allowing the visitor to click through and read the full post. Ideally I want to be able to use an OpenStreetMap map as the background instead of Google. I've had a look at geopress, geomashup, wpgeo and osm. They are all either low quality or lacking a key feature. Any suggestions?


title: Custom <blockquote> HTML markup

text:
In Wordpress, I would like to add a custom styling to the `<blockquote>` elements, replacing Wordpress' default usage by using a function (or however is easiest). When using the WYSIWYG editor, highlighting text, and then clicking the "blockquote" button, I would like the highlighted text to be wrapped with the following HTML rather than just a `<blockquote>` tag:

HIGHLIGHTED TEXT


title: How to restrict dashboard access to Admins only?

text: How would we restrict access to the WP admin area to all users except admins?   The users on our site have their own profile pages which do all the functions they need. So admin should be off limits to all except admins. How to do that?


title: Character encoding issue after changing servers

text: I recently moved my WordPress-based site from DreamHost VPS to a Linode VPS running Debian + LEMP. After getting the site up again, I noticed many erroneous characters in posts; characters like " and - were being replaced with gibberish. After doing some looking, it seemed clear that the issue was something related to character encoding. I found a guide that suggested editing `wp-config.php` and commenting out the lines: `define('DB_CHARSET', 'utf8');` and `define('DB_COLLATE', '');` I did this and it fixed the problem, but I'm wondering if that was the best way to go about it. Thank you for any advice.


title: $post>ID displays wrong post ID

text: I've asked a question about listing all sub-pages before: Listing all sub-pages? But all the questions were wrong. Anyways, I have now simpler question.               global $post;     echo $post>ID      Works totally fine, but while on pages sidebars only. When it's next to the blog loop (in a blog section) it goes crazy, for example Blog has ID of 216 (and $post>ID in loop.php shows 216), but the $post>ID in the sidebar shows 87. Why is this happening? How to fix that? Thank you! [edit] I have a suspicion that loop and sidebar are both included in index page separately and loop is getting different post ID than sidebar. The big question is how to change that. [edit for Rarst]                wp_reset_postdata();                          global $post;                          $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');                     echo $children;      Gives the same result. It works with pages, not blog. I have a normal loop, as like in Twenty Ten for example.


title: WP e-Commerce disable free shipping on certain countries

text: I'm using WP e-Commerce plugin version 3.8.9.5. I have free shipping enabled if the amount is above let's say €75,00. My main country is Holland, and I deliver to Belgium and Germany. Currently the free shipping is enabled for all countries. I just want the free shipping to be enabled on my main country, Holland. All other countries should always pay for shipping. How can I make that possible?


title: Storing custom dashboard widget options in wordpress

text: I am using the Codex example to build a custom widget. The specific example seems to be working fine until you click configure and change options values. After you click submit, changes are not saved. Is anyone having the same problem with the specific example? I am trying to build a custom widget using this as an example.


title: Pick your brain on wp-config.php if statement for multisite

text: I am trying to write a if statement into the wp-config.php to only enable define('WP_DEBUG', true); if it's not the main site in a WordPress Multisite install. I just don't know how much of the WordPress codex functions I can call from the config file. Was thinking               if ( is_main_site($blog_id) ) {       define('WP_DEBUG', false);     }     else {      define('WP_DEBUG', true);     }      But I figured I would pick the communities brain on this one.


title: Drop posts from categories in MySql

text: Is there a way to remove all posts from all categories? I found plugin for this, but it's very slow. What I need is MySql query that will help me remove all posts from all categories. If you know how to implement the same code, but only to specific category, that would be useful to have for reference too. So how to disassociate all post that belong to one category from all categories (therefore they will belong only to default 'uncategorized' category). Thanks a lot.


title: different template for first and second level custom post page

text:
I have a custom post type, for examle, products. They can be multilevel, like pages, f.e.,               Products (custom post type)              Books         |- LOTR         |- Sherlock Holmes         |- Cooking help         |- etc              CD         |- Iron maiden         |- AC/DC         |- Brainstorm         |- etc              Manuals         |- MS Word manual         |- MS Excel manual         |- PHP manual      I need a seperate pages for first level of hierachy (Books, CD, manuals), what i can achieve by creating a file archive-products.php in theme directory and then making a new query with parameter to get only first level. The problem is with the second level. I cannot figure out, how to create a template file for displaying a child elements of f.e. Books ? Of course, i can manage it by using jquery. Get all level of hierarchy, then hide second level and on the click of first level Name, open sublevel and hide first level, but this is not a solution what i need to achieve, because of the lack of the correct url. I want to get correct url for 1 level www.ddd.com/products/ and also for the second www.ddd.com/products/books/ How would you accomplish this? UPDATED This is what I have in my archive-POSTTYPE.php file.               <?php get_header();?>
                 <?              $query = new WP_Query( 'post_type=produkts&post_parent=0' );         while( $query->have_posts() ) : $query->the_post();         echo '
';         the_title();         echo '
';         endwhile;         wp_reset_postdata();                          ?>
          <?php get_footer();?>      and the single-posttype.php               <?php get_header();?>
                 <?php                      if (is_child_post()){                     //this is the true single product                     the_title();                      }else{                     //this is the product list of parent                           $query = new WP_Query( 'post_type=produkts&post_parent='.$post->ID.'' );                     while( $query->have_posts() ) : $query->the_post();                     echo '
';                     the_title();                     echo '
';                     endwhile;                     wp_reset_postdata();                 }                             ?>
     <?php get_footer();?>


title: On the WordPress Admin section how do I link to submenu pages created for a plugin?

text: So i'm trying to create a WordPress plugin and I've created some menu pages using this provided function:               add_submenu_page('my_plugin_menu', 'Edit record page', 'Edit record page', 'manage_options', 'edit_record_page', array(&$this, 'display_edit_record_page');      and when I go to the page I notice on the address bar on the browser it reads something like this:               http://mydomain.com/wp/wp-admin/admin.php?page=edit_record_page      What I want to do is to be able to link this page but I find I have to hardcode the link for lack of a better way of doing it and I'm working on a dev site. So I was wondering how I could dynamically generate the link I saw on my browser so that when I copy this plugin code onto the production server it will work. Namely, is there a WordPress function that will generate the link portion of the submenu page create.               page=edit_record_page      Also, if I want to append query strings to the to the link is it as simple as adding it manually like so:               http://mydomain.com/wp/wp-admin/admin.php?page=edit_record_page&rec_id=1      or is there an appropriate WordPress function for doing that too?


title: Taxonomy Dropdown Question

text: I need to replace the show_option_all (which show all my taxonomies), with: a command to show three taxonomies (ID 14, 15, 16) and label this 'all' Basically, when someone selects 'all' i only want to show the results of the three taxonomies above. Note: i cant exclude the taxonomy from the search results as it will effect another search form. Please help! My current code is: http://pastebin.com/NJi2LQhY Thanks Paul


title: Mail through Cron Execution, does not work!

text: Hey, So I've been trying to execute the mail php function and wp_mail function in a PHP function in wordpress. The php Function is called by a cron hook... The problem is, it doesn't execute the mail or wp_mail function at all... I even threw it inside another function which I know works perfectly, and again, the cron doesn't execute the mail command. It works outside the function and it works if I call the function manually (myfunction();) but when cron calls it, it doesnt work. any light? wp 2.9


title: Archive Listings Filtered by Date Values in a Custom Field/Post Meta?

text: _( **Moderator's Note:** The original title was "using archive by date with a custom date")_ I'm adding an additional date to posts as a custom field. Now I want the archive to show posts by the custom date and not by the published date. For example I've got a post published today _(22nd December)_ but the custom date is set to _1st January_. When I load the URL `archives/date/2011/01` in the browser the posts with the custom date that match are not displayed _(obviously)._ Is there a way to modify the behavior of page generated for the `archives/date/2011/01` URL in order to retrive the posts by the custom date? Thanks.


title: Making some links generated from the wp_nav-menu function unclickeable?

text: In this website: http://alexchen.info/brianfunshine/ I have a navigation menu taken from the twentyten theme. I want to make some links clickeable and some not (some don't have to behave like a link). I have accomplished this with some CSS but it doesn't work in all browsers. The links are dinamically generated with:               wp_nav_menu      Any suggestions?


title: sanitize attachment filename

text: I'm looking for a way to sanitize the filename of user uploaded attachments. I thought that wordpress already did it but I faced preblems after an user uploaded an attachment containing a '°' . That way the attachment is not downloadable. I found out this wp function:               sanitize_file_name($filename)      is there a way to use it inside the               add_attachment      action? thanks


title: How do I change a parent theme's function through the child theme?

text: This is a function loaded by the parent theme. Through the child theme, I want to change this function to say `is_single` instead of `is_singular`. What would be the correct way to achieve this?               add_action('wp_head', 'dt_specific_enqueues');     function dt_specific_enqueues() {              if (is_singular()) {             wp_enqueue_script( 'comment-reply' );         }          }


title: WP plugin updates

text: I wrote a plugin for WordPress which requires regular updates. Is it possible to notify user of new version being available (some of the other plugins have some kind of this option - when new version is available user can see it in his admin panel and update - everything using some built-in WP functions...)


title: correct tags for validating input types

text: I have following types of theme options inputs, which I need to validate.               $numbers = "#1234";     $email = "abc@example.com";     $simeple_text = "How's going?";     $code = "<script type='text/javascript'></script>";      I want to know which of following tags should be used for which of the above types? I have tried to read the wordpress documentation of the following functions, but could not find the clear answer.               wp_filter_post_kses     wp_filter_nohtml_kses     wp_kses_stripslashes


title: Change loop to display items in order

text: I am trying to customise a search query so that items returned are ordered in descending order. I have managed to find the loop that generates the results....               global $wp_query;     $args = array(         'post_status' => 'publish',         'post_type' => 'listings',         'meta_key' => '_ct_price',         'orderby' => '_ct_price',         'order' => 'DESC'             );          // save the existing query     $existing_query_obj = $wp_query;          $wp_query = new WP_Query( $args );      //$wp_query = new WP_Query( $search_values );           unset($search_values['post_type']);     unset($search_values['paged']);     unset($search_values['showposts']);                                          /** Prepare the title string by looping through all     the values we're going to query and put them together */     $search_params = '';      $loop = 0;     foreach ($search_values as $t => $s) {                                              if ($loop == 1) {              $search_params .= ', ';          } else {             $loop = 1;         }                                            $term = get_term_by('slug',$s,$t);         $name = $term->name;            $search_params .= '<strong>'. $name .'</strong>';                                         }      As you can see I have added in an $args section with the ordering information in, it doesnt work currently, but if I comment out the following line..               $wp_query = new WP_Query( $args );       And uncomment the following line....               $wp_query = new WP_Query( $search_values );      Then it does work but ignores the rest of the code, is there a way to add my $args onto the exiting query without breaking it?


title: WP_QUERY tax_query not working

text: $query_args = array(             'cat' => $lesson_id,             'meta_value' => $lesson_type,             'post__not_in' => array($current_post_id),             'tax_query' => array(                 array(                     'taxonomy' => 'series',                     'field' => 'id',                     'terms' => $series_id,                     'operator' => 'NOT IN'                 )                    )              );      I'm trying to exclude posts tagged with a series id in the series custom taxonomy, but it's not working. What's wrong with the code?


title: Can is_page() be combined with a switch control structure?

text: I'm using an if/else control structure to add class attributes to tags. Could I use a switch control structure instead and if so, how? If not, is there a better way to do this than what I'm doing?               <div <?php if (is_page( 'project' )) { echo 'class="project"'; }             elseif (is_page('home')) {echo 'class="home"'; }             elseif (is_page('contact')) {echo 'class="contact"'; }         ?>>     </div>


title: How to Create a Frontend Html-list Editable in the Backend?

text:
I would like to add a feature to a page to display a short list of people, like the one seen here. I have done this on other sites by styling lists with css. This time however, it's for a client and I can't trust them to copy and paste a `<li>`, editing the name, job title and img name without messing it up. What is the best way to go about creating this so that it can be easily reduced/added to in the dashboard? Basically, so that the user simply clicks "add person" then fills in some fields before updating the page. Here is the architecture of what I've used in the past (to be styled with css)-

          Jakie      her job


title: Find out if logged in user is not subscriber

text: Is there any conditional tag which will allow me to display the certain content only if the user is NOT a subscriber?


title: Single custom post type's menu ancestor/parent is Posts archive page

text: 1. I have created a theme by copying `twentyeleven` default theme.   2. I have also installed a module Custom Post Type UI and created a custom post type called "Book".   3. I have gone to `Settings -> Reading` and set `Front page displays` to `Static page` and set my Front Page to a page called `Home` and my Posts page to a page called `News & Press`.   4. I have gone to `Appearance -> Menus` and created a new custom menu. I put `Home`, `News & Press`, and `Books` (just a static page) pages to my menu item. Under `Books` menu item I've also added a few `Book` custom post type posts as children. Now when I open a `Book` custom post type page, which is a child menu item of `Books` page, the menu highlights `News & Press` as the custom post type's parent, as well as the `Books` page. I don't want this behavior, as highlighting the `News & Press` as the parent of a `Book` custom post type is completely wrong. I have done a lot of searching around, and seen a lot of fixes that suggest using jQuery, and also some php fixes which both use menu item id's which is just a bandaid fix, and not something that I would consider an actual fix to the problem because what about people who browse with javascript off, and if I used the PHP fix, then what if the menu item id's changed? I wanted to come here and see if anyone has actually managed to fix this broken behaviour with custom post types menu parent/ancestor highlighting.


title: Truncate latest activity in buddypress

text:
I'm using the buddypress hovercards plugin and Im dislaying some profile info as well as the latest status update. If a user posts a long status, it will run out of the hovercard div field. How can I properly truncate this?
       <?php _e("Last update", 'bp-hovercards'); ?>
       <?php bp_member_latest_update( 'length=10' ) ?>


title: Automatic jQuery accordion from header tags

text:
I want it to be fairly easy for the post author to setup an accordion, based on header tags. So for example this:
Headline 1

Content.. lorem ipsum

Headline 2

Content.. lorem ipsum

Headline 3

Content.. lorem ipsum
      would be converted to this (and so, accordion is activated)

Headline 1

Content.. lorem ipsum

Headline 2

Content.. lorem ipsum

Headline 3

Content.. lorem ipsum

      I've been using a setup with shortcodes — but this gets too complicated for the post author — so a more streamlined solution would be grand. Any ideas how I would go about doing this?


title: Call to undefined function issue

text: I know there are other, maybe better ways to do what I want to achieve, but I have to use this solution. I have two stylesheets:   * `style.css` - normal stylesheet   * `style-dynamic.php` - dynamic stylesheet linked to the first one I'm using some PHP code in the second one, like:               #body {         background-color: <?php echo get_option('theme_background'); ?>;     }      Now the point is that the `style-dynamic.php` file doesn't _know_ WordPress functions, and the code above gives: > **Fatal error** : Call to undefined function `get_option()` in > **C:\xampp\htdocs\wordpress\wp-content\themes\mytheme\style-dynamic.php** on > line **12** I guess I have to load `wp_load.php` (only?) and that's tricky, because I'm not sure how exactly? I was trying `require_once`, but I'm not sure I'll be able to jump from theme directory right to the WordPress main dir where `wp- load.php` file is? **Edit** Of course               require_once(ABSPATH . 'wp-load.php');      Outputs another error: > Use of undefined constant `ABSPATH` - assumed `'ABSPATH'`


title: How do I get the attributes of a short code from a post?

text: I am trying to preview a NextGen gallery on my main page (and category pages) to show a single image from the gallery on the main page next to the text from the post that normally shows up. I have found examples of PHP that get the images from a gallery given a gallery ID. In my loop I have a current post. What I cannot figure out is how to, given a post, get the attributes of the [nggallery] short code. In other words for each post with a NextGEN gallery I need the id value form the short code. For example if the post contains `[nggallery id=50]` I need the value `50`. How can I get that information from a post? I was hoping to find the solution in the source code of the next gen plug-in but of course that code registered a short code handler and lets WP call them back. There are no examples in their source code where they parse a post looking for their short code.


title: How to create a customized logout URL in BuddyPress

text: Does anyone know how to override the BuddyPress logout URL with a custom one?


title: WP-Super-Cache - generate cache programmatically

text: I wonder if there is possibility to generate WP-Super-Cache programmatically after the cache is being purged ( after I have published a new post ). I thought of writing some kind of crawler that will go trough all of my pages and generate new cache that way. But I wonder if there is another possibility? P.S. I set up a setting that my cache is being purged after I published a new post, but what I need is that not all of my cache to be deleted, after I publish a new post, but only one for archives and categories ( because those are dynamic pages ) , so if there is an opportunity to somehow select what cache will be purged, there is no need to regenerate all of the cache, as I asked in the question. Hope I made it clear. Thanks.


title: apply filters only to specific post listing without check the url parameters

text: I have made a custom post type named as: slider, in my plugin class, I am adding a filter which calls the method remove_row_action that unsets view links from actions                  add_filter('post_row_actions', array(&$this, 'remove_row_actions'), 10, 1);             public function remove_row_actions($action) {              if (isset($_GET['post_type'])  && $_GET['post_type'] == 'slider')) {             unset($action['view']);             return $action;         }else{             return $action;         }     }      It works perfectly well, but I believe there must be a cleaner way in which the add_filter only applies for the custom post type, instead of me checking it by the GET variable


title: Insert a Woocomerce product in specific product category

text: I'm a bit new to Woocomerce plugin and have a problem. I need to create products from code not from admin page. Probably I will insert them with `wp_insert_post( $product )`. The problem is I don't know how to set the category for this product. I know it's name, not the ID (in fact I know ID but it can change). How can I add the product to that category?


title: Why is my taxonomy have a category style div id?

text: I created two custom taxonomies. I created them using identical code and then finding and replacing the "name" with "name2". I've then looked at the post type page and there are two tag boxes to choose tags in. However, one div is called "namediv" and the other is "tagdiv-name2". This would suggest that one is a category and one is a taxonomy. I know that categories are kind of a taxonomy, but why is my custom taxonomy taking the form of a category? Thanks, Simon


title: Show only one category in main query, issues on tag page

text: I altered the following code from Ashfame:               add_action('pre_get_posts', 'block_cat_query' );     function block_cat_query() {     global $wp_query;        if( is_home() || is_search() || is_tag() ) {         $wp_query->query_vars['cat'] = '3';     }     }      This code DOES work to filter posts from category #3 only on the home, search and tag pages. However, I am utilizing               <?php single_tag_title(); ?>      in my header.php file and on specific tag pages, the tag title is not showing up. The page is instead showing the category title. This is only happening with this function in place, so I'm trying to figure out if there is another way of writing the function above that does not effect the use of `<?php single_tag_title(); ?>` on tag pages.


title: wordpress template page Usage

text: > **Possible Duplicate:**   >  Loading template files from a subfolder in my theme? How to create template page which is in a separate folder within theme directory, for pages and also to open it in other pages (i.e: link to those template pages.). I have created a folder in my theme directory and inside it i also create a template page but no working.


title: Better wordpress attachment query then this

text:
I have a site with more then 10.000 posts and images, its classipress site. I need somehow to show all images from posts that are on pending status, and who havent expired(post meta). This is the code I came up with and that is working:               function cb_dash_images(){         $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post_id, 'order' => 'ASC', 'orderby' => 'ID');         $images = get_children($args);              foreach($images as $image){              // Get post expire time in timestamp             $post_time = strtotime(get_post_meta($image->post_parent,'cp_sys_expire_date',true));             // If draft and not expired             if(get_post_status($image->ID) == 'pending' && current_time('timestamp') < $post_time) {             $slika = wp_get_attachment_image($image->ID, 'thumbnail');              edit_post_link( $slika, '
', '
', $image->post_parent );              }            }     }      This is working. BUT its going through all 35k images and check for each one of them, if its parrent -post status is on pending and if its parrent post meta have expired. And its really slow :) How can I first check if post is on pending and post meta value, then do the loop, as that way, it wouldnt go through 35k images, but only images from posts who are one pending and with specified post meta value. Thank you!


title: How to add a Custom Link to a Menu with an URL that is relative to the blog URL

text: Part of my work is to create Wordpress websites. I usually work on my laptop until I have something good enough to be uploaded to the test server where the client reviews it. I create a VirtualHost for every new project so I'm always working with a Wordpress installation in a domain that looks like `http://local.example.com/`, but when the site is uploaded to the test server (not controlled by me), the domain may end being something like `http://testserver.com/arbitrary/path/example/`. The problem is that if I add a custom link to a menu that points to, for example, `/events/`, it would work fine locally creating a link to `http://local.example.com/events/`, but in the test server the link will point to `http://testserver/events/`, which is obviously not right.   **What I want is to give the custom link an URL that would work both on my local environment and the test server.** I already handle the problem of changing the `home` and `siteurl` Wordpress options by:   * changing those settings on the local database   * creating a dump of the database   * update the database on the server   * restoring the local options. I don't want to use full URLs for the custom links and having to replace those with the server URL every time I need to update the server's database. For links inside the post content there is a plugin that solve the problem adding two shortcodes: http://wordpress.org/extend/plugins/url-shortcodes/, but I haven't been able to find something similar for Custom Links.


title: Prevent include script twice (wordpress importer)

text: I created my own demo installer but I have some difficulties to correctly load wordpress importer without conflict. I tried to get the page parameter on page load. If the admin url have 'page' parameter then I will load 'wordpress importer from my folder. I want to do that in order to prevent duplicate loaded importer file when I want to use the standard wordpress importer. However I didn't success to do it completely. the demo install function url is: localhost/wordpress/wp- admin/admin.php?page=_options&tab=0 With this code I succeed to prevent loading wordpress importer twice but my action are not working...js coce and css are working great.               add_action( 'admin_init', 'demo_installer_init' );     function demo_installer_init() {         global $wpdb; ;              if (current_user_can('manage_options') && isset($_GET['page'])) {                  if (!defined('WP_LOAD_IMPORTERS')) {                 define('WP_LOAD_IMPORTERS', true);             }                  if (!class_exists('WP_Import')) {                 $wp_import = get_template_directory() . '/includes/demo-installer/wordpress-importer.php';                if (file_exists( $wp_import)) {                    require $wp_import;                }             }              wp_register_script( 'demo_installer_js', get_template_directory_uri() . '/includes/demo-installer/demo-installer.js', array('jquery'), '1.0', 1);           wp_localize_script( 'demo_installer_js', 'wp_ajax', array('url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'ajax_nonce' )));         wp_enqueue_script( 'demo_installer_js' );         wp_register_style('demo_installer_css', get_template_directory_uri() . '/includes/demo-installer/demo-installer.css');         wp_enqueue_style('demo_installer_css');          add_action( 'wp_ajax_demo_installer', 'demo_installer' );         add_action('wp_ajax_nopriv_demo_installer', '_demo_installer');         }     }      With this code my demo installer works perfectly but I ve got an error when I go to the standard wordpress importer page in admin panel:               add_action( 'admin_init', 'demo_installer_init' );     function demo_installer_init() {         global $wpdb; ;              if (current_user_can('manage_options')) {                  if (!defined('WP_LOAD_IMPORTERS')) {                 define('WP_LOAD_IMPORTERS', true);             }                  if (!class_exists('WP_Import')) {                 $wp_import = get_template_directory() . '/includes/demo-installer/wordpress-importer.php';                 if (file_exists( $wp_import)) {                     require $wp_import;                 }             }              wp_register_script( 'demo_installer_js', get_template_directory_uri() . '/includes/demo-installer/demo-installer.js', array('jquery'), '1.0', 1);           wp_localize_script( 'demo_installer_js', 'wp_ajax', array('url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'ajax_nonce' )));         wp_enqueue_script( 'demo_installer_js' );         wp_register_style('demo_installer_css', get_template_directory_uri() . '/includes/demo-installer/demo-installer.css');         wp_enqueue_style('demo_installer_css');          add_action( 'wp_ajax_demo_installer', 'demo_installer' );         add_action('wp_ajax_nopriv_demo_installer', '_demo_installer');         }     }      I really don't understand what's happen I verify $_Get['page'] and '_option' parameter is correctly get... I need some help to understand what is the right way to proceed


title: get_adjacent_post_link excluded_terms ignored

text: I call the function ´get_adjacent_post_link´ using the argument ´$excluded_terms´. But this argument is ignored. This is how I call the function.               get_adjacent_post_link(         '%link',         '',         false,         array(83, 88, 89, 182),         true     );      By clicking the resulting link I can reach a post that is in the category 'Blog Eintrag (de)' which has this admin URL               /wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=83&post_type=post      I think that a post with this category should be excluded by the argument ´array(83, 88, 89, 182)´. Why is it not? My Wordpress version is 3.9.1.


title: Hook Into the_content Filter For JSON API Only

text: I'm trying to figure out a way to remove the shortcodes from my JSON output which I'm using the Wordpress JSON API for. I need to remove the shortcodes from the content before `do_shortcode` is applied which will cause the shortcodes to render. The reason being that they will break in my mobile app (they reference various js etc.. not in the app) I've found a Strip Shortcodes function which I can hook into `the_content` filter as these filters are applied by the plugin before it encodes it to JSON. But how can I only do this when I am working with a request for json information as I don't want to remove the shortcodes on the general site. I know I can check for things like `is_single()` or `is_home()` but I can't see anything similar which would tell me if it's for a JSON output. Is there anyway I can tell if it is or not so I can choose when to use the strip shortcodes function? One thing I thought about was examining the url to see if `json` is in it, but I was hoping there could be something more robust?


title: select menu assign custom taxonomy to options class

text: I am trying to get make a select menu that uses the custom taxonomy values for a post and then assign them to the class="" for the options. I feel like I'm real close, but I'm having some issues: 1) I can't get the titles of the post (which are in a custom post-type) to get into the select menu. For some reason its displaying outside of it. 2) This is the main reason for my post, how do I get the terms(?) or categories of a custom taxonomy that a post in a custom post-type resides in? This is what I've got: For the purpose of this example: $postType = locations $taxonomy = state_category and in the state_category there is State (parnt) and City (child) categories.               function getLocations($postType, $taxonomy) {              $postArgs = array(                     'post_type' => $postType,                     'post_status' => 'publish',                     'posts_per_page' => -1,         );              $my_query = null;              $my_query = new WP_Query($postArgs);              $menu = '<select name="" id="">';              if( $my_query->have_posts() ) {                  while ($my_query->have_posts()) : $my_query->the_post();                 $location = the_title();                      $stateCity = wp_tag_cloud( array(                                                  'taxonomy' => $taxonomy,                                                  format => 'list' )                                          );                       $menu .= '<option class="'.$stateCity.'" value="'.$location.'">'.$location.'</option>';                  endwhile;         }              $menu .= '</select>';              echo $menu;               wp_reset_query();      }      The goal is to get $stateCity to be the terms (?) or categories (class="State City") that the post is in. Thanks!


title: Arrange Category post manually when displayed

text:
Is there way to display the category post manually or in a specific order. Basically the post are arranged in alphabetical order. It is a clients request ![enter image description here](http://i.stack.imgur.com/j4nyY.jpg) Here is the code for category post               <?php query_posts('posts_per_page=-1&cat=4');; if(have_posts()) : while(have_posts()) :the_post(); ?>

                     <?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '';  } ?>

                  <?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>
                 <?php the_excerpt(); ?>                 <a class="learn_more" href="<?php echo get_permalink(); ?>" title="Learn More">Learn More
     <?php endwhile; endif; wp_reset_query();?>      It would be such a hassle if i have to query or call each post instead


title: ?posts_type=xxx not rewritten

text: After some more testing and tweaks my main problem _seems_ to be the order rewrite rules are applied, and the second is canonicalization. I'm using this in function.php makes year archives work:               /**     * Generate date archive rewrite rules for a given custom post type     * @param  string $cpt        slug of the custom post type     * @return rules              returns a set of rewrite rules for Wordpress to handle     */     function my_generate_date_archives($cpt, $wp_rewrite) {      $rules = array();          $post_type = get_post_type_object($cpt);     $slug_archive = $post_type->has_archive;     if ($slug_archive === false) return $rules;     if ($slug_archive === true) {         $slug_archive = $post_type->name;     }          $dates = array(         array(             'rule' => "([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})",             'vars' => array('year', 'monthnum', 'day')),         array(             'rule' => "([0-9]{4})/([0-9]{1,2})",             'vars' => array('year', 'monthnum')),         array(             'rule' => "([0-9]{4})",             'vars' => array('year'))         );           foreach ($dates as $data) {         $query = 'index.php?post_type='.$cpt;         $rule = $slug_archive.'/'.$data['rule'];              $i = 1;         foreach ($data['vars'] as $var) {             $query.= '&'.$var.'='.$wp_rewrite->preg_index($i);             $i++;         }              $rules[$rule."/?$"] = $query;         $rules[$rule."/page/([0-9]{1,})/?$"] = $query."&paged=".$wp_rewrite->preg_index($i);     }     return $rules;     }        If I do `http://domain.com/?post_type=publications&year=2013` the desired posts are shown, but the URL is re-written to `http://domain.com/2013/?post_type=publications` If I do `http://domain.com/publications/2013/` the correct posts are shown. If I do `http://domain.com/publications/?year=2013` the URL rewrites to `http://domain.com/2013/` and it shows the blog (not CPT) posts for that year - it shows the "correct" posts for the URL, but the incorrect posts and URL given the query_vars it was passed. So the main problem is: How do I make it rewrite the query_var ?post_type=publications to /publications/, and put it before the /2013/ in the URL? The secondary problem is: Why doesn't `http://domain.com/publications/?year=2013` go to `http://domain.com/publications/2013/`? Seems like a canonicalization rule problem?? Thanks. * * * --- original question --- I have a Custom Post Type, setup using the plugin Types, called Publications. Pretty permalinks are turned on, and have been re-saved to flush values. Simple version: How do I rewrite /?post_type=XXX to /XXX/? Long version: When viewing the archive page (archive-publications.php, calling loop- publications.php) the URL correctly re-writes to domain/publications/ My problem is to do with combining years archives. I have some code in functions.php (rewrite rules) to allow year archives to work - so domain/publications/2013/ shows the posts correctly. Likewise, domain/?posts_type=publications&year=2013 shows the correct posts, however it rewrites to domain/2013/?posts_type=publications However domain/publications/?year=2013 rewrites to domain/2013/ and so shows all posts, not just the CPT. Can you help me make this work "correctly"? I guess I need a new rewrite rule that deals with post_type= and gives it priority over the year rewrite, or something. Thanks.


title: Infinite scroll on sidebar widget

text: I am trying to add an infinite scroll functionality to a website i am building, but i want to add it to a sidebar widget. I have a widget that shows a list of recent posts, and i would like to add an infinite scrolling to that widget, so when a user scroll till the end of this list, he has more results loading. Found this little script that does it for the loop, will appreciate you help how to change it so it will work with the "recent posts' widget:               /* infinte scroll */     function infinite_scroll() {     global $avia_config;     if ( is_archive() || ($avia_config['currently_viewing'] == 'blog' && !is_single()) ){     echo '<script type="text/javascript">';          echo 'jQuery(".content").infinitescroll({     navSelector: ".pagination",     nextSelector: ".pagination a:first",     itemSelector: ".content .post-entry",     loading: {     img: avia_framework_globals.installedAt + "images/custom/loader.gif"     }     },     function(){          avia_ajax_call();     }     );';          echo '</script>';     }     }     add_action('wp_footer', 'infinite_scroll');      https://raw.github.com/paulirish/infinite- scroll/master/jquery.infinitescroll.min.js I also found this plugin but again it only lets you set and infinite scrolling to an archive page. https://wordpress.org/plugins/infinite-scroll/ I was breaking my head around it for a while now, Will appreciate any help. Thank you.


title: ThickBox replacement

text: I'm searching, unsuccessfully unfortunately, for a ThickBox replacement used in Media Uploader. Any search fails on how to leverage Media Uploader and nothing about a script used for modal windows. Can somebody help me? Is there a way to use the same modal as Media Uploader is using, but to put custom content in it like it was possible with ThickBox?


title: Select particular post type by a particular category

text: I have a couple post types and a couple categories. Each of the post types have 4 or 5 categories attached to it. My question is how to show the post type (post) of a particular category? This is my first: `posts -> post_type(currentissue) -> category(mk,mn,ms,mj)` This is my second: `posts -> post_type(currentbug) -> category(mk,mm,md)` If I click on each category, I want to see the posts that are related to that category. Like if I clicked on the "mk" category, then I should see the currentissue and currentbug posts. I hope you get what I mean. Thank you for any help.


title: Custom Post Type used for FAQs Accordion

text:
OK, so I asked this earlier and no one had any answer for me. I have a CPT for FAQs. FAQs are separated into 'categories.' I need the name of the 'category' then a every post within that 'category.' Example:      ## Category 1 ### Title of Post 1 within Category 1 Content of Post 1 within Category 1 ### Title of Post 2 within Category 1 Content of Post 2 within Category 1      ## Category 2 ### Title of Post 1 within Category 2 Content of Post 1 within Category 2 ### Title of Post 2 within Category 2 Content of Post 2 within Category 2       The code that I now have is:                            <?// for a given post type, return all except 'uncategorized'                 $post_type = 'faq';                 $tax = 'category';                 $tax_terms = get_terms($tax, array('orderby' => 'id', 'order' => 'ASC', 'exclude' => '1'));                 if ($tax_terms) {                     foreach ($tax_terms as $tax_term) {                         $args = array(                             'post_type' => $post_type,                             "$tax" => $tax_term->slug,                             'post_status' => 'publish',                             'posts_per_page' => - 1,                             'orderby' => 'title',                             'order' => 'ASC',                             'caller_get_posts' => 1                             ); // END $args                         $my_query = null;                         $my_query = new WP_Query($args);                         if ($my_query->have_posts()) {                             echo '

' . $tax_term->name . '

';                                  while ($my_query->have_posts()) : $my_query->the_post(); ?>

<?php the_title(); ?>
                                         <?php the_content(); ?>
                  <?php                             endwhile; } // END if have_posts loop                             echo '

'; // Close 'details', 'wrap', & 'aro' DIVs                     wp_reset_query(); } // END foreach $tax_terms                 } // END if $tax_terms             ?>            This code does list every 'category' individually, which I do want. However, every post within FAQs is listed under every 'category,' which is not what I want. Any ideas what I'm doing wrong?


title: Get rid of this Strict Standards warning

text: I'm trying to get rid of this warning from my wordpress installation. Strict Standards: Only variables should be passed by reference in xxxxx on line 67 The line with the "faulty code" is this one               $wp_theme_name = next(explode('/themes/', $stylesheet_directory_uri));      However, if I do pass the value per reference as requested, the WP doesn't load anymore. Can you please help me to understand how to fix this? Thanks Andrea


title: Module with the GET/POST value acceptance?

text: In Wordpress, how to make a API like Module, which can accept the data being passed via Get or POST arguments. I mean, the Wordpress should be able to accept the URL calls from external, and then process it. I mean, as the external Application or myself manually, when i call:   * http://www.wordpress-site.com/test?name=james&age=14 Then how to write a module to read such incoming GET/POST values and process it (Save them into the Database or something) It is actually a public API.


title: WordPress failure when logging out

text: I have came across the WordPress logout error several times but I really never figured out the cause of it. In earlier days, it was generally that I was missing a nonce but now even with logout link generated by `wp_logout_url();`, I am greeted with the WP die screen:               You are attempting to log out of SITE     Do you really want to log out?      What causes this to trigger at the first place? **Edit:** Like I mentioned it was happening randomly, I think I figured out something. IT works fine with link generated by `wp_logout_url();` but as soon as I use a `$redirect` parameter in `wp_logout_url( $redirect );`, I start facing the issue. Any light on the matter?


title: How to include WP_Widget from another file in main plugin file?

text: I tried to use the code bellow in my main file:               define( 'MYPLUGINNAME_PATH', plugin_dir_path(__FILE__) );          include MYPLUGINNAME_PATH . 'class/class-widget.php';      Then I have a file class/class-widget.php with this code:               class WpSuperWidget extends WP_Widget {         public function __construct() {         }     }


title: What's the .php file which generates the Custom Background page in the admin panel?

text: What's the `.php` file which generates the `Appereance->Custom Background` page in Wordpress' admin panel? ![enter image description here](http://i.stack.imgur.com/kE0QA.png)


title: Move local build from localhost to localhost.com to support subdomains

text: I created a local WordPress Multisite installation using MAMP, which I've been accessing via `http://localhost/`. After 2 weeks of development work, I found out I need to add a blog subdomain (`http://blog.localhost.com`), which WordPress Settings Requirements prevent me from doing unless I edit my hosts file. So I made this change in wp-config.php:               define('SUBDOMAIN_INSTALL', true);      And edited my hosts file like below:               127.0.0.1       localhost.com     127.0.0.1       blog.localhost.com      But it's still not working. I've tried stopping/starting MAMP, but this didn't help. What I'm wondering is this: is it too late to make this kind of change, since my site was originally configured as `http://localhost/` and not `http://localhost.com`? If yes, will I need to start from scratch? If I can salvage my existing installation, what additional steps do I take?


title: How to setup a Network Plugin across the network with only my settings?

text: I have setup a WP MU site and installed a plugin into the main MU site. I want this plugin enabled across all the sites and hidden from site admins if possible. I want the plugin settings to come from the super network site not site admins. On my super admin plugins page I see this: ![enter image description here](http://i.stack.imgur.com/RudcH.png) Notice the Network Activate link. I enabled it but new sites do not have the settings from the main site and the plug in is not hidden (it not as important if it's hidden or not).


title: List number of posts with a specific meta_key for each meta_value

text: I would like to list my posts by a specific custom field. At the same time, for each custom field, I would like to count the number of posts with a specific custom field value. I have a custom field 'shops' with different meta value (for example: 'nike', 'adidas', 'puma',...) and I'd like to have list like this: nike:6 puma:2 adidas:12 I tried with this but it works only if I put "manually" the value of the custom field 'shops':               $args = array('meta_query' => array( array('key' => 'shops','value' => 'Nike')), 'numberposts' => -1, 'category' => -122, 'meta_key' => 'duedate','meta_value' => date("Ymd"),'meta_compare' => '>=' );     $myposts = get_posts( $args );     echo 'Nike: ' .count($myposts);      How to insert the the custom field value as a variable? thanks in advance for your support. _**_** _**UPDATE **_****** I create this               <?php $args = array('posts_per_page' => -1,'category' => -122,'meta_key' => 'duedate','meta_value' => date("Ymd"),'meta_compare' => '>=' ); $the_query = new WP_Query($args);?>     <?php if ($the_query->have_posts()) : ?>     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>     <?php $series = get_post_meta($post->ID, 'shops', true); ?>          <?php if($series): ?>         <div>             <?php $args1 = array('meta_query' => array( array('key' => 'shops','value' => $series)),'posts_per_page' => -1,'meta_key' => 'duedate','meta_value' => date("Ymd"),'meta_compare' => '>=','order' => 'ASC');?>                   <?php $chapters = new WP_Query($args1); ?>                       <?php $count = $chapters->post_count; echo $series .': '.$count; ?>         </div>     <?php endif; ?>     <?php endwhile;endif; ?>      and it works but it display 'shops' as the number of the number of posts: nike: 2 puma: 3 nike: 2 adidas: 1 puma: 3 puma: 3 probably something in wrong in the first loop. Could you please help me? Thanks


title: How to remove the cufon script from Dzonia Lite theme

text: I am using Dzonia Lite theme in my website. When I try to remove the cufon script from my functions.php file the sliders that were present in the website are not working. Colud anyone suggest me how to overcome this issue? # scripts in my functions.php               function inkthemes_wp_enqueue_scripts() {         if (!is_admin()) {             wp_enqueue_script('jquery');             wp_enqueue_script('inkthemes-ddsmoothmenu', get_template_directory_uri() . "/js/ddsmoothmenu.js", array('jquery'));             wp_enqueue_script('inkthemes-slides', get_template_directory_uri() . "/js/slides.min.jquery.js", array('jquery'));             wp_enqueue_script('inkthemes-jcarouselite', get_template_directory_uri() . "/js/jcarousellite_1.0.1.js", array('jquery'));             wp_enqueue_script('inkthemes-confu-ui', get_template_directory_uri() . "/js/cufon-yui.js", array('jquery'));             wp_enqueue_script('inkthemes-quicksand-confu', get_template_directory_uri() . '/js/mank-sans.cufonfonts.js', array('jquery'));             wp_enqueue_script('inkthemes-custom', get_template_directory_uri() . '/js/custom.js', array('jquery'));         } elseif (is_admin()) {              }     }


title: Display Country Flag in Profile Wordpress/Buddypress

text: Hoping someone could help me with a question regarding displaying country flags next to a member name. Right now I am using a custom meta containing country and then echo the flag back if the condition is met. Instead of writing out hundreds of lines of code to display a flag in this manner, is there a more efficient or smarter way of coding this. I can't imagine displaying 100's of lines of code in the members-header.php can be good. Here is the code I am using to display the flag for Korea:               <?php          global $bp;          $korea = get_usermeta( $bp->displayed_user->id, 'location' );          if( $korea == 'korea' );          echo '<img src="http://www.mydomain.com/flags/KR.gif" border=0>';     ?>      Any help would be greatly appreciated. Tom


title: Widget to show posts in the sidebar basing on its IDs

text:
I am trying to create a widget that displays posts in the sidebar taking post IDs as input from the user. The result of my code is that the widget displays just the first entered ID and ignores the others. Example: if my input in the widget is 1236, 1234, 1235 the widget frontend will display just the post with id 1236. This is the code of my widget:                           <?php                 /*                 Plugin Name: Post in Sidebar                 Plugin URI:                  Description:                  Author:                  Version: 1.0                 Author URI:                  */                 class postInSidebar extends WP_Widget {                          public function __construct() { // Create the Widget                              parent::__construct(                             'postInSidebar', // ID                             'Post in Sidebar', // Name                             array( 'description' => 'Post in Sidebar lets you choose some App Reviews and show them in the sidebar' )                             ); // Description                          }                          public function widget( $args, $instance ) { // Frontend                              extract($args, EXTR_SKIP);                              echo $before_widget;                         $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);                              if (!empty($title))                         echo $before_title . $title . $after_title;                              // start postInSidebar frontend                              $wp_query = new WP_Query( array (                             'post_type' => 'post',                             'post__in' => array($instance['postsToShow']),                             'orderby' => 'post__in'                         ));                              ?>                              <?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                              <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                                     <?php the_title(); ?> - <?php the_ID(); ?>

                              <?php endwhile; else: ?>
No posts yet, go to appearance -> widgets and choose which posts to show here.
                         <?php endif; ?>                              <?php wp_reset_postdata();                              // end postInSidebar frontend                              echo $after_widget;                          }                          public function update( $new_instance, $old_instance ) { // Update                              $instance = $old_instance;                             $new_instance = wp_parse_args((array) $new_instance, array(                                 'title' => '',                                 'postsToShow' => ''                             ));                             $instance['title'] = strip_tags($new_instance['title']);                             $instance['postsToShow'] = strip_tags($new_instance['postsToShow']);                         return $instance;                          }                          public function form( $instance ) { // Backend                              $instance = wp_parse_args( (array) $instance, array(                             'title' => '',                             'postsToShow' => ''                         ));                         $title = esc_attr($instance['title']);                         $postsToShow = esc_attr($instance['postsToShow']);                         ?>
                           <label for="<?php echo $this->get_field_id('title'); ?>">                             Title:                             <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />

                           <label for="<?php echo $this->get_field_id('postsToShow'); ?>">                             Posts To Show:                             <input class="widefat" id="<?php echo $this->get_field_id('postsToShow'); ?>" name="<?php echo $this->get_field_name('postsToShow'); ?>" type="text" value="<?php echo esc_attr($postsToShow); ?>" />
                          <?php }                      }                      add_action( 'widgets_init', function(){                      register_widget( 'postInSidebar' );                 });


title: How to add custom template tag in wordpress theme?

text: I am working on a WordPress site, it's an online newspaper site. The theme I am developing, I want to add custom template functions like `get_footer()` or `get_header()`, so that I can save those HTML and PHP codes like the way `footer.php` stores. Thanks in advance.


title: Remove wrong dashes from get_the_title()

text: I have a particular CPT post that has a dash (-) in its title. I copy this title in a variable `$var` using `get_the_title()` then I create a custom field somewhere else with a value equal to `$var` : `add_post_meta($my_post_id, 'some_name', $var);` Problem: in the custom field, the dash became a HTML entity with a "&", "#" and a 4-digit number number. Why, and how to fix the problem?


title: Getting a WordPress Debug Strategy

text: I have been reading up on debugging. I watched Chip Bennett's video on wordpress.tv and was inspired to take debugging seriously. What I have found in my reading up though has confused me a bit. I know about `define( 'WP_DEBUG', true );` and some of the debug plugins like 'debug bar' and 'firephp' and also 'log deprecated functions', and having read this I fine plenty more ways to debug WordPress, but I can't conceive an overall strategy. What I mean is: is it ok to just use just `define( 'WP_DEBUG', true );` ... and if so then what are the plugins for. I think I understand the difference between these and say 'log deprecated functions' for instance but I am slightly blinded by the light I think with regard to the others. I know I could just install each plugin and play with it till I can answer this question but I really had hoped that someone could save me the time with a little direction. Mainly what I want to know is this: am I right in thinking that `define( 'WP_DEBUG', true );` is where it starts and the plugins are just improving on that, so that if I get ONE good plugin that works for me then I dont necessarily need to do anything else (like using a combination of these plugins) ... OR is it probably necessary to use a combination of debugging plugins and aids and if so what are people's recommendations.


title: convertEntities() used before it is defined

text: I have an error generated from thickbox loading on every page including the admin area. This is being printed into the html               <script type='text/javascript'>     <![CDATA[ */ var thickboxL10n = {     next: "Next >", prev: "< Prev",image:      "Image",  of: "of", close: "Close",      noiframes: "This feature requires inline frames. You have iframes disabled or your browser does not support them." };      try{convertEntities(thickboxL10n);}catch(e){}; /* ]]> */ </script>       I would not really care but it is breaking firefox which sucks when the project is mid-development. The problem is here: > convertEntities is not defined > > Line 55 try{convertEntities(thickboxL10n);}catch(e){}; I tried to just stop it with a function                function conditional_thickbox() {       global $post;       if (is_singular() &&         strpos($post->post_content,'class="thickbox"') !== false) {           wp_enqueue_script('thickbox');           wp_enqueue_style('thickbox');       }     }     add_action('wp_print_styles','conditional_thickbox');      That works well but it removes from everywhere and I realized this is a dependency for Wordpress image upload functionality. I think I found the fix here : http://core.trac.wordpress.org/attachment/ticket/16227/convertEntities- Firebug-Fix.diff Which requires me hacking the core, any ideas on the best way to fix this ?


title: permalinks on title tag

text: Is it possible to have my custom permalink structure on title tag of my blog? my current permalink structure is this `/%postname%/%location%/%mba_courses%/` where my location and mba_courses are custom taxonomies Now I want this on my title tag, can I write something like this in title tag?               <title><?php echo (/%postname%/%location%/%mba_courses%/); ?><title>      I know this is a wrong code, and it won't work, but is their any way, where I can have this kind of title tag?


title: Does Wordpress Loop have a function like Shopify's cycle?

text: Shopify's Cycle lets you alternate between things within a loop. Here's my example:                   <div class="{% cycle 'first', 'second', 'third' %}">           {% include 'product-grid-item' %}         </div>      My question, is there anything like this for Wordpress? I'd love to be able to cycle through some kind of setting - such as class names - as each item in my loop is printed.


title: Wordpress MailChimp Framework suddenly stopped working without modification

text: I had a WordPress webshop setup, and I am using the [MailChimp Framework plugin][1] for sending newsletter, among other things. Now, the setup has been running since January 1st, then all of the sudden the Mailchimp framework suddenly stopped sending. The "Everything's Chimpy" ping status does not appear as well, sometimes it's NULL, sometimes it's garbage character. I am pretty sure I haven't touched any code of the plugin, and a colleague having a totally different project has experienced it as well. Also, I remember their reply used to be "text/json", but now I see a reply with Content-type "application/json". Is any one of you experiencing this as well? Update: Mailchimp API responded: http://groups.google.com/group/mailchimp-api- discuss/browse_thread/thread/f46b9ddfc6725aa3 http://groups.google.com/group/mailchimp-api- discuss/browse_thread/thread/8a03c3a9cd3dc3bf There seems to be a problem with connections being suddenly being dropped at mid-call. They have updated the MCAPI wrapper. I haven't tested this yet.


title: show/hide toggle for subpages in wordpress admin area

text: We have a wordpress site using many subpages to each page - I'm looking to create a show/hide accordion toggle within the backend to show and hide subpages allowing us to keep the page listings clear. Does anyone know of a plugin to do this? I've had a google but not much joy so far..


title: How to Change the Categories Order in the Admin Dashboard?

text: The order of categories on dashboard is alphabetical. Can I change it to custom order?


title: Better search for Wordpress admin backend

text: Is there better search functionality or a plugin for the admin area of posts or custom post types, I would like to be able to search custom fields and maybe some other advanced searches from the backend only.


title: Restore original WP admin bar after BuddyPress install

text: I want to re-enable the original WP admin bar after installing BuddyPress! `define( 'BP_DISABLE_ADMIN_BAR', true );` completely disables the admin bar - don't want that. This question tells us to check the BuddyPress Codex page, and I tried messing with those action hooks but didn't get any desired results. What's missing? How do we get that admin bar back?!


title: Stripping tags from oEmbed and adding a <div>

text:
I have these two functions as follow:               function filter_ptags_on_iframe($content){         return preg_replace('/
\s*(*.<\/iframe>)\s*<\/p>/iU', '\1', $content);     }     add_filter('the_content', 'filter_ptags_on_iframe');      and:               function addSubscribeButton($html, $url, $attr, $post_ID) {         wp_register_script('YoutubeJS',("//apis.google.com/js/platform.js"), false, '1.0');         wp_enqueue_script('YoutubeJS');           return $html . '

';     }     add_filter('embed_oembed_html', 'addSubscribeButton', 10, 4);      The first one strips the phantom `<p>` tags from every iFrame and it works fine. The second function adds a Subscribe button from Youtube in the bottom of every oEmbed object, but when I use the `addSubscribeButton`, the first function doen't work. I guess its something about priorities. Any suggestions to what the problem might be?


title: Custom URL in Wordpress with add_rewrite_rules and add_rewrite_endpoints

text: I have the following URL for a filter functionality that i try to build in wordpress:               example.com/offers-type-all-inclusive-from-germany-transportation-airplane.html      How can I make the arguments optional so that links like               example.com/offers-type-all-inclusive-transportation-airplane.html      or               example.com/offers-type-all-inclusive-from-germany.html      redirect me to a custom template page named filters.php with the filters array filled correctly:               $filters = array(                     'type' => 'all-inclusive',                     'from' => 'germany',                     'transportation' => 'airplane'                     );      I've tried this until now               add_rewrite_rule('^offers-type-?([a-z0-9-]+)?-from-?([a-z-]+)?-transportation-?([a-z0-9-]+)?.html','index.php?filters=offers&type=$matches[1]&location=$matches[2]&transportation=$matches[3]','top');      But I don't know how to make them optional. And also, building rewrite rules for each link type I don't thing it's efficient because I can have many more filters.


title: Trouble After Update, Removing Plugin

text: I'm editing this site http://www.millermusicproductions.com/ currently and I updated WP 3.0.1 to 3.3.1. After updating, the page now is zoomed in compared to how it had been and I have no idea why. Here's another site with the same template that is sort of zoomed out in comparison. I want it to end up looking like this. http://www.millermusiclessons.com/ Also, I am trying to get rid of the login in the upper-right corner. I go to plugins and deactivate a plugin called "Login with AJAX", then I refresh the page and only the page's header displays. Please help me get rid of the login. I posted several threads on the WP Support Forums and received no answers. Thanks!


title: How do I "trash" a custom post type post while logged in as Admin

text: I am using the members plugin and have a custom post type of "listing" When I navigate to listings in the backend, I can edit. quickedit, and view. There is no option to trash. I am logged in as the admin.               add_action('init', 'listing_init');     function listing_init()       {       $labels = array(         'name' => _x('Listing', 'post type general name'),         'singular_name' => _x('Listing', 'post type singular name'),         'add_new' => _x('Add New', 'Listing'),         'add_new_item' => __('Add New Listing'),         'edit_item' => __('Edit Listing'),         'new_item' => __('New Listing'),         'view_item' => __('View Listing'),         'search_items' => __('Search Listing'),         'not_found' =>  __('No Listing found'),         'not_found_in_trash' => __('No Listing found in Trash'),         'parent_item_colon' => ''       );     $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_ui_menu' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'listing',         'map_meta_cap' => true,         'hierarchical' => false,         'menu_position' => 5,         'supports' => array('title','editor','thumbnail'),         'taxonomies' => array('category')       );      register_post_type('listing',$args);      }      this is the functions.php custom post type code that I am using. Everything else works great. Inside the members plugin I have roles for delete_listing and delete_listings (which I think is not necessary) Any ideas on what I am doing wrong here?


title: Multiple wp-config.php files in one home directory

text: It's possible to move wp-config.php up one directory level for security, i.e. into the directory above public_html (sometimes called home or a user name, depending on the web host). "You can move the wp-config.php file to the directory above your WordPress install", according to http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php And I have done that with one WP sites' wp-config.php file. But how does one do that with multiple WP sites in their own folders in public_html? Is there a way to rename multiple wp-config.php files - something like wp-config1.php and wp-config2.php, etc. - in the home directory for each different WP site? And use .htaccess or some other method to enable each WP install to find its own wp-config.php file? One solution I guess is Multisite, but that's not possible in this case.