title: Import Dummy Content and Post Thumbnails

text: I am setting up a small dummy content plugin. What I would like to do is import several posts using `wp_insert_post`. Then I would like to import several images using `wp_insert_attachment` and then follow this by setting these imported images as post thumbnails for the various posts that were uploaded. I have the first two steps figured out, it is the third ones logic that I am having trouble with. I have the entire code pasted here: http://pastebin.com/Gxkhhqga but the general gist is to create an array of posts, and bring them in with               foreach ($add_posts_array as $post){              wp_insert_post( $post );     };      and then bring in the images with               foreach ( $image_url as $image_url ) {          $attach_id = wp_insert_attachment( $attachment, $file, $post_id );          $attach_data = wp_generate_attachment_metadata( $attach_id, $file );           wp_update_attachment_metadata( $attach_id, $attach_data );      };      I'm having trouble wrapping my head around how I can create a foreach loop which will take each image that was inserted and attach it to each post created. Anybody think they have a solution? I hope that I'm being clear, I'd be happy to clarify.


title: Using Schema with `the_excerpt`

text: I'm currently developing a WordPress site and want to use Schema, I have been some what successful so far but have now hit a stone wall. I want to use: `itemprop="description"` to the `<p>`the_exerpt`</p>`. Since I was able to the itemprop easily to `the_post_thumbnail` using: `<?php the_post_thumbnail('post-thumbnail',array('itemprop'=>'image')); ?>` I assumed this would be a easy task, but turns out its slightly more complex for the exerpt tag. I have tried the following with no success:   1. `<?php the_excerpt('excerpt',array('itemprop'=>'description')); ?>`   2. `<?php the_excerpt('the_excerpt',array('itemprop'=>'description')); ?>` Currently my excerpt in `functions.php` looks like:               function new_excerpt_more($more) {         global $post;         return '...ID) . '" itemprop="url">Continue Reading';     }     add_filter('excerpt_more', 'new_excerpt_more');


title: Add custom objects/entities to Wordpress

text: (I have some experience creating Wordpress themes but no experience in extending Wordpress functionality. I'm sure this must be a very common question, but I don't know how to search for the answer. All I could find is how to create custom menu items.) How can I create custom object types / entities in the database, like   * Team members, i.e. an entry for each team member of the company   * Reference projects, i.e. an entry for each project the company has done In the admin panel, it looks like this: ![enter image description here](http://i.stack.imgur.com/glvqv.png) For each object type, I want to define what properties they have (title, name, description, notes, image 1, image 2). **How can I do that? For what keywords should I search?**


title: Possible Menu Hack?

text: This is the craziest WP issues I've ever had...so my homepage main navigation reads like so...."home" "official artwork" "my artwork" "about" "links" "contact" but when I click on any other page my "official artwork" turns into "custom artwork". So thats wierd right...what's crazier is this page was deleted on my backend completely, it does not exist. I've deactivated all plugins, reinstalled theme files and wp files but still the issue....any help here would be amazing. http://www.arrangedrecords.com using the latest version of WP.


title: Order posts with custom taxonomy array

text:
I am trying to make my loop go through the posts that are associated with these terms. Currently nothing is being output.               <?php              $args = array(             'post_type' => 'staff',             'posts_per_page' => '-1',             'tax_query' => array(                     array(                         'taxonomy' => 'staff',                         'field' => 'slug',                         'terms' => array(                                         'editor-in-chief',                                         'managing-editor',                                         'fiction-editor',                                         'poetry-editor',                                         'nonfiction-editor',                                         'production-manager'                                     )                     )                 )         );         $my_query = new WP_Query( $args );                  if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();             ?>

<?php the_field('staff_title'); ?>

<?php the_field('staff_member_name'); ?>

                                 <img class="column-nest" src="<?php the_field('staff_member_photo'); ?>" alt="photo of <?php the_field('staff_member_name'); ?>" />

                        <?php the_content(); ?>             <?php endwhile; endif; ?>


title: Change Wordpress URL in sql file via Terminal

text: I've got a 40mb database file that I've exported from an old host and need to import it into a new host on a new domain. I normally open up the database in my code editor and find-replace, but as this file is so big, it's freezing my editor. Is there a way to do this via Terminal / the command line? I saw something about using `sed` when searching, but I can't get my head around how it works. Is there a simple command for doing this that exists already? I tried this but it doesn't work:               sed 's/http:\/\/www.domain.com/http:\/\/www.newdomain.com/g' mydatabase.sql      Thanks for any pointers. Osu


title: How to list categories/tags as a list in meta tags

text: I was wondering if there's any way to list all tags and categories of a posts in the header of that post. I want to list all the tags/categories via a plugin as a list in meta, similar to this:               <meta name="tags" content="website" />     <meta name="tags" content="wordpress" />     <meta name="tags" content="blogger" />     <meta name="tags" content="blog" />      Not really the above metatags, but something similar to that. Thanks for helping me.


title: Widget Disappearing in IE

text: Im debugging my site in IE, and my widget area is disappearing. http://pcdconsultancy.co.uk/ Any ideas? I have no transparency or anything on this.


title: wp_nav_menu (secondary menu) not adding current classes

text: I've looked everywhere, but i can't find a solution. My secondary menu isn't adding any current classes to the * tags when it's rendered.  I have added this menu in my functions.php file               function register_menus() {         register_nav_menus(             array(                 'second-menu' => __( 'Second Menu' )             )         );     }      Then I created a menu in wordpress with the links I want to show in my Second Menu. After that I've added the menu with the function wp_nav_menu in the .php file where I want the menu to show:               <?php wp_nav_menu( array( 'theme_location' => 'second-menu' ) ); ?>      So far everything works. The menu is showing with the links I want it to show. All the links are working. My problem is, that the 'current' classes which WP normally adds to the menus aren't added to this menu. I've expected the classes current-menu-item or current-page-item to the * tag, but these aren't there. The only classes which WP adds to the  * tag are:   * menu-item    * menu-item-type-post_type   * menu-item-object-page   * menu-item-[number] Thanks for the help, Angelo


title: get_terms vs. get_categories: does it matter?

text: I'm fairly new to wordpress and am coming across new things each day - one was today when I happened across `get_terms` and noticed that it was basically the same as `get_category`. Any particular reason to use one or the other? Is there something that I'm missing?


title: Not sure why my custom post meta field isn't saving

text: I'm having trouble getting my custom post meta field to save and I'm not quite sure why. I was following the tutorial located at http://blog.teamtreehouse.com/create-your-first-wordpress-custom-post-type and had some pretty big difficulty de-coding the special character explosion that happened all over that post... Any help is much appreciated.               add_action("admin_init", "admin_init");          function admin_init(){       add_meta_box("job_location", "Job Location", "location_callback", "job_or_internship", "side", "default");       add_meta_box("start_date", "Start Date", "start_callback", "job_or_internship", "side", "default");     }          function location_callback(){       global $post;       $custom = get_post_custom($post_ID);       $location_callback = $custom["location_callback"];       ?>       Job Location:       <input name="year_completed" value="<?php echo $location_callback; ?>">       <?php     }          function start_callback() {       global $post;       $custom = get_post_custom($post_ID);       $start_callback = $custom["start_callback"][0];       ?>       Start Date:       <input name="start_callback" value="<?php echo $start_callback; ?>">       <?php     }          add_action('save_post', 'save_details');     function save_details(){       global $post;            update_post_meta($post_ID, "location_callback", $_POST["location_callback"]);       update_post_meta($post_ID, "start_callback", $_POST["start_callback"]);     }


title: Redirect user if the referrer is not PayPal related

text: I have created a page: `http://mypage.com/paypal` with a custom template that contains the code to grab the ipn response from paypal etc. Now, I need to redirect users accidentally or on a purpose access `http://mypage.com/paypal` I want to allow that to only when a user is redirected from paypal url. e.g. if it contains `http://paypal.com`or `https://paypal.com` then it's ok, but all other access redirect to WP homepage. How to do that?


title: Custom field data is not saving

text:
I only have this code, which is in `functions.php`. I can see the field in admin page, but the data is not saving.               add_action('add_meta_boxes', 'home_page_template_meta_box');     function home_page_template_meta_box(){         add_meta_box(             'home_page_template_options',             __('Home Page Template Options'),             'home_page_template_options',             'page'         );     }          function home_page_template_options(){         //My custom fields              $right_side_box_1 = esc_html( get_post_meta( $post->ID, 'Right Side Box 1', true ) );         ?>

                 Right Side Box 1	                 <input type="text" size="80" name="right_side_box_1" value="<?php echo $right_side_box_1; ?>"/>

         <?php     }


title: What are the best practices for maintaining and deploying several parent themes?

text: I've been trying to commission a freelancer to make me a custom website and hit a roadblock when I said I wanted a parent theme. The freelancer strongly preferred to make a child theme based on his self-made, free go-to theme that he updated frequently. Justin Tadlock did a great writeup on Frameworks? Parent, child, and grandchild themes?, and succinctly explains the problem with selling child themes: > When a theme developer creates a child theme, things become problematic > because that child theme might eventually need an update. If you’re a theme > developer and are building a child theme with a 20kb functions file and five > or six custom templates, I can assure you that you’re doing it wrong. I’ve > even had to tell myself this. I'm convinced that this wouldn't be a problem if the developer had some experience with common practices for maintenance of multiple themes and WordPress theme deployment. Literally hundreds of WordPress theme shops seem to have no problem maintaining large volumes of parent themes. What's their special sauce?


title: Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)

text:
I found a plugin called Multiple Post Thumbnails and followed the directions in getting it set up. Everything shows up correctly in the admin dashboard (i.e. shows two sections to upload two separate thumbnails) but after I set the two thumbnails for each post and view the page which displays those posts, only the first post I set the thumbnails for show up. This is the code I used in my theme's functions.php:               $thumb = new MultiPostThumbnails(         array(         'label' => 'Larger Image',         'id' => 'image2',         'post_type' => 'projects'         )     );      And here is my Projects page which is the page where the posts are displayed:

                 <?php                     $c=0;                     $i=1;                          $temp = $wp_query;                     $wp_query = null;                     $wp_query = new WP_Query();                     $wp_query->query('post_type=projects' . '&paged=' . $paged . '&posts_per_page=6');                          while ( $wp_query->have_posts() ) : $wp_query->the_post(); $c++;                 ?>                      <article class="post<?php if($i%3 == 0) { echo ' right'; }; $i++; ?>" id="post-<?php the_ID(); ?>">
                         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">                             <?php                                 if (class_exists('MultiPostThumbnails')                                 && MultiPostThumbnails::has_post_thumbnail('projects', 'secondary-image')) :                                 MultiPostThumbnails::the_post_thumbnail('projects', 'secondary-image');                                 endif;                             ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                         <time class="post-date" datetime="<?php the_time('c'); ?>"><?php the_time('F j, Y'); ?></time>

                      <?php                     endwhile;                      wp_pagenavi();                     $wp_query = null;                     $wp_query = $temp;                     wp_reset_query();                 ?>                      <?php if( $c < 6 ) : for ($dummy= $c; $dummy < 6; $dummy++) : ?>                          <article class="post<?php if($i%3 == 0) { echo ' right'; }; $i++; ?>" id="post-<?php the_ID(); ?>">                         <img src="<?php bloginfo('template_url'); ?>/images/dummy-post.gif" alt="Post coming soon!" />
                          <?php endfor;?>                      <?php endif;?>

                 <img src="<?php bloginfo('template_url') ?>/images/interactive-map.jpg" alt="Interactive Map" />

      Here is a screenshot of what the page looks like. Note only "Project 6" has the thumbnail showing (Project 6 was the first post I uploaded a second thumbnail to) when I uploaded second thumbnails for each of those posts. ![Projects Page](http://i.stack.imgur.com/vA8TB.gif) Does anybody have experience with this plugin? Also, would anyone suggest an alternative no-plugin way to achieve the same thing? Basically, I just want to be able to upload two separate thumbnails for each post in the Projects post type so one shows on the home page and another (larger) one shows on the Projects page. An ideal setup would be to have just one large image I upload which gets shown on the Projects page and it would automatically get cropped into a smaller thumbnail which I can then use for the home page. Anyhow, any advice/help would be much appreciated. Thank you for reading this long post!


title: Modify a Themes Appearance >> Header admin screen from a plugin

text: I have been attempting to build a plugin(my very first) that adds some functionality for use with the Custom Header admin screen. I would like to have my plugin add an anchor link to the Appearance >> Header admin screen, and have the link trigger a function in my main plugin file: but, I'm having a lot of trouble figuring out how to manipulate the custom header admin screen(well, any admin screen honestly). I am using the new add_theme_support('custom-header') method of adding the custom header functionality for wordpress 3.4+, for now: and, _I THINK_ I need to build a function(that adds the anchor link) and trigger it with the 'admin- head-callback' argument in my add_theme_support method. Assuming that much is correct(?), can anyone provide an example of how to add html to an existing admin screen, from a plugin, please?


title: Show featured image next to post-teasers in Genesis Framework?

text: I want my posts to have a featured-image thumbnail beside it, how do I do this?


title: WordPress relative links for regular non image links

text: Is there a way to do normal links in WordPress (not image source links) in a "relative" manner?? Im doing custom site in WP and some portions of the site, for example an image link that when clicked, leads to a specific dynamically built WordPress page, i always link them absolutely. So for example, if the **website wordpress page** i want link to is **page_id=39** and the site is `XYZ.com` then my image link would be ****etc... Problem with this is that when i take the site from a test server to the live server i have to manually go in again and redo ALL the manual links. Unlike the image relative links which look something like this `<img src="<?php bloginfo('template_directory');?>/image here"/>` where this relatively looks for physical image somewhere on the site, the WordPress pages don't exist in the traditional sense of an actual page.php etc so, how can i get around this, is there some function i can employ that will get me using relative links/path builder to actual dynamic wordpress pages so that i dont have to manually/absolutely link something? Thanks in advanced.


title: How to add a post counter to the list of custom taxonomy terms?

text:
I am using the below code to display the list (radio buttons) of terms that are currently used by existing custom post type posts:               $args = array(        'taxonomy' => 'typ',       'post_type' => 'instytucje',     );     $terms = get_terms('typ', $args);     $count = count($terms); $i=0;     if ($count > 0) {         $cape_list = '';         foreach ($terms as $term) {              $i++;             $term_list .= '<input type="radio" name="typ" value="' . $term->slug . '"> ' . $term->name . '';             if ($count != $i) $term_list .= '
'; else $term_list .= '
';         }         echo '<form name="filterby" action="" method="GET">';         echo $term_list;         echo '<button OnClick="document.filterby.submit();">Szukaj</button>';     }      The list is used as a form to filter posts by terms. My question is - how can I add a counter showing the number of posts next to each term on the list? [radio button] [term name] [number of posts with the term] This is the site I am working on:   http://www.marketingpolityczny.org/baza-wiedzy/instytucje/


title: What Can I do To Achieve this Effect: WIP -> Portfolio

text: Suppose for projects, I will have a bunch of WIP (category) posts. Then once it's done I will create a Portfolio post for it. I will want to link this Portfolio post with the WIP (similar to related posts). Then I will also want WIP posts of the project to be excluded from my main WIP listing. How can I achieve this effect? In WIP page, I want a listing like   * Project 1   * Project 2   * Project 3 Showing only all the incomplete projects. Perhaps, I can have a "discontinued" listing too, but separate. Each link will go to the page showing all (WIP) blog posts of a project. How can I achieve this? I am thinking WIP will be a category, do I put the project as a tag? I will want to associate each project with a thumbnail & description too. Since I am a developer I could code something, but I am new to WordPress so will require guidance.


title: Publication Workflow

text: I am looking into having the two following roles:   1. Editor   2. Publisher and the following different states a post can be in:   1. Draft   2. Ready for publication   3. Published The workflow I am seeking is:   1. An **editor** writes a blogpost. It is a **draft**.   2. Once it is final, the editor marks ist as **ready for publication**. From that moment on, the editor **looses the ability to edit the blogpost**.   3. The **publisher** reviews, edits and **publishes the blogpost**. Is this possible with Wordpress?   If not, is there a state of the art plugin for such a workflow?   It seems like an obvious workflow.


title: What's the best method for emptying an option created with the Settings API?

text:
I'm trying to empty an option created with the Settings API and failing. `update_option ( 'my_option', '' );` appears to do nothing, whereas `delete_option ( 'my_option' );` destroys the whole option causing other problems. I just want to empty the values and reset it. I'm really clueless how to implement this correctly. Can anyone help? 50 point bounty up for grabs!               <?php     //Create the menus     add_action( 'admin_menu', 'tccl_menu' );     function tccl_menu() {           //add_menu_page: $page_title; $menu_title, $capability, $menu_slug, $function, $icon_url, $position         add_menu_page( 'Control', 'Control', 'manage_options', 'tccl-main', 'tccl_menu_page_main', plugins_url( '/traffic-control/images/wp-icon.png' ), '2.2' );         //add_submenu_page: $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function         add_submenu_page( 'tccl-main', 'Domains', 'Domains', 'manage_options', 'tccl-domains', 'tccl_menu_page_domains' );      }          //Menu callback functions for drawing pages     function tccl_menu_page_main() {         ?>

Control
         <form action="options.php" method="post">         <?php settings_fields( 'tccl_settings_main' ); ?>         <?php do_settings_sections( 'tccl_settings_main' ); ?>         <input name="Submit" type="submit" value="Save Changes" class="button-primary" />         </form>
         <?php     }     function tccl_menu_page_domains() {         $tccl_domains = get_option( 'tccl_settings_domains' );         if ( $_POST['trigger'] ) {             $p_delete_all = $_POST['delete_all'];             $p_ids = $_POST['ids']; #Get IDs             $p_deletes = $_POST['deletes']; #Get deletes             if ( $p_delete_all ) {                 //unset( $tccl_domains );                 //delete_option( 'tccl_settings_domains' );                 foreach( $tccl_domains as $option ) {                     $option = false;                 }                 $tccl_domains = array ();                 update_option( 'tccl_settings_domains', $tccl_domains );             } elseif ( is_array( $p_ids) ){                 foreach ( $p_ids as $id ) {                     if ( $p_deletes[$id] ) {                         //unset( $tccl_domains[$id] );                     }                 }             }         }         ?>
         <?php screen_icon( 'themes' ); ?>
Control
         <form action="options.php" method="post">         <?php settings_fields( 'tccl_settings_domains' ); ?>         <?php do_settings_sections( 'tccl_settings_domains' ); ?>         <input name="Add" type="submit" value="Add Domains" class="button-primary" />         </form>         <form action="" method="post">         <input type="hidden" name="trigger" value="1">
Live Domains

                 <input type="checkbox" name="delete_all" value="1">	                 Domain Name

                 <input type="checkbox" name="delete_all" value="1">	                 Domain Name

             <?php                 print_r ( $tccl_domains );                 if ( is_array( $tccl_domains ) ) {                     foreach ( $tccl_domains as &$value ) {                         echo '
<input class="large-text" type="checkbox">	'.$value['text_area'].'
';                     }                 } else {                     echo '
No domains entered. Use the form above to add domains to this list.
';                 }             ?>

         <input name="Delete" type="submit" value="Delete Domains" class="button-secondary" />         </form>
         <?php     }          //Settings     add_action( 'admin_init', 'tccl_admin_init' );     function tccl_admin_init() {         // register_setting: $option_group, $option_name, $sanitize_callback         register_setting( 'tccl_settings_main', 'tccl_settings_main', 'tccl_settings_main_validate' );         register_setting( 'tccl_settings_domains', 'tccl_settings_domains', 'tccl_settings_domains_validate' );         // add_settings_section: $id, $title, $callbak, $page         add_settings_section( 'tccl_sections_main', 'Main Settings', 'tccl_sections_main_text', 'tccl_settings_main' );         add_settings_section( 'tccl_sections_domains', 'Add Domains', 'tccl_sections_main_text', 'tccl_settings_domains' );         // add_settings_field: $id, $title, $callback, $page, $section, $args         add_settings_field( 'tccl_fields_main_input', 'Enter text here...', 'tccl_fields_main_input', 'tccl_settings_main', 'tccl_sections_main' );         add_settings_field( 'tccl_fields_domains_input', 'Add domains to the list below. Multiple domains should be seperated by commas.', 'tccl_fields_domains_input', 'tccl_settings_domains', 'tccl_sections_domains' );     }          //Sections callback functions     function tccl_sections_main_text() {         echo '
Enter your settings for the main options in the main section...
';     }          //Field callback functions     function tccl_fields_main_input() {         //Get option 'text_string' value from the database         $options = get_option( 'tccl_settings_main' );         $text_string = $options['text_string'];         //Echo the field         echo "<input id='text_string' name='tccl_settings_main[text_string]' type='text' value='$text_string' />";     }     function tccl_fields_domains_input() {         //Get option 'text_string' value from the database         $options = get_option( 'tccl_settings_domains' );         $text_area = $options['text_area'];         //Echo the field         echo "<textarea id='text_area' name='tccl_settings_domains[text_area]'>$text_area</textarea>";     }          //Settings callback functions (validation)     function tccl_settings_main_validate( $input ) {         $valid['text_string'] = preg_replace( '/[^a-zA-Z]/', '', $input['text_string'] );              if ( $valid['text_string'] != $input['text_string'] ) {             //add_setting_error: $title, $id, $error_message, $class             add_settings_error( 'tccl_fields_main_input', 'tccl_texterror', 'Incorrect value entered!', 'error' );         }                 return $valid;     }     function tccl_settings_domains_validate( $input ) {         $options = get_option( 'tccl_settings_domains' );         $options[] = $input;         return $options;     }     ?>


title: Read more to open external link

text: I would like to have custom field in post editing area where can be putted the external link. If the link is entered to this field then read more button on homepage would open external link, but if that field is not filled then to use default read more functionality and open a post. Is there some plugin for this or some hack?


title: Creating an custom admin page for editing widgets

text: There is always danger in thinking your _almost there_... **The end Goal:** A custom page in the admin menus where i can edit a widget I constructed. **Where I am now:**   * I have registered a custom menu   * I am displaying the active widget controls on my custom page using a function entitled wp_list_widget_controls from wp-admin/includes/widgets.php   * I have enqued the admin-widgets javascript **The _almost there_ problem**   Everything looks like it works. On my custom page, When I edit some of the widget's values and hit the save button I see a console log stating: XHR finished loading: www.example.ca/wp-admin/admin-ajax.php". The new value looks like it has been saved to the widget. But When I reload the page - the old value appears. **Additional Notes**   * The widget exists on appearance > widgets > some registered side bar    * When I edit the values of the widget using the appearance > widgets > .. the widget works as expected.   * I have not included the code for the actual widget as the widget works fine when I edit the widget from the correct place. **The code**               362 add_action('admin_menu', 'widget_menu');     363      364 function widget_menu () {     365     add_menu_page( 'News Widget', 'News Widget', 'manage_options', 'news_widget_opt_menu', 'news_widget_options', '', '6' );     366 }        367 function news_widget_options () {     368      369     require get_root_path() . '/wp-admin/includes/widgets.php';     370     wp_enqueue_script('admin-widgets');     371     echo wp_list_widget_controls('home_page_widgets');     372 };        Can anyone help me make the final step (or tell me I have 1000 to go : ) or suggest an alternative approach. **Edit: The XY Problem**   (a) I know I can enqueue a stylesheet in the admin widgets page. Therefore I can hide things and make other things bigger ect. (b) In the html source code of admin/widgets.php, my widget html form code is being duplicated. Therefore the ID's that I am using are useless. I need unique ID's to activate my WMD Pagedown editors..


title: How to include checkbox in widget backend form?

text: I'm trying to include a checkbox in my widget back end. But I cannot get the value (on or off) after the user submits it. I thought the value would be stored in "esc_attr( $check )" (as it is when using a text input), but I cannot retrieve it. This is what I'm trying now:               public function form( $instance ) {         $check = isset( $instance[ 'check' ] ) ? $instance[ 'check' ] : 'off';         echo esc_attr( $check ); // If the input is type text it outputs the value         ?>         <input class="widefat" id="<?php echo $this->get_field_id( 'check' ); ?>" name="<?php echo $this->get_field_name( 'check' ); ?>" type="checkbox" />         <?php      }      How can I get this to work? Also how do I get the value of the checkbox in the front end?


title: WordPress Themes and PHP unit

text: Is there any examples of using PHP unit tests with WordPress themes, seems a lot of blogs out there on the subject are out dated as the core unit tests are apart of trac, yet last night - I pulled trac and tried to set up a sample theme to run tests on. It doesn't quiet work, you have to run all the tests to test your theme and even if you try and require a file - it tries to require it before WordPress is instantiated and it becomes a giant mess. Any ways, I know there's the plugin for theme unit testing - but that just installs a ton of posts that "try" and break your theme - doesn't test the underlying logic - especially if building a framework - php unit is best here as you can test out all the different options and implementations of your code. So is there any way to run PHPunit inside a theme?


title: WordPress & TinyMCE: Failed to load

text:
As per other posts, I am trying to produce a customised WordPress installation as a CMS for my fishkeeping website. On one of my custom post types (`species`, which displays information about a given species of fish) doesn't use the standard "Post" editor at all, instead it has numerous fields in meta boxes such as "Genus", "Species", "Diet", "Compatibility", etc. As such, using WordPress' built-in TinyMCE installation was somewhat troublesome. However, eventually I did get it "working" (see answer here). That was a couple of months back and I forgot that it was never functioning 100% correctly: the interface would bug out and display a 200px toolbar width on a 400px textarea. I think this is down to there being multiple instances of the toolbar on the page with different widths (I never forced a width in the initialisation of TinyMCE). I'm now trying to deregister the default WordPress installation of TinyMCE so that I can use the TinyMCE jQuery package as per Andrew Jackman's post in this thread. **-> the plugin file**               wp_register_script('tinymce-external', $this->plugin_url .'tiny_mce/jquery.tinymce.js', array('jquery'));     wp_enqueue_script('tinymce-external');          wp_register_script('tinymce-external-config', $this->plugin_url .'js/tinymce-config.js', array('tinymce-external'));     wp_enqueue_script('tinymce-external-config');      **-> tinymce-external-config.js**               jQuery().ready(function() {         jQuery('.editor_ui').tinymce({             // Location of TinyMCE script     // ---> THIS LINE NEEDS TO BE CHANGED IF THE PLUGIN RENAMES             script_url : '/dev/wp-content/plugins/sf-species-profiles/tiny_mce/tiny_mce.js',                  // General options             theme : "advanced",             skin : "wp_theme",             language : "en",             plugins:"tabfocus,spellchecker",             tab_focus : ':prev,:next',             theme_advanced_layout_manager : "SimpleLayout",             theme_advanced_toolbar_location : "top",             theme_advanced_toolbar_align : "left",             theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist,outdent,indent,blockquote,|,link,unlink,image,removeformat,charmap,spellcheck",             //theme_advanced_buttons2 : "",             //theme_advanced_buttons3 : ""                  // Example content CSS (should be your site CSS)             content_css : "css/content.css",         });          });      **-> the textarea**
         Genus
             <textarea name="genus" class="editor_ui"><?php if(isset($genus[0])) { echo esc_attr( $genus[0] ); } ?></textarea>             Description

      **-> the resultant errors in firebug**               "NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/langs/en.js?ver=345-20111127" -> en.js?...0111127     Failed to load: http://www.mywebsite.com/wp-admin//langs/en.js -> jquery...r=1.7.1 (line 2)          "NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/themes/advanced/editor_template.js?ver=345-20111127" -> editor...0111127     Failed to load: http://www.mywebsite.com/wp-admin//themes/advanced/editor_template.js -> jquery...r=1.7.1 (line 2)          "NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/plugins/spellchecker/editor_plugin.js?ver=345-20111127" -> editor...0111127     Failed to load: http://www.mywebsite.com/wp-admin//plugins/spellchecker/editor_plugin.js -> jquery...r=1.7.1 (line 2)          "NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/plugins/tabfocus/editor_plugin.js?ver=345-20111127" -> editor...0111127     Failed to load: http://www.mywebsite.com/wp-admin//plugins/tabfocus/editor_plugin.js -> jquery...r=1.7.1 (line 2      It looks like it's trying to find the TinyMCE plugins and languages files, but in the wrong directory, and I don't know how to change that. Is this a compatibility problem with WordPress; do I need to deregister the existing TinyMCE installation? I tried using `wp_deregister_script('tinymce')` (and tiny_mce) but nothing changed. **EDIT** I am using WordPress 3.3 and all of the above refers to the admin area of a Custom Post Type I have created. Thanks in advance,


title: Modify Notification Message When Profile Updated

text:
I have added new fields on the user profile page. I want to display a message that says: "It's good ... or not" I couldn't find a hook in the WordPress codex. I don't want to use a plugin only my own code I want change this code :

Updated profile


title: Hook the Keydown Event in the TinyMCE Post Editor

text: I would like to hook the keydown event in the TinyMCE Editor on the edit post admin page. I managed to hook the HTML content editor using the following code:               jQuery('#content').keydown(function(){         alert("keydown")     });      Here is my failed attempt at hooking the TinyMCE editor. The problem is that the editor hasn't been init yet so the variable ed is undefined.               var ed = tinyMCE.getInstanceById('tinymce');     ed.onChange.add(function(ed, l) {         alert("keydown");     });      Any help would be much appreciated!


title: Updating servers at once in web cluster

text: We have a pretty basic load balancing setup with 3 web servers behind a load balancer connected to the same db server and pointing their wp-content/uploads folder to an nfs share. We have the first server rsynching the wordpress files across the other 2 in a cron job to keep the servers in sync (all wp-admin stuff is done on the first server) I'm wondering what the best way is to upgrade the entire cluster at once with minimal downtime. If I update wordpress on the first server, will the db versioning cause the other 2 servers to stop working? Or can I just update the first server then rsync the files across without any downtime?


title: Using filter to add additional fields to comment_form()

text:
I want to add a field to the comments and have used these codes. **functions.php**               function my_fields($fields) {         $fields['url2'] = '
                               URL hittad på webben                               <input id="url2" name="url2" type="text" value="" size="30" />
';         return $fields;     }     add_filter('comment_form_default_fields','my_fields');      **comments.php**               comment_form();      **Questions**   1. It does not add an extra field in admin comment. Should it, or not?   2. It does not seem to save the extra field. I tried to var dump the comment array. Why not?


title: Sharding BLOGUPLOADDIR

text: I am trying to sharding BLOGUPLOADDIR but couldnt success atm. This is default one:               define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );      I am trying to set it:               if($wpdb->blogid<10){          $bloggroup = 'global';     }else{         $bloggroup = 'bloggroup'.floor($wpdb->blogid/2000+1); // 1999->1, 2000->2     }     define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$bloggroup}/{$wpdb->blogid}/files/" );      So every 2000 blog, bloggroup will change.. I tried `upload_dir` filter but i need to define before it. I tried sunrise.php but $wpdb->blogid is not defined in there it seems. Whats propery way of this?


title: Register new user in the frontend

text: I hava a big form and when a user fill it I need to create a new user in Wordpress from there. Its posible to create and user from the frontend and add some custom information? Thanks


title: Remove post author using child theme

text: I'm using twentytwelve but I don't want the author to show on single post pages. How would I go about doing that without deleting it from the parent theme.


title: Custom Taxonomy with tax_query

text: So I've created a custom taxonomy type with a plugin (CMS Press) and now I'm trying to get all of the posts with the taxonomy terms in that taxonomy. My get_posts looks like this:               $args = Array(          'numberposts' => 5,          'offset' => 0,         'post_status' => 'publish',         'content-type' => 'my-term'     );          get_posts($args);      I've also tried:               $args = Array(          'numberposts' => 5,          'offset' => 0,         'post_status' => 'publish',         'tax_query' => Array( Array (              'taxonomy' => 'content-type'              'field' => 'slug'              'terms' => 'my-term'          ));          get_posts($args);      This works fine when I'm not using a custom taxonomy. if I change my request to:               $args = Array(          'numberposts' => 5,          'offset' => 0,         'post_status' => 'publish',         'tax_query' => Array( Array (              'taxonomy' => 'post_tags'              'field' => 'slug'              'terms' => 'some-tag'          ));          get_posts($args);      it works. I was wondering if there's something I'm leaving out that's preventing custom taxonomies from being queried. Any help would be appreciated.


title: Error Testing create_empty_blog() via PHPUnit + Unit Tests

text: I have been reading up on TDD for a little while, and now have a multisite plugin to 'test' it out on.. At this stage I am a little unsure whether the error is within the Unit Tests, my tests, my plugin or my understanding. So a fair few points of failure there! On activation of the plugin a new site should be created, which happens when executed manually, however when using `create_empty_blog` in the tests ends up returning a WordPress Database error rather than a integer or 'Name Already taken'. This is in itself not a terrible problem. However I would like this created blog to be available during the tests as I intend to write another function that will be adding posts into this generated site, so I need `create_empty_blog` to return an id. Any suggestions welcome-> https://github.com/socd-io/socd-gallery


title: Adding rewrite rules to Custom Post-type mixed with Taxonomy

text: I turn to you because I can not find any solution to my problem. I created 3 custom post types **"Actualités"** , **"Dossiers"** , **"Vidéos"** (I'm french :D) I created 1 taxonomy: **"Thématiques"** with the following terms:   * Santé   * Géopolitique   * ... **And I would like to get links like this _(see below - example with CPT: "Dossiers" and tax: "Santé")_ :**   * www.url.com/dossiers/sante/nom-de-larticle **=>** Display the post _(single)_   * www.url.com/dossiers/sante/ **=>** Display posts of post type "Dossiers" with tax "Santé" _(archive)_   * www.url.com/dossiers/ **=>** Display all posts of post type "Dossiers" _(archive)_   * www.url.com/sante/ **=>** Display all posts of taxonomy "Santé" _(archive)_ And the same thing for "Videos" and "Actualités". **For now I achieve this with non rewritten urls:**   * www.url.com/?dossiers=nom-de-larticle   * www.url.com/?post_type=dossiers&thematiques=sante   * www.url.com/?post_type=dossiers   * www.url.com/?thematiques=sante How can I achieve this by manipulating my functions.php? Or adding rewrite rules? This is my code for Custom Post-Type "Dossiers" _(I done the same for "Videos" and "Actualités")_ :               function register_cpt_dossiers() {         $labels = array(             'name' => _x( 'Dossiers', 'dossiers' ),             'singular_name' => _x( 'Dossier', 'dossiers' ),             'all_items' => _x( 'Tous les dossiers', 'dossiers' ),             'add_new' => _x( 'Ajouter', 'dossiers' ),             'add_new_item' => _x( 'Ajouter un nouveau dossier', 'dossiers' ),             'edit_item' => _x( 'Modifier le dossier', 'dossiers' ),             'new_item' => _x( 'Nouveau dossier', 'dossiers' ),             'view_item' => _x( 'Afficher le dossier', 'dossiers' ),             'search_items' => _x( 'Chercher dans les dossiers', 'dossiers' ),             'not_found' => _x( 'Aucun dossier trouvé.', 'dossiers' ),             'not_found_in_trash' => _x( 'Aucun dossier trouvé dans la corbeille.', 'dossiers' ),             'parent_item_colon' => _x( 'Magazine parent :', 'dossiers' ),             'menu_name' => _x( 'Dossiers', 'dossiers' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),             'taxonomies' => array( 'thematiques'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => 'dossiers',             'query_var' => true,             'can_export' => true,             'rewrite' => array( 'slug' => 'dossiers/%thematiques%', 'hierarchical' => true ),             'capability_type' => 'post'         );         register_post_type( 'dossiers', $args );     }      And this is my code for the Taxonomy "Thématiques" :               register_taxonomy(         'thematiques',         array( 'post', 'dossiers','videos' ),         array(         'rewrite' => array( 'slug' => 'dossiers' ),         'label' => 'Thématiques',         'query_var' => true         )     );      And the function for permalinks :               function wpa_show_permalinks( $post_link, $id = 0 ){         $post = get_post($id);         if ( is_object( $post ) && $post->post_type == 'dossiers' ){             $terms = wp_get_object_terms( $post->ID, 'thematiques' );             if( $terms ){                 return str_replace( '%thematiques%' , $terms[0]->slug , $post_link );             }         }         return $post_link;     }     add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 );      Thank you guys !


title: add GD Star Rating's to buddypress comments

text: I am trying to add GD Star Rating's to wordpress comments but struggling to add them to the comment form There is an explanation here but the code snippet is corrupted -http://www.placementedge.com/blog/gd-star-rating-comment-integration-with- wordpress-3-0/ The code I need to add to the comment form is wp_gdsr_comment_integrate_standard_rating Does anyone have any ideas on how this would be added and the code to use? Many thanks for your help


title: Using Same Slug With Multiple Post Types

text: My Permalinks are the std %postname%. I have several custom post types, eg. 'docs'.               function docs_init() {     // create a new taxonomy     register_taxonomy(     'docs_tax',     'docs',     array(         'label' => __( 'Documentation_Tax' ),         'sort' => true,         'args' => array( 'orderby' => 'term_order' ),         'rewrite' => array( 'slug' => 'docs' )     )     );     }      I would like to be able to have duplicate slugs. Eg. I'd like to have a general Page with the slug 'MyPage' and then a Docs post type also with the slug 'MyPage'. The goal is to have users be able to do this: URL: mysite.com/mypage ---- general Page URL: mysite.com/docs/mypage ---- posttype Docs ...and this does not work. If the user types /docs/mypage, the browser redirects to /mypage ...even though in the post editor it shows that /docs/mypage is the URL. I thought that since 'with_front' defaults to true, WordPress would distinguish between the two slugs by assigning the 'front' (ie. the post type.) How can I get what I want... or is it simply mandatory to have unique slugs? TIA, ---JC


title: Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure

text: this is my situation: I have a Custom Post Type named **struttura** (like accommodation):               function custom_post_struttura() {         $labels = array(             'name'               => _x( 'Strutture', 'post type general name' ),             'singular_name'      => _x( 'Struttura', 'post type singular name' ),             'add_new'            => _x( 'Aggiungi nuova', 'book' ),             'add_new_item'       => __( 'Aggiungi nuova Struttura' ),             'edit_item'          => __( 'Modifica Struttura' ),             'new_item'           => __( 'Nuova Struttura' ),             'all_items'          => __( 'Tutte le Strutture' ),             'view_item'          => __( 'Vedi Struttura' ),             'search_items'       => __( 'Cerca Struttura' ),             'not_found'          => __( 'Nessuna Struttura trovata' ),             'not_found_in_trash' => __( 'Nessuna Struttura trovata nel cestino' ),             'parent_item_colon'  => '',             'menu_name'          => 'Strutture'         );         $args = array(             'labels'        => $labels,             'description'   => 'Inserisci una nuova struttura',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             'hierarchical'  => true,             'rewrite'       => array('slug' => 'strutture/%regione%'),             'query_var'     => true,         );         register_post_type( 'struttura', $args );     }     add_action( 'init', 'custom_post_struttura' );      and a Custom Taxonomy named **regione** :               function taxonomies_regione() {         $labels = array(             'name'              => _x( 'Regioni', 'taxonomy general name' ),             'singular_name'     => _x( 'Regione', 'taxonomy singular name' ),             'search_items'      => __( 'Cerca Regione' ),             'all_items'         => __( 'Tutte le Tipologie' ),             'parent_item'       => __( 'Parent Regione' ),             'parent_item_colon' => __( 'Parent Regione:' ),             'edit_item'         => __( 'Modifica Regione' ),             'update_item'       => __( 'Aggiorna Regione' ),             'add_new_item'      => __( 'Aggiungi nuova Regione' ),             'new_item_name'     => __( 'Nuova Regione' ),             'menu_name'         => __( 'Regione' ),         );         $args = array(             'labels' => $labels,             'hierarchical'  => true,             'public'        => true,             'query_var'     => true,             'rewrite'       =>  array(                 'slug' => 'strutture',                 'hierarchical' => true             ),         );         register_taxonomy( 'regione', 'struttura', $args );     }     add_action( 'init', 'taxonomies_regione', 0 );      Now I add into Taxonomy **regione** these hierarchical categories:   * Tuscany      * Florence        * Empoli       * Vinci where **Tuscany** is parent-category, **Florence** is sub-parent-category and **Empoli** / **Vinci** are a sub-sub-parent-category. I wanted to obtain a permalink structure like these:   1. `www.example.com/tuscany`   2. `www.example.com/tuscany/florence`   3. `www.example.com/tuscany/florence/vinci`   4. `www.example.com/tuscany/florence/vinci/postname` So I added these three function:               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');     function mmp_rewrite_rules($rules) {         $newRules  = array();         $newRules['strutture/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?struttura=$matches[4]';         $newRules['strutture/(.+)/?$']                = 'index.php?regione=$matches[1]';               return array_merge($newRules, $rules);     }          function filter_post_type_link($link, $post) {         if ($post->post_type != 'struttura')             return $link;              if ($cats = get_the_terms($post->ID, 'regione')) {             $link = str_replace('%regione%', get_taxonomy_parents(array_pop($cats)->term_id, 'regione', false, '/', true), $link);         }         return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);          function get_taxonomy_parents($id, $taxonomy, $link = false, $nicename = false, $visited = array()) {             // removed $seperator="/" after $link, otherwise there was a double slash before the post name in the link             $chain = '';            $parent = &get_term($id, $taxonomy);              if (is_wp_error($parent)) {             return $parent;         }              if ($nicename)                 $name = $parent -> slug;                 else                 $name = $parent -> name;              if ($parent -> parent && ($parent -> parent != $parent -> term_id) && !in_array($parent -> parent, $visited)) {                 $visited[] = $parent -> parent;                 $chain .= get_taxonomy_parents($parent -> parent, $taxonomy, $link, $nicename, $visited); //removed $seperator after $link             $chain .= "/"; //add a / after every category         }              if ($link) {             // nothing, can't get this working :(         } else                 $chain .= $name; //don't need the . $separator anymore         return $chain;     }      Everything works but I obtain this kind of permalink:   1. `www.example.com/strutture/tuscany`   2. `www.example.com/strutture/tuscany/florence`   3. `www.example.com/strutture/tuscany/florence/vinci`   4. `www.example.com/strutture/tuscany/florence/vinci/postname` where **strutture** is basename. I want to specify that the default post **hello-world** works. Now comes the fun part. I want to add another Custom Taxonomy named **tipologia** (type) to CPT **struttura** :               function taxonomies_tipologia() {         $labels = array(             'name'              => _x( 'Tipologie', 'taxonomy general name' ),             'singular_name'     => _x( 'Tipologia', 'taxonomy singular name' ),             'search_items'      => __( 'Cerca Tipologia' ),             'all_items'         => __( 'Tutte le Tipologie' ),             'parent_item'       => __( 'Parent Tipologia' ),             'parent_item_colon' => __( 'Parent Tipologia:' ),             'edit_item'         => __( 'Modifica Tipologia' ),              'update_item'       => __( 'Aggiorna Tipologia' ),             'add_new_item'      => __( 'Aggiungi nuova Tipologia' ),             'new_item_name'     => __( 'Nuova Tipologia' ),             'menu_name'         => __( 'Tipologia' ),         );         $args = array(             'labels' => $labels,             'hierarchical'  => true,             'public'        => true,             'query_var'     => true         );         register_taxonomy( 'tipologia', 'struttura', $args );     }     add_action( 'init', 'taxonomies_tipologia', 0 );      Tipologia has two categories:   * hotel   * villa Now I want to obtain these kind of permalink:   1. `www.example.com/tuscany`   2. `www.example.com/tuscany/florence`   3. `www.example.com/tuscany/florence/vinci`   4. `www.example.com/hotel/tuscany/florence/vinci`   5. `www.example.com/hotel`   6. `www.example.com/hotel/tuscany/florence/vinci/postname` So I have made some change to the functions: In the Custom Post Type struttura I modify the rewrite rules               'rewrite' => array('slug' => 'strutture/%tipologia%/%regione%'),      I have changed the `mmp_rewrite_rules` function               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');     function mmp_rewrite_rules($rules) {         $newRules  = array();         $newRules['strutture/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?struttura=$matches[4]';         $newRules['strutture/(.+)/(.+)/?$'] = 'index.php?regione=$matches[2]';         $newRules['strutture/(.+)/?$'] = 'index.php?tipologia=$matches[1]';               return array_merge($newRules, $rules);     }      I have added this function               function filter_post_type_link_due($link, $post) {         if ($post->post_type != 'struttura')             return $link;              if ($cats = get_the_terms($post->ID, 'tipologia')) {             $link = str_replace('%tipologia%', get_taxonomy_parents(array_pop($cats)->term_id, 'tipologia', false, '/', true), $link);         }         return $link;     }     add_filter('post_type_link', 'filter_post_type_link_due', 10, 2);      With this configuration I obtain this kind of permalink structure:   1. `www.example.com/regione/tuscany`   2. `www.example.com/regione/tuscany/florence`   3. `www.example.com/regione/tuscany/florence/vinci`   4. `www.example.com/strutture/hotel/tuscany/florence/vinci` error 404   5. `www.example.com/hotel/tuscany/florence/vinci` error 404   6. `www.example.com/tipologia/hotel`   7. `www.example.com/strutture/hotel/tuscany/florence/vinci/postname` where regione is the name of Custom Taxonomy, tipologia is the name of Custom Taxonomy and strutture is a basename. The default post name hello-world works. If I change something into rewrite rule like slugs I obtain 404. My questions are: is it possible to obtain this kind of permalink structure?   1. `www.example.com/tuscany`   2. `www.example.com/tuscany/florence`   3. `www.example.com/tuscany/florence/vinci`   4. `www.example.com/hotel/tuscany/florence/vinci`   5. `www.example.com/hotel`   6. `www.example.com/hotel/tuscany/florence/vinci/postname` How can I remove the basename from CPT, CT and permalinks? Is this the right way to obtain this structure? I saw this permalink strategy here:   1. `http://www.agriturismo.net/tuscany/`   2. `http://www.agriturismo.net/tuscany/florence/`   3. `http://www.agriturismo.net/tuscany/florence/vinci/`   4. `http://www.agriturismo.net/villa/tuscany/florence/vinci/`   5. `http://www.agriturismo.net/villa` Thank you in advance. PS: I go into permalink page to flush rewrite every time. I'm trying this strategy from five weeks.


title: How To Structure A Wordpress Database Query?

text: I have an array containing the IDs of the rows I want to update:               $matches = array('abc123', 'def456', 'ghi789');      Rows with those IDs must be updated so that their 'confirmed' value is changed from 0 to 1. Something like this:               UPDATE table SET confirmed = 1 WHERE id = any of the values in $matches      How can I achieve this with the `$wpdb` functions?


title: Removing old code from header

text: In our site, we've got some old code sitting in the header. I'm guessing it originated from a plugin we used to use (embedding Scribd content into the site), but we are no longer using it.               <script type="text/javascript" src="http://www.scribd.com/javascripts/view.js"></script>      The problem is I can't figure out how to get rid of this script. It's not in header.php - so where would I go to edit this out?


title: How to filter backend post list showing only posts having a shortcode

text: I need to filter the Posts and Pages tables in the Admin panel by certain shortcodes. In my plugin, I have added a column for shortcodes to the Posts and Pages views that works like the "Categories" and "Tags" columns, displaying a listing of shortcodes that are used in each post. Now I want to be able to click on one of the shortcodes in the column and have it filter the list of posts or pages to just the ones that use that shortcode. In my custom column, I am outputting this: `<a href="?shortcode=my- shortcode-1">[my-shortcode-1]</a>, <a href="?shortcode=my-shortcode-2">[my- shortcode-2]</a>, ...` I just need a filter that will make `?shortcode=...` work. Here's basically what I have in mind, but I need to know what hook I could use to accomplish this:               add_filter( 'manage_posts_row', 'filter_by_shortcode' ); // I made up this filter          function filter_by_shortcode(){              global $post; // Get the current post              if(!empty($_GET['shortcode']){ // Check for ?shortcode=...                  // Check if given shortcode is used in the post             if( has_shortcode( $post->post_content, $_GET['shortcode'] )                 return $post; // Return post if shortcode is found                  // Return nothing if shortcode is not used              }else{             return $post; // Return post if ?shortcode=... argument is not used         }          }      Is there a hook that fires for each row of the show all Posts/Pages table in the Admin panel? Or is there another filter I can tie into for this?


title: How to show post attachment image

text: i am going to create a slidershow by post attachment in single.php. i use this code but the result is null.               <?php             if ( have_posts() )             while ( have_posts() ):             the_post();                  $args = array(                 'post_type'   => 'attachment',                 'numberposts' => -1,                 'post_parent' => $post->ID                 );                  $attachments = get_posts( $args );                  if ( $attachments )             {                 foreach ( $attachments as $attachment )                 {                      echo wp_get_attachment_image( $attachment->ID, false );                      }             }                  endwhile;     ?>


title: Use Pages for Custom Post Type

text: I have a custom post type I am generating in functions.php. I would like each post to be a page, rather than a post. How can I change this? I tried changing 'capability_type' => 'post' to 'capability_type' => 'page' - but this did not work.               // LFIO: Custom post type: Case Results     add_action( 'init', 'register_cpt_result' );     function register_cpt_result() {         $labels = array(                   'name' => _x( 'Case Results', 'result' ),             'singular_name' => _x( 'Result', 'result' ),             'add_new' => _x( 'Add New', 'result' ),             'add_new_item' => _x( 'Add New Result', 'result' ),             'edit_item' => _x( 'Edit Result', 'result' ),             'new_item' => _x( 'New Result', 'result' ),             'view_item' => _x( 'View Result', 'result' ),             'search_items' => _x( 'Search Case Results', 'result' ),             'not_found' => _x( 'No case results found', 'result' ),             'not_found_in_trash' => _x( 'No case results found in Trash', 'result' ),             'parent_item_colon' => _x( 'Parent Result:', 'result' ),             'menu_name' => _x( 'Case Results', 'result' ),         );         $args = array(              'labels' => $labels,             'hierarchical' => true,             'description' => 'My firm\'s case results',             'supports' => array( 'title', 'editor', 'excerpt' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => true,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'result', $args );     }


title: Woocommerce -How to set product regular price default

text: I am using woocommerce at work for equipment requests, therefore all products I will create will need to be £0. Is it possible to set a default value of 0 for the regular price field on the add product form? Thanks Jack


title: Force plugin to fail activation

text: I'm writing a plugin that will be using custom fields added by a theme. Because of this, it would be ideal if my plugin not be able to activate should these fields not exist. How do I go about displaying an error and forcing the activation to fail?


title: Hide page link in main menu from anonymous users

text: The title pretty much explains itself, I'm looking for a way/plugin to hide the menu link to a specific page from users that aren't logged in.


title: How to add a checkbox element to attachments editor with example

text: The code below adds a custom input field to the attachments editor. How can I convert the text input to a checkbox and get/set the value of the checkbox on load and save? Note: `"input" => "checkbox"` does _not_ work :(               function image_attachment_fields_to_edit($form_fields, $post) {               $form_fields["imageLinksTo"] = array(                   "label" => __("Image Links To"),                   "input" => "text",                 "value" => get_post_meta($post->ID, "_imageLinksTo", true)               );                 return $form_fields;           }            function image_attachment_fields_to_save($post, $attachment) {               if( isset($attachment['imageLinksTo']) ){                   update_post_meta($post['ID'], '_imageLinksTo', $attachment['imageLinksTo']);               }               return $post;           }           add_filter("attachment_fields_to_edit", "image_attachment_fields_to_edit", null, 2);      add_filter("attachment_fields_to_save", "image_attachment_fields_to_save", null, 2);


title: Using More Tag in Combination with the_excerpt

text: I'm not sure if this is even possible, but I thought I would ask anyway. I'm currently using a custom plugin that connects to my forums. If people are in a certain custom usergroup, they can see the full content of a post (`the_content`). If they're not, they only see the post's first 55 words (`the_excerpt`). You can see the abbreviated code here, which I'm using on my theme's single.php page:                  <?php // IN X USER GROUP             if($customgroup==1 || // Are they in the custom group?            $userinfo->usergroup == 66) { // or the admin of the website?           echo the_content();         } else { // They aren't in the custom group             echo the_excerpt ();          }          ?>      However, `the_excerpt` only allows me to show the first 55 words of the post to the non-X group members. What I want to do is set exactly where the excerpt ends. That way, I can control what the non X-group members can see up to. I've tried using Wordpress's more tag to denote where the excerpt should end, but haven't had any success getting it to work. I've used it in combination with both the `the_content` and `the_excerpt`, but they both ignore it. I'm not sure what I'm doing wrong. If I'm approaching this all wrong, what I just want to do is show the entire post to the X group members and show the excerpt I've denoted by the more tag to the non-X group members. Anyone have any ideas? Thank you!


title: Turn Current Date in Custom Field Ouput Green or Red

text: Using a custom field of "Due" how would I change the current date to green or red depending on if it has expired or not? Could someone point me in the right direction? My meta key is simply "Due"...


title: Text cut off after the character  in TinyMCE

text: I use the latest version of wordpress (v3.9.2, Taiwan Chinese Traditional), and found it can not display this Chinese word , but other Chinese words can be displayed normally. I just use this word on a post, and all the content after it is lost (became blank, this word disappeared too), after I saved the post to draft. What should I do?


title: Can Shopp or WP ecommerce create something as extensive as these sites? Other recommended solutions?

text: The project that I'm working on will require a catalog as extensive as these sites:   * http://www.ems.com   * http://www.patagonia.com/us/home but with odd size/shaped equipment such as:   * http://www.spikevolleyball.com/ So basically I need an ecommerce package to handle these number of products and variations and also odd issues such as shipping of non-standard sized equipment. Can an ecommerce package for Wordpress handle this or I need to go to a purely ecommerce package? One of the requirements for the client is to make the online store not just about the products but about the history and development of the sport. That's one of the reason why I'm still trying to find a Wordpress solution right now, because Wordpress allows other type of content besides just purely products. I've also cross posted at the Pro Webmaster stackexchange.


title: Poor performance on multisite install

text: I have my multisite site up and running the main site is mikewills.me. The big problem I am having is performance. It can take several seconds before anything starts showing up. Obviously, this is unacceptable. I have seen some tips like adding `<?php flush(); ?>` to the header. I am using the the delivered twenty ten theme. The back-end is also running slow. I am trying to determine if it is the host I am using or if it's something that I have configured wrong. Is there any additional things I can look at that may be needed in a shared host environment?


title: Display All Post Attachments and Assign Class to the Last Image?

text: I have a function `get_images()` in which I would like to display all image attachments for the current post (or page) in a list with the last image having a `class="last"` attribute to mark it as the last image in the list. The code below is my first pass at getting the attached images to display, however, its only listing one image out of the loop so my foreach is botched...               function get_images() {       global $post;       $attachment = array_values(get_children(array(          'post_parent' => $post->ID,          'post_type' => 'attachment',          'post_mime_type' => 'image',          'order' => 'ASC',          'numberposts' => 1        )));       if ( $attachment ) {         foreach($attachment as $attachmentImage) {           echo '<img src="' . wp_get_attachment_url($attachmentImage->ID) .              '" class="post-attachment" />';         }       }     }


title: How to make a list that displays the top level subpages, and any subpages or siblings off of the current page

text: Lets say we are displaying a few family trees. We are currently on the family tree top-page,and we need our list to look like this: _Family Trees_   * The Smiths   * The Joneses   * The Does When the user clicks the Smiths, we want the list to look like this: _The Smiths_   * The Smiths      * Dave     * Steve     * Dolly   * The Joneses   * The Does And when a user clicks on Steve, we want the list to also look like this: _Dave Smith_   * The Smiths      * Dave     * Steve     * Dolly   * The Joneses   * The Does So, we need to display a list of all subpages and siblings of the current page, as well as all siblings of every step in the hierarchy. Any ideas?


title: Highlighting wp_nav_menu() Ancestor Class w/o Children in Nav Structure?

text: _( **Moderators note:** Was originally titled "wp_nav_menu Ancestor class without children in navigation structure")_ I have a `wp_nav_menu` in my header which had three pages in it. When I am on one of those pages, the `li` containing that page in the menu gets the class `.current_page_item`. These three pages have templates, and these templates contain custom queries to get all posts of a certain content type. In effect, the perceived _"children"_ of this top level page are not actually children, they're just of a content type I've associated with that top level page using a template. I'd like the top level menu items to get a `'current-ancestor'` class when the user is browsing a single page of a specific post type, again, associated with that page only in a custom query in the template file. Hope that makes sense - if not, let me know where I lost you! Very much appreciate any help. _--Edited for specifics:_ For example, I have a static page called _Workshops_ that is using a template. Its slug is _workshops_. The template has a custom get_posts function and loop within it, which pulls and displays all posts of a custom content type called _workshops_. If I click on one of these workshops' title, I'm taken to the full content of that piece of content. The permalink structure of the custom post type is set to workshops/ _postname_ , so as the user sees it, these pieces of content are children of the Workshops page, when in reality they're all of one content type but unrelated to the page. It's that gap that I need to effectively close in the menu, highlighting the 'Workshops' menu item when browsing content of type 'workshop'. Again, hope that makes sense, I think I said 'workshop' upwards of 20 times in one paragraph!


title: Issues when rewrite rules collide?

text:
Is it a problem to have a custom taxonomy and a custom post type use the same rewrite structure? I have a custom taxonomy `people` and a custom post type `people_bio`. The idea is that you get a list of posts about a person with a short biography on top of the page. I combine them in my `taxonomy-people.php` template file. The permalink is `/people/[person-slug]`. Both the custom taxonomy and the custom post type have the `rewrite` argument set to `array('slug' => 'people')`. This appears to work: `get_term_link('seth-godin', 'people')` returns `/people/seth-godin/`, and for a custom post type with slug `seth-godin`, `get_permalink()` also returns `/people/seth-godin/`. The taxonomy is defined first, and it seems to "win": on a `/people/[slug]` page, `is_tax()` is true, while `is_single()` is false. So, it works, but I don't feel comfortable with it. Is someone more experienced with the rewrite engine, and can you tell me whether this might break other things? * * * The relevant part of the plugin file, called in the `init` action:               register_taxonomy(         'people',         'post',         array(             'labels' => array(                 'name' => 'People',                 'singular_name' => 'Person',                 'search_items' => 'Search people',                 'popular_items' => 'Popular people',                 'all_items' => 'All people',                 'parent_item' => null,                 'parent_item_colon' => null,                 'edit_item' => 'Edit person',                 'update_item' => 'Update person',                 'add_new_item' => 'Add person',                 'new_item_name' => 'New person',                 'separate_items_with_commas' => 'Separate people with commas',                 'add_or_remove_items' => 'Add or remove people',                 'choose_from_most_used' => 'Choose from the most used people',             ),             'public' => true,             'show_ui' => true,             'show_tagcloud' => true,             'hierarchical' => false,             'update_count_callback' => '',             'rewrite' => array(                 'slug' => 'people',                 'with_front' => true,             ),             'query_var' => 'people',             'capabilities' => array(),             'show_in_nav_menus' => true,         )     );               register_post_type(         'people_bio',         array(             'label' => 'People Bio',             'labels' => array(                 'name' => 'Biographies',                 'singular_name' => 'Biography',                 'add_new' => 'Add new',                 'add_new_item' => 'Add new biography',                 'edit_item' => 'Edit biography',                 'new_item' => 'New biography',                 'view_item' => 'View biography',                 'search_items' => 'Search biographies',                 'not_found' => 'No biographies found',                 'not_found_in_trash' => 'No biographies found in trash',                 'parent_item_colon' => null,             ),             'description' => 'Biography pages of interesting people',             'public' => true,             'exclude_from_search' => true,             'publicly_queryable' => true,             'show_ui' => true,             'menu_position' => null,             'menu_icon' => null,             'capability_type' => 'post',             'capabilities' => array(),             'hierarchical' => false,             'supports' => array(                 'title',                 'editor',                 //'author',                 'thumbnail',                 'excerpt',                 //'trackbacks',                 'custom-fields',                 //'comments',                 //'revisions',                 //'page-attributes',             ),             'register_meta_box_cb' => null,             'taxonomies' => array(),             'permalink_epmask' => EP_PERMALINK,             //'rewrite' => false,             'rewrite' => array(                 'slug' => 'people',                 'with_front' => true,             ),             'query_var' => true,             'can_export' => true,             'show_in_nav_menus' => true,         )     );          register_taxonomy_for_object_type('people', 'people_bio');      _(I always use all parameters with`register_*()`, many with their default values, as an extra documentation, as long as the Codex is not up-to-date)_ * * * The `taxonomy-people.php` template file:               <?php     get_header();          $people_biography = get_posts(array(         'numberposts' => -1,         'post_type' => 'people_bio',         'taxonomy' => 'people',         'term' => $wp_query->get_queried_object()->slug,     ));     ?>

             <?php if ($people_biography) :                 foreach ($people_biography as $bio) : ?>
<?php echo get_the_title($bio->ID); ?>
                     <?php                     echo get_the_post_thumbnail($bio->ID);                     echo apply_filters('the_content', $bio->post_content); ?>             <?php                 endforeach;              else: ?>
<?php esc_html_e($wp_query->get_queried_object()->name); ?>
             <?php endif; ?>             <?php get_template_part( 'loop', 'archive' ); ?>

             <?php dynamic_sidebar('default-sidebar'); ?>

     <?php     get_footer();     ?>      ## Update: The generated rewrite rules The output of my Rewrite Analyzer seems to tell me the taxonomy "wins" for regular taxonomy pages (which is what I noticed), but the custom post type gets all other URLs (including second pages, feeds, ...). This is what I was afraid of, and which I will need to investigate further. ![Rewrite rules for people taxonomy and post type](http://i.stack.imgur.com/eOHGS.png)


title: Genesis multiple category custom loop 404s after first page

text: Ok so, I have a page which shows a feed of posts in the "news" category (url is: mydomain.com/category/news ), but the client wants it to also show posts in the "press-releases" category. So in the category.php page, I used the following code thinking it would loop through all posts which are either in the "news" or "press-release" category:               ob_start();         single_cat_title();         $this_cat = ob_get_contents();     ob_end_clean();                    if( $this_cat == 'News' || $this_cat == 'Press Releases' ) {              remove_action( 'genesis_loop', 'genesis_do_loop' );         add_action( 'genesis_loop', 'vacation_do_custom_loop' );          }          function vacation_do_custom_loop() {              global $wp_query;         global $paged; // current paginated page         global $query_args; // grab the current wp_query() args                   $args = array(             'category__in' => '5, 1', // i also tried 'category_name' => 'news, press-releases'             'posts_per_page' => 9,             'paged'            => $paged // respect pagination         );              genesis_custom_loop( wp_parse_args($query_args, $args) );          }      Well after clicking page 2 (of like 7), Im taken to a 404. I think the issue is that there is only 1 post in the "news" category, and there are about 40 in "press-releases". So the pagination shows pages for all 40+ posts, but because there is only a single "news" post the second page doesnt actually exist? Since the url is /category/news Wordpress is creating the pagination based on the number of "news" posts? How can I get pagination working here?


title: Let users create a new custom taxonomy entry from frontend (without creating a post)

text: I have created a custom taxonomy called "Club" (a group of people). This enables me to group posts from contributors (like tags). I use the plugin "Quick Post Widget" to let enter their posts form frontend. In Quick Post Widget's form they can choose their "Club" (or enter a new one). Here is my question: How can I let contributers just enter a new "Club" from the frontend, without actually creating a new post. This would be much the same functionality like creating a new tag from the frontend. (i.e: a single input field with a 'create' button (submit)). I have been searching the internet for a simple solution, but did not succeed. I hope you can help me...


title: Listing custom terms in custom post meta

text: I'm trying to list custom taxonomy terms (using get_terms) from within the custom post meta code (i.e., via the add_meta_boxes action). I am getting "Invalid taxonomy" return from the call to get_terms. I've read through as many posts in this forum and others around this and know that it has to do with not having registered the custom taxonomy yet. And that the init action happens after the add_meta_boxes action. I've seen fixes where the DB is queried directly, a solution that would work for me. I'm building a theme for a client of mine and do not want to go this route if I can avoid it. Is there any other way to list custom terms from within custom post meta? The reason I want to do this is to provide a client manageable list of sections to add to a custom post along with text input associated with each section. Think of a CV. The client adds a new applicant and the applicant can have any number of sections in his/her CV. They can first select (from a drop- down) the section to add, and then add the appropriate text to it. Thanks in advance.


title: add file name column to media library to sort by

text: I know that you have answered this but I am a self taught 50 something volunteer and I don't really understand where to place this. If I go to editor (theme being used Asteria lite) and put the code into function php (at the very bottom) it shows as text on the page. Is there anywhere specific that this must be posted. It is in the theme function file or should it be in the wordpress file somewhere? I really need help as I am trying to set this up for AWO as their adoption gallery


title: wp_list_page with something like showpost

text:
I'm using this code                   <?php             $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');             $subpages = ($post->post_parent) ? wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0') : wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0') ;                  if ($children) { ?>
<?php echo $children; ?>
                 <?php } else { ?>                    <?php echo $subpages; ?>          <?php } ?>      This code display child pages on a parent page, also if there are not childs it will display the child of the parent (brothers). However I need to restrict it to display only 5 pages, something like showpost=5 for post, I havent been able to do it, any help???


title: wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i'm confused

text: * I've been reading up a bit on this subject, but the more I read - the more confused I get.   * Can someone explain to me in short what's the exact difference between `wp_enqueue_scripts`, `wp_register_scripts` and `wp_print_scripts`?   * For example, I have the following code in my functions.php - and it's working, but I do not understand why I can not use `wp_print_scripts` for the stylesheets, whereas the code still works if I use `wp_enqueue_scripts` for the javascript files:              add_action('wp_print_scripts', 'add_my_js');     function add_my_js(){         if(!is_admin()){             wp_enqueue_script('default',  get_bloginfo('stylesheet_directory').'/js/default.js', array('jquery'));         }     }          add_action('wp_enqueue_scripts', 'add_my_stylesheet');     function add_my_stylesheet() {         wp_register_style('default', get_bloginfo( 'stylesheet_url'));         wp_enqueue_style( 'default');     }


title: Can't Get Parent and Child Categories of Custom Taxonomy to Display

text:
I have a Custom Post Type set up with a Custom Taxonomy. For this Custom Taxonomy, I'm trying to figure out how to echo out the titles of the parent category and current child category within it. This is the set-up: prints (registered custom post type) print_type (registered custom taxonomy)   * Prints & Note Cards (parent category in print_type taxonomy)      * Floral Prints (child category)     * Scenic Prints (child category)     * Note Cards (child category)     * Selection (child category) On single-prints.php I would like to display (individually, not as a list): Parent Category / Current Child Category / Post Title None of that needs to be linked, I simply want the text in order to display the hierarchy. I've tried dozens of bits of code to display the two types of category titles without any luck. I'm new to WP and PHP and I'm very frustrated since can't seem to wrap my head around what I'm doing that's wrong. Here's the page code:               <?php get_header(); ?>
          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
         <?php             $category = get_the_category();              echo $category[0]->cat_name;         ?>

<?php echo get_category_parents(19, TRUE, ' / '); ?><?php the_title(); ?>

<?php the_excerpt(); ?>
              <div id="workgrid" class="<?php the_ID(); ?>"><?php the_content(); ?>
          <?php endwhile; endif; ?>
               <?php get_sidebar('prints'); ?>


title: Echo class depending on Parent category

text: What im trying to do is echo a class depending on witch of 3 Main "Parent" Categories the content was posted in , here is my code so far               <article class="post      <?php      if ( in_category( 'dream-it' )){ echo 'dreamit'; }      if ( in_category( 'build-it' )){ echo 'buildit'; }     if ( in_category( 'get-the-hell-out' )){ echo 'getout'; }      ?>     ">       I know im doing this wrong any help would be amazing ! thank you!


title: Successive creation of over 1000 posts causes 404?

text: I'm developing a bulk importer. It basically takes images and converts them into posts. Each image will be created with 10 different related posts therefore each image will represent/create 11 posts. If I import 100 images, the plugin would have to create 1100 posts successively. The problem is Wordpress throws a `404 error` in the console while the plugin is creating the posts. Here's the exact error:               Failed to load resource: the server responded with a status of 404 (Not Found) http://www.example.com/wp-admin/admin-ajax.php      The error log says:               WordPress database error MySQL server has gone away for query ...      The plugin does the import by uploading the images first and then create the posts after that. It's in the creation of the posts when the error is thrown. It's important to note though that the error does not occur if I import under 20 images. As this is AJAX, I don't have other error data that would help me diagnose the problem. But I'm guessing the server somehow stops at a certain point while being asked to create posts. Any thoughts? EDIT: As requested by @kaiser, here's the function the creates the post for each image:               public function create( $posted ) {         $post_ids = array();              foreach ( $posted['attachments'] as $file_id ) {             $file_data = $this->get_file( $file_id );                  $post = array(               'post_title' => $posted['titles'][$file_id] ? $posted['titles'][$file_id] : $file_data['name'],               'post_content' => '',               'post_type' => 'xxx',               'post_status' => 'publish',               'post_author' => get_current_user_id(),               'tax_input' => array(                                      'xxx_type' => array( post_type_term_id() ),                                      'xxx_cat' => array( $posted['term_id'] )                                   )             );                  // Create post             $post_id = wp_insert_post( $post );             $post_ids[] = $post_id;                  // Form post metadata             $metadata = xxx_metadata_defaults();                  // Attach event date to this post             $metadata[ 'event_date_meta_key' ] = date( 'Y-m-d H:i:s', strtotime( $posted['date'] ) );                  // Add meta that determines if this post is imported by this plugin             $metadata['xxx'] = 'yes';             // Record attachment id for later use             $metadata['xxx_id'] = $file_id;                  // Update metadata             foreach ( $metadata as $key => $value ) {               update_post_meta( $post_id, $key, $value );             }                  // Set file as the post thumbnail for the post             set_post_thumbnail( $post_id, $file_id );                  // Create related             $this->create_related( $posted['group'], $post_id, $file_data );                  do_action( 'create_related_posts_complete', $post_id, $posted['term_id'], $posted['users'] );         }              return $post_ids;     }      The line below creates another 10 posts.               // Create related     $this->create_related( $posted['group'], $post_id, $file_data );      I'm not sure how to split the query since all the files are fetched from the form and created as posts at once so maybe I have to use `sleep()` as @kaiser suggested. But how much time should I assign to sleep? Will it depend on some `php.ini` config -- `max_execution_time`?


title: Automatically Insert Custom Field on Custom Post Type Publish

text: I was searching for a way to automatically insert a custom field when publishing a custom post type. And I repeatedly found the same solution, from here: http://pippinspages.com/tutorials/publish-action-hook-for-custom-post-types/ I've tried this and for some reason it's just not working for me. I have a custom post type called sales_pages Here's my code:               // function to be executed when a custom post type is published     function run_when_post_published($post_ID)     {         // your function code here         global $wpdb;           if(!wp_is_post_revision($post_ID)) {           add_post_meta($post_ID, 'field-name', 'custom value', true);           }     }          // replace {custom_post_type_name} with the name of your post type     add_action('new_to_publish_sales_pages', 'run_when_post_published');         add_action('draft_to_publish_sales_pages', 'run_when_post_published');         add_action('pending_to_publish_sales_pages', 'run_when_post_published');      Can you please give me a hint as to what is wrong with this? I've confirmed this working with regular posts (with the post publish hooks of course). It's just not doing the same for my custom post types. Thanks in advance for any advice. Cheers, Bryan


title: how to manipulate HTML parameters using PHP conditions

text:
hi im using my own customize stylesheet using twitter bootstrap in wp-admin. i have created my own navigation bar like below.               add_action('admin_head', 'myNavbar');     function myNavbar(){         echo "

  HOME

 PLUGIN

               ";          }      how can i manipulate my markup to make `<li class="active"> Plugin </li>` when im in `wp-admin/plugin.php` im thinking, getting the current page and create some conditional statement in PHP               if(isset($_GET) == '.../plugin.php') {          // change Markup here     }      not sure if this is the correct approach


title: Programmatically disable W3 Total Cache in development environment

text: I've got two environments in my project: dev & production. I just want to be able to deactivate or disable W3TC in my dev environment but the plugin has no native support for this . I also can't find a deactivate hook that works with the plugin and setting `define('WP_CACHE', false);` based on `HTTP_HOST` seems to be bypassed in `wp-config.php`. So surely this has come up before for people - what is the solution?


title: I just had an email from wordpress. what does it mean?

text: I just had this email from WordPress:               A new pingback on the post "Contact Us" is waiting for your approval     http://clickcomputers.org.uk/contact-us/          Website : Click Computers » Post Topic » Be Creative. (IP: 217.160.66.224 , kundenserver.de)     URL : http://clickcomputers.org.uk/be-creative/     Pingback excerpt:      [...] Contact Us [...]      What does this mean? Thank you.


title: Weird problems after recovery from security breach

text: The shared server that I used for hosting my WordPress website was hacked recently, and many of the `index.php` files, plugin files and uploads were deleted, with my MySQL databases untouched. But after having restored all of it from my local backups, I'm having some weird problems.   1. My homepage http://inversekarma.in does not fully load - the sidebar and footer are missing. If I view the page source, it ends at the point where the code for my sidebar starts.   2. I am not able to login to the dashboard. It throws a 500 error. Please help me fix this issue! P.S.: I have another WordPress blog on the same domain, at `http://inversekarma.in/photos`, which is working perfectly without any of the above issues, after I restored the files from my backup.


title: Post thumbnails in sidebar & footer?

text: I have a category in my blog called "work", and I will be assigning each post a thumbnail. This category will be excluded from my blog's navigation, but added as a fake page on my page nav bar. Basically, I want to create a 3 x 3 grid listing of thumbnails which link to that piece of work, how would I go about doing this? I don't even know where to begin with this?! Thanks in advance!


title: Can the default "post tags" taxonomy be renamed?

text: I'm intending to use the default "post tags" taxonomy to provide a common set of tags across posts and 2 custom post types (to allow for collection/aggregation by tag). I'd like to rename the "post tags" taxonomy to something else - like "general tags' - to make it a bit clearer, especially when this taxonomy is attached to other custom post types. So, is there any way of doing this within Wordpress, or do I do it via SQL. Also, anyone know if there is an expectation that this taxonomy exists with the nane "post tags"


title: Featured Image Panel Missing From Custom Post Type in Wordpress 3.2

text: Upgraded to 3.2 from 3.1 and lost the featured image panel in admin that was running in a custom post type.               add_action( 'init', 'create_my_post_types' );          function create_my_post_types() {         register_post_type( 'header_image_gallery',             array(                 'labels' => array(                 'name' => __( 'Header Images' ),                 'singular_name' => __( 'Header Image' ),                 'add_new' => __( 'Add New' ),                 'add_new_item' => __( 'Add New Header Image' ),                 'edit' => __( 'Edit' ),                 'edit_item' => __( 'Edit Header Image' ),                 'new_item' => __( 'New Header Image' ),                 'view' => __( 'View Header Images' ),                 'view_item' => __( 'View Header Images' ),                 'search_items' => __( 'Search Header Images' ),                 'not_found' => __( 'No Header Images found' ),                 'not_found_in_trash' => __( 'No Header Images found in Trash' ),                 'parent' => __( 'Parent Header Images' ),                 ),                 'public' => true,                 'supports' => array('title','thumbnail','revisions')             )         );     }      Post thumbnails are registered like so:               // This theme uses post thumbnails         add_theme_support( 'post-thumbnails', array('post', 'page') );      Note: The custom posts that were created prior to upgrade work properly on the frontend showing their post thumbnails (just the featured image admin panel is missing). Also: I've gone to the codex and pulled the example custom post type, you'll notice it should show a featured image > but also does not.               add_action('init', 'codex_custom_init');     function codex_custom_init()      {       $labels = array(         'name' => _x('Books', 'post type general name'),         'singular_name' => _x('Book', 'post type singular name'),         'add_new' => _x('Add New', 'book'),         'add_new_item' => __('Add New Book'),         'edit_item' => __('Edit Book'),         'new_item' => __('New Book'),         'all_items' => __('All Books'),         'view_item' => __('View Book'),         'search_items' => __('Search Books'),         'not_found' =>  __('No books found'),         'not_found_in_trash' => __('No books found in Trash'),          'parent_item_colon' => '',         'menu_name' => 'Books'            );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'has_archive' => true,          'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','editor','author','thumbnail','excerpt','comments')       );        register_post_type('book',$args);     }      If I examine the screen options no featured image option is visible in either example. _*_ Answered my own question Perhaps in WP 3.1 you did not have to declare your custom post type when adding theme support but in WP 3.2 you do!               // This theme uses post thumbnails         add_theme_support( 'post-thumbnails', array('post', 'page','header_image_gallery') );


title: Showing author box on post detail page

text: Being new to word-press as well php i am struck at a point. I am trying to display author information along with his picture in the post and have successfully able to fetch all the data from gravatar.com and able to display it on the right hand side bar successfully. Currently this box is coming through out the website, but my requirement is that it should only be displayed when reader is on the post detail page. As per my little knowledge of word-press, i kw that each post will going to relate to some category. How can i able to show the author box to only post detail page and hide it from all other places.Any help in this regard will be much helpful just to edit i have added following code               <?php  $category_ids = remove_element(get_all_category_ids(),'274');          if (in_category($category_ids)) { ?>      this code is not working but if i pass a single category id to `in_category()` function like                <?php                if (in_category('8')) { ?>      if block is working fine.i am clueless what is going wrong Thanks in advance


title: How to redirect after login, the working way?

text: I've tried everything: Peter's Login Redirect, Redirection, some unworking javascript hacks, routemap PHP Class (which is really impressive, but I'm not sure that's very useful in this case). I'm using Theme My Login, but its redirection settings just wouldn't respond. (Still need it, though). Any ideas?