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

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


Read more to open external link

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?


Creating an custom admin page for editing widgets

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


How to include checkbox in widget backend form?

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?


WordPress Themes and PHP unit

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?


WordPress & TinyMCE: Failed to load

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,


Modify Notification Message When Profile Updated

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


Hook the Keydown Event in the TinyMCE Post Editor

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!


Updating servers at once in web cluster

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?


Using filter to add additional fields to comment_form()

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?


Sharding BLOGUPLOADDIR

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?


Register new user in the frontend

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


Remove post author using child theme

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.


Custom Taxonomy with tax_query

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.


Error Testing create_empty_blog() via PHPUnit + Unit Tests

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


Adding rewrite rules to Custom Post-type mixed with Taxonomy

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 !


add GD Star Rating's to buddypress comments

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


Using Same Slug With Multiple Post Types

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


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

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.


How To Structure A Wordpress Database Query?

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?


Removing old code from header

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?


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

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?


How to show post attachment image

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


Use Pages for Custom Post Type

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


Woocommerce -How to set product regular price default

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


Force plugin to fail activation

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?


Hide page link in main menu from anonymous users

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.


How to add a checkbox element to attachments editor with example

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


Using More Tag in Combination with the_excerpt

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!


Turn Current Date in Custom Field Ouput Green or Red

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


Text cut off after the character  in TinyMCE

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?


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

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.


Poor performance on multisite install

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?


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

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" />';         }       }     }


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

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?


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

_( **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!


Issues when rewrite rules collide?

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)


Genesis multiple category custom loop 404s after first page

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?


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

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


Listing custom terms in custom post meta

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.


add file name column to media library to sort by

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


wp_list_page with something like showpost

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


wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i'm confused

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


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

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


Echo class depending on Parent category

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!


Successive creation of over 1000 posts causes 404?

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


Automatically Insert Custom Field on Custom Post Type Publish

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


how to manipulate HTML parameters using PHP conditions

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


Programmatically disable W3 Total Cache in development environment

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?


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

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.


Weird problems after recovery from security breach

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.


Post thumbnails in sidebar & footer?

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!


Can the default "post tags" taxonomy be renamed?

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"


Featured Image Panel Missing From Custom Post Type in Wordpress 3.2

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


Showing author box on post detail page

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


How to redirect after login, the working way?

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?


Inline-Table under TwentyTwelve not working

I recently wanted to add a comfortable way to automatically add users to a page within small boxes including information an an image. So I followed this tutorial an customized the code: http://www.wpbeginner.com/wp-tutorials/how- to-display-an-author-list-with-avatars-in-wordpress-contributors-page/ On the active page, which is using a horribly old and annoying framework by Pagelines, this works just fine. The elements are aligning just the way they should. (http://www.dreadfactory.de/testseite/) But when I try to add excatly the same code to a simple page with a twentyTwelve Childtheme, the layout is messed up. It has to be some problem with the TwentyTwelve css, because when I remove the TwentyTwelve css import, the boxes are fine (But of course then the rest is messed up. ;) ) You can see how the code takes effect in TwentyTwelve here: http://it.marvin- pollock.com/test Edit 1: Added page code The page template so far is very simple:               <?php     /*     Template Name: Profilseite     */     ?>     <?php get_header(); ?>

<?php contributors(); ?>

     <?php get_footer(); ?>      The code in functions.php               // --- Creates List of Users (Needs Plugin "user Photo") --- //     // --- To exclude a Profile set display_name = inactive --- //     function contributors() {         global $wpdb;              $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' AND display_name <> 'inactive' ORDER BY display_name");              foreach ($authors as $author ) {                 echo "
";                     echo "ID);                     echo "'>";                     echo userphoto($author->ID);                     echo "";                     echo '
';                         echo "ID);                         echo "'>";                             echo "
";                             the_author_meta('first_name', $author->ID);                             echo "
";                         echo "";                         echo "ID);                         echo "'>";                             echo "
(";                             the_author_meta('last_name', $author->ID); //TODO: Change to 'city'                             echo ")
";                         echo "";                         echo "
";                         echo "
";                             the_author_meta('description', $author->ID);                         echo "
";                         echo "
";                         echo "ID);                         echo "'>";                             echo "Termine und Kontakt ->";                         echo "";                                     echo "
";                 echo "
";         }     }


Is it possible to change the images source that are shown in the admin side?

All of my images are in a CDN. On the website that's where the images are coming from but on the admin side it is pulling them from the server. Is there a filter or action I can use to change the source of the images that are shown in the WYSIWYG and in the Media admin section?


permalink %year% of pre-written posts to be published next year, in the mysterious future (*)

I am pre-writing some posts that will be published next year. My permalink structure is               /%year%/%postname%/      After setting the post title, the permalink says it will be               http://www.amazeaweek.net/2011/spiral-out/      which reflects the year I'm writing it. But I'd like it to be               http://www.amazeaweek.net/2012/spiral-out/      because it will be published in 2012. I tried setting the publish date _before_ writing the title, but the permalink still says it will be 2011, even though the publish date is set to be next year. **How can I make the permalink reflect the publish year instead of the current year?** (*) I tried to make my question title include all the keywords I used trying to search for this answer. After reading the note after this answer regarding scheduling posts, I wonder if I simply have to wait until next year...


Localizing methods for jQuery append prepend wrap parent

So I am serializing some options in WordPress and then localizing them to be used in my jQuery script, however what I am trying to do next isn't working.               jQuery('.advert')+ lu_ban_object.method +('
Hello World
')      So in my db I've got some values serialized; following is the data that is being localized to used as method chosen by the user > s:6:"method";s:5:".wrap";} Essentially what it should do is;               jQuery('.advert').wrap('
Hello World
')      The user can also append, prepend, wrap, etc but it is just not working, the methods are being localized and serialized so it should work, but it isnt. I have tried the following as well;               jQuery('.advert')lu_ban_object.method('
Hello World
')     jQuery('.advert')jQuery(lu_ban_object.method)('
Hello World
')      Is just not working.... anyone know how to solve this. or am I doing it the wrong way? I just have a list in the settings page and each has a value for a different method such as;               <select name="lu_ban_data[method]" id="lu_ban_data" />             <option value=".append">Append</option>             <option value=".prepend">Prepend</option>             <option value=".wrap">Wrap</option>             <option value=".parent().parent().wrap">Parent</option>      **update: var dump**               array (size=4)       'title' => string 'My custom title' (length=15)       'msg' => string 'My message' (length=10)       'image' => string 'http://i.imgur.com/3tPjx4l.png' (length=30)       'method' => string '.prepend' (length=8)      I tried the bracket solution but still nothing, `jQuery('.advert')[lu_ban_object.method]("<div>Hello World</div>")` I am getting the following error: `Uncaught TypeError: Object [object Object] has no method '.prepend'` So I added the plus symbols and the message went away but the div was still not being added to the page `+[lu_ban_object.method]+` following is my localized data that is being printed in the header


Can I develop a social networking Site using WordPress and its Plugins?

I am completly new to WordPress. I have a requirment where I need to develop a site where people will form communities and will blog around. They will make friends and send friend request. So its much a combination of social Networking Stuff combined with Blogging Stuff. Can somebody suggest that if I should go for WordPress or look for some other option like. ELGG.


Custom taxonomy page not working

I've created a custom taxonomy 'animal-species' that I want to filter out my 'animals' custom post type. The idea is that a user can go to the main animals page and filter them out by cats, dogs etc. I've created a taxonomy-animals- animal-species.php page, but the domain.com/animals/?animal-species=cat (or dog or whatever) still lists all of the animals, not just the ones that match the taxonomy. I've tried re-naming the taxonomy page to every variation that I can think of with no success. Does anyone have any ideas on how to fix this? TLDR: domain.com/animals/?animal-species=cat and domain.com/animals/ give the same results Code for both the animal-listing.php page and taxonomy-animals-animal- species.php pages               <?php                 $page_link = get_permalink();                 $animal_species = get_terms( 'animal-species' );                      $args = array();                 $args['post_type'] = 'animal';                 if ( isset( $_GET['animal-species'] ) ) {                     $args['animal-species'] = $_GET['animal-species'];                     $page_link = add_query_arg( 'animal-species', $_GET['animal-species'], $page_link );                 }                      if ( is_array( $animal_species ) ) {                     echo '
';                     echo '
Show all animals
';                     foreach ( $animal_species as $animal_species ) {                         echo '
slug, $page_link ) ) . '">' . $animal_species->name . 's
';                     }                     echo '
';                 }             ?>
                         <?php                              $animals_per_page = 10;                                  if( function_exists( 'ot_get_option' ) )                             {                                                                $animals_per_page = intval(ot_get_option('animals_per_page'));                             }                                  $args = array(                                         'post_type' => 'animal',                                         'posts_per_page' => $animals_per_page,                                         'paged' => $paged                                     );                                  $query = new WP_Query( $args );                                  $i = 0;                                                  if ( $query->have_posts() )                              {                                      while ( $query->have_posts() ) :                                           $query->the_post();                                      $i++;                                              ?>                                                                   <div class="animal-item <?php if ($i % 2 == 0) { echo "even"; } ?>" >                                             <?php get_template_part( 'inc/display-animal' ); ?>
                                                                    <?php                                      endwhile;                             }                     ?>


English version of my site show french strings

This is a weird one : http://www.famille-labruyere.com/ is the french version of the site http://www.famille-labruyere.com/en/ is the english one The problem is that the english version show theme strings in french. I have no idea why. Infos : i use WPML and the network of websites wordpress features.


getPost() method and Pagination

i am creating a related post article feature for my wordpress enabled site.being new to php and wordpress facing some issue. though i can user wordpress build in feature to show related post of author but since site is hosting articles of authors who don't have any profile with us and there are many such authors so when a new post is being created for the author we tend to save a custom field as author_email. so based on this we want to show all post being published of a particual author.i tried using get_posts() method               <?php              $args = array( 'meta_key' => 'author_email', 'meta_value' => 'XYZ@XYZ.com');             $authorposts=get_posts($args); ?>
         <a href="<?php echo get_option('home'); ?>/">Home » <?php the_category(', ') ?>         <?php if (count( $authorposts ) > 0) {         foreach ( $authorposts as $post ): setup_postdata($post)            ?>
             /*               showing post tilte with image and some part of it             */

         <?php endforeach;  ?>

<?php previous_posts_link('‹ Previous Page') ?>

<?php next_posts_link('Next Page ›') ?>

        <?php                         } else {                             echo '
No articles by this user
';                         }                                ?>
      it showing the first 5 results and a link to the next page but when i click on the next page it show me that it has gone to second page as its also visible on the URL but its showing the same 5 results what it has shown in the first page. i am an idea that the query i have written on the same page is getting executed again from the beginning but not sure how to fix it. since i am using cutom fields to get posts i can use simple query to fetch post based on the limit or offse etc. can any one help me to fix the things or can point me hw to do it in right way thanks in advance


wpdb get_var is not returning any result (verified mysql query returns only one value)

I'm trying to modify a wordpress plugin to make it more adaptable for our needs. I have a custom user_meta called practice and we separate our users based on practice, so we need to separate quiz results also based on practice. My issue is that I cannot get my query to return the practice. Can someone look at this and tell me what I'm doing wrong?                   function save_score( $json, $user_id = null, $practice = null )         {             global $wpdb, $data;             $db_name = $wpdb->prefix . 'plugin_slickquiz_scores';                       $data    = json_decode( stripcslashes( $json ) );             $set     = array();             $now     = date( 'Y-m-d H:i:s' );             $user_id = $user_id ? $user_id : get_current_user_id();             $practiceKey = 'user_practice';            // $practice = $wpdb->get_results( "SELECT meta_value FROM $usrmeta WHERE user_id = $user_id AND meta_key = 'user_practice'" );            // $usrlevel = $usrlevel ? $usrlevel : $wpdb->get_var( "SELECT meta_value FROM $usrmeta WHERE user_id = '".$user_id."' AND meta_key = user_practice_level" );                  $userMeta = $wpdb->prefix . `usermeta`;             $sql = $wpdb->prepare( "SELECT meta_value FROM %s WHERE user_id = %d AND meta_key = %d",$userMeta,$user_id,$practiceKey );             $practice = $wpdb->get_var( $sql );                  $set['name']        = $data->name;             $set['score']       = $data->score;             $set['quiz_id']     = $data->quiz_id;             //$set['createdBy']   = $user_id;             //$set['createdDate'] = $now;             $set['usr']         = $user_id;             $set['usr_practice'] = $practice;                                 $wpdb->insert( $db_name, $set );         }          }     }      Everything inputs fine except $practice which does not put a value. Help?


How to update custom image sizes?

I've added multiple custom image sizes using the `add_image_size` function. The problem here is when I need to update the proportions of these sizes, the changed sized won't apply.   My guess is that wordpress inserts those sizes in the database and it fails to update them upon code change.   How can I update the image size?


How to add php within jquery

I want to add php code within jquery. I know that the file then cannot be saved as a js file but must be saved as a php file to execute the php code. If we save it as a php file then it can also not be enqueued within function.php.               jQuery(document).ready(function() {     jQuery('#a, #b').change(function () {         var $this = jQuery(this), // Get a handle on the checkbox we just clicked.             $a = jQuery('#a'),             $b = jQuery('#b'),             $c = jQuery('#c'),    // Get a handle on the textbox.             $d = jQuery('#d'),    // Get a handle on the textbox.             $e = jQuery('#e'),    // Get a handle on the textbox.             $f = jQuery('#f'),    // Get a handle on one of our default values.             $g = jQuery('#g');    // Get a handle on one of our default values.          if ($this.attr('id') == 'a' && $this.is(':checked')) {        // Clicking checkbox a will add the content of c and f and place it in e        // It will also uncheck checkbox b.             $e.val( <?php echo stripslashes(get_option('m')); ?> );        $b.removeAttr('checked');     } else if ($this.attr('id') == 'b' && $this.is(':checked')) {        // Clicking checkbox b will add the content of d and g and place it in e        // It will also uncheck checkbox a.             $e.val( <?php echo stripslashes(get_option('m')); ?> );        $a.removeAttr('checked');     } else {        $e.val('');     }     });     });      So how can I add php within my jquery and integrate it within my function.php theme file. Also please be noted that the php echo will return a javascript code so will it be possible that this code will be just added as a text and not echo as an executed code. Please help.


How to add jquery to my custom post type wp plugin

I want to include a jquery to my wordpress custom post type plugin which i have created. i have two doubt,,,   1. the jquery script will work only on widget options (i.e) Sidebar. So when i use the widget option the jquery script have to work. i am using the script to slide my custom post contents. so it will have to work only on sidebars?   2. How do i display meta box contents in widgets? Can any one suggest me. Thanks .


Wordpress DATABASE Update Manually?

I have a multisite WP and I'm now trying to update my WP to latest version. In the WP Administration Panel, there is a Network Update page at:   * Updates > Available Updates _(.../wp-admin/network/update-core.php)_ There i was able to do press the `[Update Now]` button. Then it updated the CODE BASE. So far ok. Then after that i need to upgrade the **DATABASE** again for network, as shown in:   * Updates > Update Network _(.../wp-admin/network/upgrade.php)_ Then it critically FAILED. It is showing:               Warning! Problem updating http://www.example.com/site1. Your server may not be able to connect to sites running on it.      Error message: Peer certificate cannot be authenticated with known CA certificates      In this post, i won't be asking for "how to solve this" particular problem. _(I'm asking "why/how" inanother post)_   Now, alternatively, my another question would be:   * HOW TO **UPGRADE THE WP DATABASE "MANUALLY"** ? _(As like we can upgrade the CODEBASE manually,shown here)_


Navigational error

Basically I have an image for a header and I changed the link behind that to go to the main website and was planning on making a news option in the menu to link to the blogs main page, after changing the link of the image I no longer had a link to the main blog page which because of that created an extra menu option called "Home" which goes to the main blog page but I cannot figure out where this is to change as its not in the menu with the rest of my navigational buttons. In short, how to change the Home page to be called "News" and have a different place in the menu? If you need to see the blog to see what I mean then it's on blog.lendfair.co.uk. http://wordpress.org/themes/constructor/


Why are images not displaying?

Server: IIS 6   WordPress version 3.1.1   Multisite using SubFolders I'm able to upload images to the server, but thumbnails and full size images do not display. If I try to edit the image, the preview displays. The file exists in blogs.dir. I'm using ISAPI Rewrite to create a httpd.conf file, which contains the block of code listed under Subfolder Example on the Create a Network page in the Codex. WordPress says the file is here: http://blogs.nvcc.edu/test/files/2011/04/facebook6.jpg. Actual location is here: http://blogs.nvcc.edu/wp- content/blogs.dir/32/files/2011/04/facebook6.jpg So many clues... I just can't put it together. Any help is greatly appreciated --Damon


Performance disadvantge of second installation instead multisite feature?

Is there any (performance-)disadvantage when I run two installations of wordpress instead of using the multisite feature? My question refers only to the difference of multisite / two installations. I'm aware of that there will be more load etc.      ### Some explanations (when necessary) I run a private blog on a vhost.   I want to run a different wordpress instance on the same host. Both sites are completely independent of each other - means different themes, plugins etc. The private blog is a single-user. The new site could have many users and will move onto a single vhost when it will be successful enough.


AJAX function needed (toggle text)

I am looking for a function that will toggle text exactly as shown by pressing the "Phone" button on this website. Any help would be much appreciated.


Show taxonomies from specific CPT

I want to show a simple list of taxonomies associated with my CPT. The taxonomies are "skills". I have the following code:
Skills
                 <?php $taxonomy = 'skill';                    $taxonomy_terms = get_terms($taxonomy);                    foreach ($taxonomy_terms as $term) {                    echo '~ '.$term->name .'
';                  } ?>      But it's spitting out ALL skills that are added to that CPT, not just the ones selected. I believe the taxonomy code is correct in the functions file because on my CPT listing in the dashboard, it shows the correctly selected skills associated with the corrosponding post. All help is greatly appreciated!


Only show content if current page is NOT one of 2 page templates

I've been using this `if` conditional statement to only show content if the current page is NOT using a certain page template;               if (! is_page_template('template-custom.php')) {         <!-- show some content  -->     }      which has been working fine. Only now I need to amend the statement to show content if the current page is NOT using one of 2 templates (So if the current page uses `template-custom.php` or `template-custom2.php` do NOT show the content). I tried this;               if (! is_page_template('template-custom.php') || is_page_template('template-custom2.php')) {         <!-- show some content  -->     }      and this;               if (! is_page_template('template-custom.php') || ! is_page_template('template-custom2.php')) {         <!-- show some content  -->     }      but to no avil. Any suggestions?