title: Import Issue (ACF Repeater+WP Ultimate Importer)

text: I'm trying to import a bunch of data from my DB and there's plenty of fields, now i'm using advanced custom fields, repeaters to be specific. I had to make my own CSV file and I did this by exporting data from my DB and creating a structure in hope that the importer would recognize it by using brackets and square brackets. Which I can show an example of here: http://pastebin.com/ZCic7rG2 To explain the pastebin, at the top you can see the names of what each piece of data would represent whenever a bracket like so `{ }` is shown at the top of the file it'd mean it's a repeater(To make it easier for myself when selecting what what is). Under that it shows the actual data in a structure. Now what happens is, it shows the data correctly(at the top) and after those it shows all the other data of the file. I tried to make my own CSV like so and it didn't work. Is there any other way I could do this or is there any CSV file maker out there that supports repeater files? Or do I get the entire idea wrong.


title: Problem with wp_enqueue_scripts in plugin

text:
I've created the following plugin which requires a js library, however attempts to load the plugin with the line `add_action( 'wp_enqueue_scripts', 'calc_script' );` in place fail with the error `unexpected T_STRING` any help appreciated.               <?php     /**      * Plugin Name: NME Savings Calculator      * Description: A widget that displays the potential savings from installing solar panels.      * Version: 0.1      * Author: NME      * Author URI: http://nme.com.au      */               add_action( 'widgets_init', 'NME_solar_widget' );                    function NME_solar_widget() {         register_widget( 'NME_solar_widget' );     }          class NME_solar_widget extends WP_Widget {              function NME_solar_widget() {             $widget_ops = array( 'classname' => 'example', 'description' => __('A widget that displays the potential savings from installing solar panels.', 'example') );                  $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' );                  $this->WP_Widget( 'example-widget', __('Solar Calculator Widget', 'example'), $widget_ops, $control_ops );              }              function widget( $args, $instance ) {             extract( $args );                  //Our variables from the widget settings.             $title = apply_filters('widget_title', $instance['title'] );             $name = $instance['name'];             $daily_kwh = $instance['daily_kwh'];             $contact_text = $instance['contact_text'];             $cost_label = $instance['cost_label'];             $provide_label = $instance['provide_label'];                  echo $before_widget;                  // Display the widget title              if ( $title )                 echo $before_title . $title . $after_title;                       //Display the name                   echo '
';                           printf( '
' . __('%1$s', 'example') . '
', $name );                      printf( '
' . __('%1$s', 'example') . ' <input type="text" id="daily-average" size="8"/>  0 kw
', $daily_kwh );                      printf( '
' . __('%1$s', 'example') . ' <input type="text" id="quarter-average" size="8"/>  0 kw
', $cost_label );                      printf( '
<input type="text" id="system-size" size="26"/> ' . __('%1$s', 'example') . '
'.'$0 per year!!'.'
', $provide_label );                       echo '
';                  if ( $contact_text )             printf( '
' . __('%1$s', 'example') . '
', $contact_text );                      echo $after_widget;         }              //Update the widget               function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  //Strip tags from title and name to remove HTML              $instance['title'] = strip_tags( $new_instance['title'] );             $instance['name'] = strip_tags( $new_instance['name'] );             $instance['daily_kwh'] = strip_tags( $new_instance['daily_kwh'] );             $instance['contact_text'] = strip_tags( $new_instance['contact_text'] );             $instance['cost_label'] = strip_tags( $new_instance['cost_label'] );             $instance['provide_label'] = strip_tags( $new_instance['provide_label'] );                  return $instance;         }          function calc_script()     {         wp_register_script( 'calc', plugins_url( '/solar/calc.js',  __FILE__ ), array( 'jquery' ) );         wp_enqueue_script( 'calc' );     }     add_action( 'wp_enqueue_scripts', 'calc_script' );              function form( $instance ) {                  //Set up some default widget settings.             $defaults = array( 'title' => __('Type text here', 'example'), 'name' => __('Type text here', 'example'), 'show_info' => true );             $instance = wp_parse_args( (array) $instance, $defaults ); ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Headline:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Introduction Text:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'daily_kwh' ); ?>"><?php _e('Daily KWH Text:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'daily_kwh' ); ?>" name="<?php echo $this->get_field_name( 'daily_kwh' ); ?>" value="<?php echo $instance['daily_kwh']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'cost_label' ); ?>"><?php _e('Cost Text:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'cost_label' ); ?>" name="<?php echo $this->get_field_name( 'cost_label' ); ?>" value="<?php echo $instance['cost_label']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'contact_text' ); ?>"><?php _e('Contact Text:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'contact_text' ); ?>" name="<?php echo $this->get_field_name( 'contact_text' ); ?>" value="<?php echo $instance['contact_text']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'provide_label' ); ?>"><?php _e('Provide Text:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'provide_label' ); ?>" name="<?php echo $this->get_field_name( 'provide_label' ); ?>" value="<?php echo $instance['provide_label']; ?>" style="width:100%;" />
                      <?php         }     }          ?>


title: List post in wp-admin and sort them

text:
this is my first public plugin called Sort posts in taxonomies. With the plugin I intend to list regular posts and custom post_types in the Category(Taxonomy) edit page in wp-admin. Further give the posibility to sort posts using numeric values or ajax. ## This could be the layout of the content: > Genre - **Taxonomy** > >> Comedy - **Category** >> >>>   1. Escape Plan - **Post** >>> >>>   2. Liar, Liar - **Post** >>> >>>   3. Last Vegas - **Post** >>> >>> >> >> Drama - **Category** >> >>>   1. Gravity - **Post** >>> >>>   2. Escape Plan - **Post** >>> >>>   3. Prisoners - **Post** >>> >>> _Notice that the movie Escape Plan is listed different in different taxonomies._ When I edit the Comedy category I want to list all the posts the category Comedy in that edit page. What I have figured out so far is that I have to use the action `{$taxonomy}_edit_form` as the hook. But I don't know how to get the Taxonomy outside the hook without hardcoding the value. **Any ideas?** This is my sort plugin (achd-sort-posts.php):               <?php     /**      * Plugin Name: Sort posts in taxonomies      * Version: 1.0      * Author: Anthony H          global $wp_query;                    // $taxonomy = get_query_var( $wp_query->query_vars['taxonomy'] );     // $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );          // $taxonomy = $wp_query->taxonomy ;     // This is the hardcoded taxonomy         $taxonomy = 'genre';               add_action( "{$taxonomy}_edit_form", 'sort_term_post');               function sort_term_post ($wp_query) {                   $screen = get_current_screen();              $args = array (             'post_type' => "{$screen->post_type}",             'tax_query' => array(                 array(                     'taxonomy'  => "{$screen->taxonomy}",                     'terms'     => "{$wp_query->term_id}"                 )             )         );              $query = new WP_Query( $args );              // The Loop         if ( $query->have_posts() ) {                 echo '
';             while ( $query->have_posts() ) {                 $query->the_post();                 echo '
' . get_the_title() . '
';             }                 echo '
';         } else {             echo "No posts found";         }         /* Restore original Post Data */         wp_reset_postdata();     }               ?>      And here is the custom post_type and taxonomy that i have made (achd- movie.php):               <?php     /**      * Plugin Name: Movie post type      * Version: 1.0      * Author: Anthony H      */                    add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'achd_movie',             array(                 'labels' => array(                     'name' => __( 'Movies' ),                     'singular_name' => __( 'Movies' )                 ),             'public' => true,             'has_archive' => true,             'taxonomies' => array( 'genre' ),             'rewrite' => array('slug' => 'movie'),             )         );          }          add_action( 'init', 'create_my_taxonomies', 0 );          function create_my_taxonomies() {         register_taxonomy(             'genre',             'achd_movie',             array(                 'labels' => array(                     'name' => 'Genres',                     'add_new_item' => 'Add new genre',                     'new_item_name' => "New genre"                 ),                 'show_ui' => true,                 'show_tagcloud' => false,                 'hierarchical' => true             )         );     }          add_filter( 'template_include', 'include_template_function', 1 );          function include_template_function( $template_path ) {         if ( get_post_type() == 'achd_movie' ) {             if ( is_single() ) {                 // checks if the file exists in the theme first,                 // otherwise serve the file from the plugin                 if ( $theme_file = locate_template( array ( 'single-achd_movie.php' ) ) ) {                     $template_path = $theme_file;                 } else {                     $template_path = plugin_dir_path( __FILE__ ) . '/single-achd_movie.php';                 }             }             elseif ( is_archive() ) {                 if ( $theme_file = locate_template( array ( 'archive-achd_movie.php' ) ) ) {                     $template_path = $theme_file;                 } else { $template_path = plugin_dir_path( __FILE__ ) . '/archive-achd_movie.php';                      }             }         }         return $template_path;             flush_rewrite_rules();     }               ?>      ## My problem I can't get the taxonomy to be sent to the action hook. Without hardcoding it. How can I retrieve it? Any ideas? ## My end goal To create a plugin that will list posts in a category edit page and have the ability to sort the posts for that category. Maybe with a small textarea and later with ajax. The sorting is category specific so if the post exists in two categories it can have different sorting in each category. The thought is to add a column perhaps called " **term_post_order** " to the " **wp_term_relationships** " table in wordpress database or use the already existing " **term_order** " but it seems that column already is used for some other functions. Is there any existing function to get data from **wp_term_relationshoips** ?


title: Query custom post type by date field only working when two posts match the query

text: Hi I am trying to query a custom post by an advanced custom field that is a date field and this is how it is registered in a plugin that I have created to take care of all non-visual aspects of the site:               fields' => array (     array (         'key' => 'field_528eb92c26db4',         'label' => __('Tip of the day date'),         'name' => 'tip_of_the_day_date',         'type' => 'date_picker',         'date_format' => 'yymmdd',         'display_format' => 'dd/mm/yy',         'first_day' => 1,     ),     ),      Now I have a WP_query in a page that is supposed to display the "tip of the day" and this is supposed to be showing the tips that have this date field as today's date. This query looks like this:               $today = date('Ymd', strtotime("now"));         $args = array(                                       'orderby' => 'post_date',                                                                    'post_type'        => 'bounty_tip',         'post_status'      => 'any',         'posts_per_page' => -1,         'meta_query' => array(             array(                 'key' => 'tip_of_the_day_date',                 'value' => $today,                 'compare' => '=',                 'type' => 'DATE'             )         )          );      Now the issue is that this works but ONLY if there are two posts that have the date. It stops working if there is only one... It is quite unusual and I am pulling my hair out trying to fix this. Does anyone have any ideas why on earth this would happen? I just can't understand how it could work to pick up two (so clearly the meta_query is fine) but not just the one. Thanks in advance I need to finish this to get sign off and this is my last resort! Cheers


title: New WP_Query loop in admin causes problems

text:
I am working on a project where I have a custom post type 'companies' and on this edit page in the Wordpress admin I have some custom made meta boxes, for saving company information, opening hours, pictures etc etc. Since yesterday I added a meta box for Leads to show the posts in the custom post type "leads" of this companies. To show these posts I use a new WP_Query. The leads posts are displayed correctly, but the meta data from my opening hours and pictures are gone now. Does anyone know what I need to change to this loop to use it in a Wordpress admin. (I also tried `wp_reset_postdata();` at the end op the loop). I register the meta boxes first off course and these are the functions in it.               // Company Leads     function stn_inner_company_leads( $post ){              $args = array(              'post_type'     => 'leads',             'meta_query'    => array(                 array(                     'key'   => 'page_id',                     'value' => $post->ID,                 )             ),         );              $leads = new WP_Query( $args );              if( $leads->have_posts() ) {             $counter = 0;             echo '
';             echo '
';             while ( $leads->have_posts() ) { $leads->the_post();                 $counter++;                      $output  = '
';                 $output .= '# ' . $counter . '	';                 $output .= '' . get_the_title() . '	';                 $output .= '' . get_the_date( 'l, F j, Y g:i a' ) . '	';                 $output .= '
';                 echo $output;             }             echo '
';             echo '
';              } else {             _e( 'This company has no leads.' );         }         wp_reset_query();          }      This is my function for opening hours:               // Opening hours             function stn_inner_opening_hours( $post ) {              global $company;              echo '
';         echo '<fieldset>';              foreach ( $company['opening_hours'] as $key => $value) {                  $value[1] = get_post_meta( $post->ID, $key . '_is_open', true );             $value[2] = get_post_meta( $post->ID, $key . '_open', true );             $value[3] = get_post_meta( $post->ID, $key . '_closed', true );                  $output = '
';                  $output .= '';             $output .= __( $value[0] ) . ':';             $output .= '';                  $output .= '
<select name="company_' . $key . '_is_open' . '">';             $output .= '<option ' . ( $value[1] == 'open' ? 'selected' : '' ) . ' value="open">' . __( 'Open' ) . '</option>';             $output .= '<option ' . ( $value[1] == 'closed' ? 'selected' : '' ) . ' value="closed">' . __( 'Closed' ) . '</option>';             $output .= '</select>
';                  $output .= '
' . __( 'From' ) . ':
';             $output .= '
<select name="company_' . $key . '_open' . '">';             for ( $n = strtotime("00:00"), $e = strtotime("23:30"); $n <= $e; $n += 1800 ) {                 $this_time = date("H:i", $n);                 $output .= '<option ' . ( $value[2] == $this_time ? 'selected' : '' ) . ' value="' . esc_attr( $this_time ) . '" >' . $this_time . '</option>';              }             $output .= '</select>
';                  $output .= '
' . __( 'Till' ) . ':
';             $output .= '
<select name="company_' . $key . '_closed' . '">';             for ( $n = strtotime("00:00"), $e = strtotime("23:30"); $n <= $e; $n += 1800 ) {                 $this_time = date("H:i",$n);                 $output .= '<option ' . ( $value[3] == $this_time ? 'selected' : '' ) . ' value="' . esc_attr( $this_time ) . '" >' . $this_time . '</option>';              }             $output .= '</select>
';                  $output .= '
';                  echo $output;              }              echo '</fieldset>';         echo '
';          }      var_dump($post); gives me the following result:               object(WP_Post)#352 (24) {       ["ID"]=>       string(5) "44625"       ["post_author"]=>       string(1) "1"       ["post_date"]=>       string(19) "2014-03-31 06:54:14"       ["post_date_gmt"]=>       string(19) "2014-03-31 06:54:14"       ["post_content"]=>       string(0) ""       ["post_title"]=>       string(12) "Test salon 2"       ["post_excerpt"]=>       string(0) ""       ["post_status"]=>       string(7) "publish"       ["comment_status"]=>       string(4) "open"       ["ping_status"]=>       string(4) "open"       ["post_password"]=>       string(0) ""       ["post_name"]=>       string(12) "test-salon-2"       ["to_ping"]=>       string(0) ""       ["pinged"]=>       string(0) ""       ["post_modified"]=>       string(19) "2014-03-31 06:56:55"       ["post_modified_gmt"]=>       string(19) "2014-03-31 06:56:55"       ["post_content_filtered"]=>       string(0) ""       ["post_parent"]=>       string(1) "0"       ["guid"]=>       string(59) "http://www.mywebsite.com/?post_type=companies&p=44625"       ["menu_order"]=>       string(1) "0"       ["post_type"]=>       string(9) "companies"       ["post_mime_type"]=>       string(0) ""       ["comment_count"]=>       string(1) "0"       ["filter"]=>       string(4) "edit"     }


title: get_posts post title permalink not working for last item in array

text:
I have a custom field attatched to a post that contains the following array of post titles...               a:6:{i:0;s:21:"Strawberry Cheesecake";i:1;s:15:"Flapjack";i:2;s:14:"Chocolate Muffin";i:3;s:27:"Apple Turnover";i:4;s:13:"Chocolate Cookie";i:5;s:13:"Shortbread";}      I am then outputing those post titles, searching for the related permalink and echoing them out using....               <?php     $speakerarray = get_post_meta($post->ID, 'cpt_food', true);     $arrlength=count($foodarray);          for($x=0;$x<$arrlength;$x++)     {     $foodname = $foodarray[$x];     $posts = get_posts(array('name' => $foodname, 'post_type' => 'food'));     $post = $posts[0];     $permalink = get_permalink($post->ID);     echo '';     echo $foodname;     echo '';     echo "
";     }     ?>      Everything works fine apart from the last result, I have duplicated the issue with numerous items in the array etc.. and its always the last one that fails. It returns the permalink for the page I am currently on instead. Can anyone see why?


title: 301 redirect from old URL structur to new

text: I recently updated the permalink structure of a website from `/%postname%/` to `/%category%/%postname%/` this is obviously causing 404 errors. Instead of writing 301 redirects for each post is there any way to do this in a more automated fashion, within WordPress? I essentially want to programmatically 301 redirect the URIs from the old permalink structure to the new one.


title: Remove Custom Post Type menu for non-administrator users.

text: I've been researching this all day and haven't come up with much results. I want to restrict who can see my Custom Post Types by User Level (or some other way). So if the person logged in is not an 'administrator' the added Custom Post Types are not visible to them. Here is part of a Custom Post Type that I have:               add_action('init', 'portfolio_register');          function portfolio_register() {              $labels = array(             'name' => _x('Case Studies', 'post type general name'),             'singular_name' => _x('Case Study Item', 'post type singular name'),             'add_new' => _x('Add New', 'portfolio item'),             'add_new_item' => __('Add New Case Study Item'),             'edit_item' => __('Edit Case Study Item'),             'new_item' => __('New Case Study Item'),             'view_item' => __('View Case Study Item'),             'search_items' => __('Search Case Studies'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             /*'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',*/             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail')           );               register_post_type( 'portfolio' , $args );     }      And here are the potential solutions that I found that don't work for the Custom Post Type menu removal:               function remove_menus()     {         global $menu;         global $current_user;         get_currentuserinfo();              if($current_user->user_login != 'admin')         {             $restricted = array(__('Posts'),                                 __('Media'),                                 __('Links'),                                 __('Pages'),                                 __('Comments'),                                 __('Appearance'),                                 __('Plugins'),                                 __('Users'),                                 __('Tools'),                                 __('Settings')             );             end ($menu);             while (prev($menu)){                 $value = explode(' ',$menu[key($menu)][0]);                 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}             }// end while              }// end if     }     add_action('admin_menu', 'remove_menus');      The above works to remove the default menu items but I couldn't get it to remove a Custom Post Type menu. Plus it is username specific, which is ok if I could add more than one user to it.               global $user_login;     get_currentuserinfo();        if (!current_user_can('update_plugins')) {           .......        }      The above didn't work at all. Thanks.


title: Quick edit screen customization

text: **Possible Duplicate:** How to show custom meta box on "Quick Edit" screen? I'm trying to edit the quick edit screen on my custom post type "visitor" so that I can add some options for my end-users. My custom post type doesn't require/need a post date, password to view, publish status, or large taxonomy boxes for custom categories of visitors on it. I've already added a custom meta box for the actual edit page, but **would like to enable quick-edit support of those post meta fields while disabling the current quick-edit options.** I also found a post (linked in my possible duplicate) over on wordpress.org's forums, but not sure exactly what it does.


title: Critical error in final stage of website launch - URLs are BROKEN!

text:
We developed the wordpress site here: wwww.kirschfamilycomputerservices.com/sam/wheresthefairness ^^ URL does not exist now. When the website was done, we transferred the database & theme over to a new host. The issue is odd and really critical. We have to present the website to the client tonight, and none of our URLs are working properly. the index to the new host is this: http://www.advertisingagency.me/wheresthefairness/ The links just under the header to the right are called in a list in the header PHP file and look like this:
     <?php     if ( is_user_logged_in() ) {         echo 'Welcome Back!';     } else {         echo 'Hello! New to WTF?!';     };     ?>      <?php wp_register( ' '  , ' ' , ' ' ); ?>/     <?php wp_loginout( home_url()  ); ?> |     <a href="<?php bloginfo('template_url'); ?>/new-case">State Your Case|      <a href="<?php bloginfo('template_url'); ?>/cases">View Cases
      The only file outside of the theme directory that I edited while designing the site was the general-template.php file, in which I changed the Site Admin link to display as "Dashboard" and made it point to root/dashboard. So the problem is this.. When you go to the website and hover over a link, it shows the correct path to the file in question, however, when trying to navigate to ANY page directly, we are always given this error: > **Not Found** > > The requested URL /sam/wheresthefairness/index.php was not found on this > server. So what do you guys think the problem could be? Could it be somewhere in the WP files themselves? Or does this sound like a database error? I've honestly never encountered something like this. I've never pointed my browser to a very specific path, and had it tell me that it couldn't load the page, because it tried to go to a different path... **1/19/11-4:36pm Edit to add:** We get this error whenever we try to direct link to a post or a page. So essentially, the only pages we can actually view on the new host is the index page, and wp-admin.


title: How do I pass the category object to a function when is_archive() is true?

text: The function below is typically used when inside a loop of categories in order to return each category's description. I'm trying to use it to return the individual category's description when viewing a category landing page (mysite/category/somecategory). How do I pass the equivalent object that represents the category? On header.php               if(is_archive()) {     //get the category description     echo get_cat_desc(get_query_var( 'category' ))     }      In functions.php               function get_cat_desc($category){       $the_description = strip_tags($category->description);       if(strlen($the_description) > 200 )      return  SUBSTR( $the_description,0,STRPOS( $the_description,".",200)+1);     else return  $the_description;     }      Here is the function where I'm successfully passing in the category object to the function above...               function my_category_index(){     $categories=get_categories('exclude=1&exclude_tree=1');     foreach($categories as $category) {echo ce4_get_cat_desc($category);}     }


title: Categories assigned to custom post type not found

text: Here's my issue: I have assigned a custom post type to certain categories. When I search for these categories, either through search or entering the url directly. However, if I assign a normal post type to a category, it becomes searchable and can be entered by the url directly. I thought I got everything in my custom post type code, but I must have missed something. Any help would be appreciated:               add_action('init', 'create_trainingplan_post_type');          function create_trainingplan_post_type() {     register_post_type('trainingplan', array(         'labels' => array(             'name' => 'Training Plans',             'singular_name' => 'Training Plan',             'add_new' => 'Add New Training Plan',         'add_new_item' => 'Add New Training Plan',         'edit' => 'Edit Training Plans',             'edit_item' => 'Edit Training Plan',             'new_item' => 'New Training Plan',             'view_item' => 'View Training Plans',             'search_items' => 'Search Training Plans',             'not_found' => 'No Training Plans found',             'not_found_in_trash' => 'No Training Plans found in Trash'         ),         'public' => true,     'exclude_from_search'=> false,     'rewrite' => array('slug' => 'my-custom-training-plan', 'with_front' => true),     'supports' => array(         'title',         'excerpt',         'editor',         'custom-fields',         'revisions',         'thumbnail',         'author',         'page-attributes'              ),         'taxonomies' => array('category', 'post_tag') // this is IMPORTANT     ));     flush_rewrite_rules();     }      Thank you for the help so far, I've added comments from the answer I received so far to make it more clear in my question: @ בניית אתרים I can actually search for the custom post type and find it. It's that the categories that are assigned only to custom post types cannot be searched or found. Basically, I am trying to enable a user to search by category, but categories that are assigned to only a custom post type are not appearing. For that matter, even if I type in the direct url of the category, it takes me to an error page: "Sorry, we can't find the category you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you..." @ בניית אתרים I assigned the categories to the custom post type like you would a normal post. While writing the post, I ticked the categories I wanted included. When in the edit posts dashboard, it does confirm that categories are assigned to the cpt. However, when I go to the category url or search for posts within that category, cpt do not show. Thanks again


title: Can I programmatically login a user without a password?

text: I'm manually creating users programmatically, and I want to sign in the newly created user. WP makes it easy to access the hashed password, but not the plaintext version. Is there a way to use wp_signon() without the plaintext password? I found one person who claims to have done this here, but it didn't work for me. THANKS!


title: How do I add a filter to wp_list_categories() to make links nofollow?

text:
How can I add a rel="nofollow" attribute to my category widget listings? I'm currently filtering the call to wp_list_categories with this code in my functions.php...               function my_wp_list_categories($cat_args){         $cat_args['title_li'] = '';         $cat_args['exclude_tree'] = 1;\         $cat_args['exclude'] = 1;         $cat_args['use_desc_for_title'] = 0;         return $cat_args;         }     add_filter('widget_categories_args', 'my_wp_list_categories', 10, 2);      Update: When I try this...               add_filter('wp_list_categories','wp_rel_nofollow');      My links come out with escape slashes...
       Chinese Tea


title: New loop vs widget

text: So, I have a sidebar that I'm going to list all posts in, I could just use a widget. But is it proper to use a new loop instead of a widget, or preferential?


title: Fatal error with a theme

text: My question is about a theme named **quality control** which was available at wordpress repository. The plugin developer is not available at this moment and I hope I get resolution for my problem here These are the errors and many others are reporting the same error on the theme's official site > Catchable fatal error: Object of class WP_Error could not be converted to > string in /public_html/wp-content/themes/quality-control/single.php on line > 55 and some times... > Catchable fatal error: Object of class WP_Error could not be converted to > string in \wp-content\themes\quality-control\inc\templates\loop.php on line > 37 Could anybody help me with this? I am ready to give admin access to my site to replicate the error **Update :** The WordPress version I am using is 3.1 and I have tried both the 'Quality control' theme versions 1.5 and 2.0 versions . http://ffav.in is the address of web-site and these are the URLs for some example posts with errors : 1) http:// ffav.in/ticket/test/ 2) http:// ffav.in/category/uncategorized/ Thanks!


title: How to view plugin ratings?

text: So I recently submitted my first plugin, and have since got a 1-star rating. Is there a place to review ratings and comments on my plugin?


title: Different menu navigation per category

text:
Hello all you helpful people :) I am using a self modified version of the 2012 theme and I would like to be able to display a different main navigation menu based on the category I am viewing. Firstly is there a plugin for such a thing as a GUI would be easier for me to get to grips with If not I'm guessing it will be PHP in the header.php file? I already have if statements for custom headers per category so I can add the additional code for switching menus in here. Any help is great :) My existing menu code is:
<?php _e( 'Menu', 'twentytwelve' ); ?>
                 <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?>                 <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>                   Main menu is called 'Talkative' Custom menu is called 'Pirtek' I cannot see in the existing code what would be changed unless I have to add additional function calls to wp_nav_menu for example               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' 'menu' => 'Talkative') ); ?>


title: Changing site_url domain breaks image links

text: I am using Responsive theme from CyberChimps. I relocated the Wordpress installation on the same server by changing the Url from settings and renaming folder from FTP. Everything is loading, Wp-Admin, CSS, JS, Pages etc. except for a few images, including the site logo. I tried lot of solutions, clearing bowser cache etc. but it didn't worked out. I debugged it and when I go to customize.php, it shows the same old Url for website logo. Can anyone tell me in customize.php line 138, from where exactly its loading `$section->maybe_render();`? I can even see the logos in media library with updated domain. But apparently customize.php has either cached or for some other reason bound to old domain name.. Any suggestions?


title: is_category() function

text: I have category which name is '51m series' (it has id 135). Why the expression is_category(51) is true on this category page? I think it should be false according to Wordpress Codex. Is it a bug? Wordpress 3.5.2 `category.php` code:               <?php get_header(); ?>          <?php     if (is_category(array(36, 63, 64, 65, 67))) {         get_template_part('category', 'papers');             }  elseif (is_category(array(5, 62, 61, 23, 17, 151))) {         get_template_part('category', 'icons');     } elseif (is_category(array(25, 50, 51, 52, 53, 54, 55, 56, 58, 71))) {         echo is_category(51);         get_template_part('category', 'gallery-machine');     } else {         get_template_part('category', 'gallery-frame');     }          ?>          <?php get_footer(); ?>      51m series live You may see 1 (`is_category(51)`) on the of the page.


title: Add content after get_header

text: I'd like to add content directly after the `div#main` (end of `header.php`) and before `/div#main` (beginning of `footer.php`). I'm using an own child-template (of twentythirteen), that contains only `style.css` and `functions.php` at the moment. I added the following content to my functions.php               function myAddedStuff() {         echo "Stuff";     }     add_action( 'get_header', 'myAddedStuff' );     add_action( 'get_footer', 'myAddedStuff' );      For the footer it works well, since `myAddedStuff()` is executed, before `get_footer`. But for `get_header` I'd like to execute `myAddedStuff()` **afterwards**. How can I do that. Should I use an alternative hook? How can I easily find hooks? Is the an easy way to add contents to certain HTML commands? (e.g. use `div#main` as a "hook").


title: Remove CSS & JS files from Wordpress Main Page For Increase Pagespeed?

text: With the reference of http://stackoverflow.com/questions/12463304/wordpress- load-plugin-css-js-in-functions-php-w-conditional-tags answered by @maiorano84 i am using **cforms** , **FancyBox** , **WP Page Numbers** plugins for **Wordpress**. From **Page Speed** point of view i want to remove CSS and JS of these plugin's from all pages except single post page. I also want to put the JS scripts in the footer. below is the code i have been trying but no luck. Would any body help me please?               if ( !is_single() ) {     add_action( 'wp_print_styles', 'my_deregisters', 100 );     add_action( 'wp_print_scripts', 'my_deregisters', 100 );              function my_deregisters() {             remove_action('wp_head', 'wp_page_numbers_stylesheet');             wp_deregister_style( 'fancybox' );              wp_deregister_script( 'fancybox' );              wp_dequeue_script('fancybox');                   wp_dequeue_style('fancybox');              remove_action('wp_print_scripts', 'mfbfw_load');             remove_action('wp_print_styles', 'mfbfw_css');             remove_action('wp_head', 'mfbfw_init');             remove_action('wp_head', 'cforms_style');                  }          } else {  }


title: Popup form in pricing table created with shortcodes and contact-form-7

text: I have a pricing table on the website which is created with short-codes and css ~ [pricing column=4 title="Starter" price="$500" per="one time fee" button_url="/#/" button_text="REQUEST A PROPOSAL"] I am having difficulty with a contact-form-7 popup using a URL to invoke it on this page. How do I add this form to the existing short-code setup using FancyBox in the above short-code configuration?


title: Total Post Count showing wrongly on admin pages list after modifying the query by using `pre_get_posts` hook

text: I have used `pre_get_posts` hook and made the changes to $query to exclude page from admin pages list by ID, but the total count of posts showing in the admin pages list, is the posts number including the excluded post also.


title: Remove meta robots tag from wp_head

text: I am in need to remove just this line `<meta name=robots content="noindex,follow"/>` from `wp_head` but can't find the right hook to use it with `remove_action()`.               <meta name=robots content="noindex,follow"/>      Basically what I want to achieve is to remove just this line from the header but just for the search page. So in this case I would use something similar to:               if ( is_search() ) { remove_action('wp_head', 'whatever-the-action-name-is'); }


title: Accessing variable from admin panel?

text: I've created my own admin page in wp-admin folder using add_theme_page() function. How to pass variables from there to my blog? I mean what's the easiest way without arrays etc. I've tried using "globals" but failed. Thanks a lot.


title: Event Calendar using insert_post_data after save_post and insert_post after post_transition draft_to_schedule

text: OK, I'm taking on the dreaded task of developing an event calendar for my site and have gotten a bit stuck. I'm open to any and all ideas but here's what I'm doing and what I'd like to do. I'm assuming that my main issue is the order of hooks and filters because i feel like I have a pretty good grasp on what I want to do. Also, I'd stick to wordpress hooks and filters rather than direct mysql database manipulation. The short is...   1. Save the first custom field and then change the current post_date to that custom field and change post_status to future, in that order, whenever a post is saved as draft or submitted for review.   2. Take the second custom field and insert a new post with that custom field as the date of the new post and change the post_status of the new post to 'future' and copy the title, content to that new post from the original post. (goal is to create an identical new post for each date submitted on the original post, make the new posts childs of the original post, and schedule them all as future posts) Now on to the long version. First, i have a custom post_type called 'events'. Registered for that I have some custom fields which for simplicity we'll call _start_date_one, _end_date_one, _start_date_two, _end_date_two. What I'd like to do is allow an 'events' post to be created and allow input of these fields, a title, and content. So far so good. Then when someone clicks "Save Draft" or "Submit for Review" I'd like to change the current post_date to _start_date_one and change the post_status to 'future'. Right now I can get this to occur only after the at least the second time I save most likely because I'm using add_action('save_post') to save custom fields and then add_filter('wp_insert_post_data') to update current post data I realize through some trac searching that insert_post_data happens prior to saving to allow me to update the $data and $postarr with new info and then saves the custom fields which is why the above happens. Number 2 listed above I've tried quite a few ways to get wp_insert_post to work but have only gotten to inserting a pending post with none of the dates correct and everything else copied. Any help is greatly appreciated.


title: where does my function output from load-* go?

text: I've got a function hooked into load-edit.php that prints out print content:               add_action('load-edit.php', array($this, 'generate_bulk_print_content'));          public function generate_bulk_print_content() {         //check for bulk action & print     }         I prepared the bulk action trigger with the following (common) hack:               add_action( 'admin_footer-edit.php', array(&$this, 'add_to_bulk_actions'));          public function add_to_bulk_actions() {         global $post_type;              if ( 'shop_order' == $post_type ) {             ?>             <script type="text/javascript">             jQuery(document).ready(function() {                 jQuery('<option>').val('custact').text('<?php _e( 'Custom action', 'woocommerce' )?>').appendTo("select[name='action']");                 jQuery('<option>').val('custact').text('<?php _e( 'Custom action', 'woocommerce' )?>').appendTo("select[name='action2']");                  });             </script>             <?php         }     }             all of this works like one would expect, except for the fact that I can _only_ see my print content when I do die() or exit() after the content. However, I would like this print content to be displayed in a thickbox on the admin page rather than on a new (otherwise empty) page. When I try to access the action variables in a different location, it cannot access the action variables anymore. What's happening in between my click on the action button and the next moment when I'm on the edit page again? Where does my print content go? Are there other ways to use the existing buttons and perhaps get my stuff into admin-ajax rather than the edit page (which is a full reload I think)? * * * edit: got a bit further, I realised I probably shouldn't use the default action of reloading the page when the button is clicked, and now I'm using the following JS:               $("#doaction, #doaction2").click(function (event) {         var actionselected = $(this).attr("id").substr(2);         if ($('select[name="' + actionselected + '"]').val() == "bulkprint") {             event.preventDefault();             var checked = [];             $('tbody th.check-column input[type="checkbox"]:checked').each(                 function() {                     checked.push($(this).val());                 }             );                  data = {                 action: 'bulkprint',                 orders: checked             };                  $.post(ajaxurl, data, function (response) {                 //how to output this to the standard thickbox?             });         }     });      Now the last piece of the puzzle is to get my ajax response into a thickbox. tb_show is not going to work because that requires a regular link, whereas I would like to pass post data to the admin-ajax (instead of using arguments).


title: External Rewrite Rules

text: I'm trying to add a rewrite rule to Wordpress. I want to rewrite: "http://www.domain.com/plm_check/var_a/var_b/var_c/" to actually use a file from "http://www.domain.com/wp- content/plugins/plm/webservices/plm_check.php?var_a=...&var_b=...&var_c=..." I've registered it like this:               /* Register rewrites for web service calls */     add_action( 'generate_rewrite_rules' , 'register_plm_rewrites');     function register_plm_rewrites() { //         global $wp_rewrite;               $wp_rewrite->add_external_rule( '^plm_check/([a-zA-z0-9_]+)/([a-zA-z0-9-]+)/([0-9]+)/?$' , PLM_PLUGIN_URL . 'webservices/plm_check.php' );              // Flush the rules         $wp_rewrite->flush_rules();      }      Instead of add_external_rule, I've tried add_rewrite_rule like this:               $wp_rewrite->add_rewrite_rule( '^plm_check/([a-zA-z0-9_]+)/([a-zA-z0-9-]+)/([0-9]+)/?$' , PLM_PLUGIN_URL . 'webservices/plm_check.php' , 'top' );      I've also tried it with and without $wp_rewrite. I think the problem is that Wordpress won't allow me to directly access that file as a URL. For instance, if I just put in "http://www.domain.com/wp- content/plugins/plm/webservices/plm_check.php", it takes me to the 404 page, even though the file actually exists. Am I using these functions wrong? Hooking to the wrong action? Trying to do something that WP isn't going to allow? Thanks!


title: Performance Gains of Relational DB Setup

text: Our team is working on the 3rd of large WP sites for a client, and contrary to most "typical" WordPress setups, our projects are generally experience lots of requests, data pulls, and general content - if you saw (and could see) our site, you would be hard [word]pressed to know it was even a WP site. I've been examining performance, particularly on the database level, and we've implemented some basic caching for larger data sets. My question is - would we gain much in performance by taking some steps to improve the database in terms of structure? Such steps would include:   * converting tables to InnoDB (our default is MyISAM)   * setting up proper foreign-key relationships, such as wp_postmeta.post_id => wp_posts.ID Those are the only ones I've come up with so far, but there may be others. I've done work with various SQL engines, but I'm by no means a master of optimization on the database level.


title: How to filter out an iframe from feed

text: Maybe i'm wrong but it seems that this question has not been previously solved yet: There is some iframe inside post content and I want to get rid of that iframe when the rss feeds are generated. To generate rss feeds, I'm showing full post content. I started looking at `strip_tags()` but it does pretty much the opposite: strip everything unless the desired tags. I'm wondering that maybe there is some hook and some wordpress-y form of solving this issue. I know I should do something like this:               function rss_noiframe($content) {         global $post;         // filter out iframe here         return $content;         }          add_filter('the_excerpt_rss', 'rss_noiframe');     add_filter('the_content_feed', 'rss_noiframe');      But I'm lost at this point. Any ideas? On demand by EAmann, here is some example code that isnt modified at all (it still appears in the feed, in fact):               <iframe src="http://somedomain.net/path/to/frame" frameborder="0" scrolling="no" width="500" height="375"></iframe>


title: Different profile page by role

text: I'm trying to set it so that when you view somebody's profile page you see a different template based on their role. So, everybody gets a regular "profile" page but if your also a author you also get a special "editor" page as well. Normally in Wordpress you get... www.mysite.com/author/person1 but what I want is... www.mysite.com/profile/person1   www.mysite.com/profile/person2   www.mysite.com/editor/person2 Below is what I've got so far in my functions.php file but the line that sets variable $curauth doesn't seem to work here. But it does work in my loop.php file???               function change_author_permalinks() {         global $wp_rewrite;              $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));         var_dump($curauth);         if ( !get_user_role( 'subscriber', $curauth->ID ) ) {             $wp_rewrite->author_base = 'editor';         } else {             $wp_rewrite->author_base = 'profile';         }              $wp_rewrite->flush_rules();     }     add_action('init','change_author_permalinks');


title: Next Ajax call doesn't work

text:
I'm submitting a form via Ajax:                   <form id="ajax-form-next" method="post" action="">             <input type="hidden" name="nextPosts" id="nextPosts" value="<?php echo $postIDs; ?>"/>             <input type="hidden" name="actualPosts" id="actualPosts" value="<?php echo $actualPostIDs; ?>"/>             <input type="submit" name="next" value="=>"/>         </form>      In `functions.php`:               function theme_name_scripts() {              wp_enqueue_script( 'mi-script-ajax',get_bloginfo('stylesheet_directory') . '/js/ajax-search.js', array( 'jquery' ) );              wp_localize_script( 'mi-script-ajax', 'MyAjax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );     }          add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );     add_action('wp_ajax_next_posts', 'next_posts_callback');     add_action('wp_ajax_nopriv_next_posts', 'next_posts_callback');          function next_posts_callback() {              global $post;         $nextPostIDs = array_map('intval', explode(',', $_POST['cadenaNext']));         $prevPostIDs = preg_match( '/[0-9,]/', $_POST['cadenaPrev'] ) ? $_POST['cadenaPrev'] : '';         $actualPostIDs = '';         $counter = 0;         $postIDs = '';         foreach ( $nextPostIDs as $key => $value ) {             $mypost = get_post( $value );             $counter++;             if( $counter <= 8 ) {                 $actualPostIDs .= $mypost->ID.',';                 // Page thumbnail and title.                 ?>                 <article id="post-<?php echo $mypost->ID; ?>" <?php echo $mypost->post_class; ?> style="display: inline-block; width: 20%; margin: 3px; padding: 0px; vertical-align: text-top;">                 <?php                 echo '
ID ).'">'.get_the_post_thumbnail( $mypost->ID, 'thumbnail' ).'
';                 $audioFiles = get_post_meta($mypost->ID, "pistas-de-audio-mp3", array('output' => 'html'));                 echo '
'.$audioFiles.'
';                 $audioFiles = get_post_meta($mypost->ID, "pistas-de-audio-ogg", array('output' => 'html'));                 echo '
'.$audioFiles.'
';                      add_filter( 'the_title', 'max_title_length', 30);                 echo '
';                 echo get_the_title( $mypost->ID );                 echo '
';                      //max longitud artistas                 $max = 20; //define your max characters here                     $terms = get_the_terms( $mypost->ID, 'Artistas' );                      if ( $terms && ! is_wp_error( $terms ) ) :                    echo '
';                   foreach ( $terms as $term ) {                     $term_name = $term->name;                     if( strlen( $term_name ) > $max ) {                       $term_name = substr( $term_name, 0, $max ). " …";                     }                     echo 'slug, 'Artistas' ).'" title="'.$term->name.'">'.$term_name.'';                   }                   echo '
';                 endif;                 echo '
';                 remove_filter( 'restrict_manage_posts', 'max_taxonomy_length');                 remove_filter( 'the_title', 'max_title_length');                  } else {                 $postIDs .= $mypost->ID.',';             }         }                  echo '
';                  //botones de siguientes y anteriores reviews             $actualPostIDs = substr( $actualPostIDs, 0, strlen( $actualPostIDs ) - 1 );                  if( $postIDs ) {                 $postIDs = substr( $postIDs, 0, strlen( $postIDs ) - 1 );             }             if( $prevPostIDs ) {                 $prevPostIDs = substr( $prevPostIDs, 0, strlen( $prevPostIDs ) - 1 );             }             if( $postIDs || $prevPostIDs ) {                      if( $postIDs ) {                     echo '<form id="ajax-form-next" method="post" action="">';                     echo '<input type="hidden" name="actualPosts" id="actualPosts" value="' . $actualPostIDs . '"/>';                     echo '<input type="hidden" name="nextPosts" id="nextPosts" value="' . $postIDs .'"/>';                     echo '<input type="submit" name="next" value="=>"/>';                     echo '</form>';                 }                 if( $prevPostIDs )  {                     echo '<form id="ajax-form-prev" method="post" action="">';                     echo '<input type="hidden" name="actualPosts" id="actualPosts" value="' . $actualPostIDs . '"/>';                     echo '<input type="hidden" name="prevPosts" id="prevPosts" value="' . $prevPostIDs .'"/>';                     echo '<input type="submit" name="prev" value="<="/>';                     echo '</form>';                 }                  }                  die();      }      And it works just the first time. The second time I submit the form, it is not sending an Ajax request. The original page is loaded. Any idea of what is going on? (I know I have to use nonces, but first I want to make it work) This is the `ajax-search.js` file:               jQuery(document).ready(function($) {         var cadenaNext='';         var cadenaPrev='';         $('#ajax-form-next').submit(function(e){                     e.preventDefault();                     jQuery.post(MyAjax.url, {action : 'next_posts' ,cadenaNext : $('#nextPosts').val(), cadenaPrev : $('#actualPosts').val() }, function(response) {                     $('#posts_container').hide(1000);                     setTimeout(function() {$('#posts_container').html(response).show(1000);}, 1000);                 });         });              $('#ajax-form-prev').submit(function(e){                     e.preventDefault();                     jQuery.post(MyAjax.url, {action : 'next_posts' ,cadenaNext : $('#prevPosts').val(), cadenaPrev : $('#actualPosts').val() }, function(response) {                     $('#posts_container').hide(1000);                     setTimeout(function() {$('#posts_container').html(response).show(1000);}, 1000);                 });         });          });


title: Wordpress Dashboard - Restricting Access

text: I'm new to WordPress and a bit confused with something. I'm trying to build a classified marketplace type of website for myself. I am NOT building this for a "client". I will probably be using a hack of several different plugins as my coding skills are not up to par. Eventually I will hopefully have lots of users who will be composed of buyers & sellers. My question pertains to the WP dashboard. When buyers/sellers sign up for my site, will they be able to see the WP dashboard? I would prefer that they NOT be able to access a back-end dashboard at all let alone a WP branded one. Is this possible? If so any clue as to how this might be accomplished?


title: How to display a specific post type name in a breadcrumb

text: I have this function:               function the_breadcrumb() {         if (!is_home()) {             echo "Start » ";             echo '';             bloginfo('name');             echo " » ";             if (is_category() || is_single() ) {             the_category('title_li=');             if (is_single()) {                 echo " » ";                 the_title();             }         } elseif (is_page()) {             echo the_title();         } elseif (is_single() && $post_type == 'partners') {             echo "IS THIS WORKING?";                 }         } elseif (is_home()) {         echo "Start » ";    bloginfo('name');         }     }      I also have created a custo post type called 'partners'. However, my breadcumb does not display my IS THIS WORKING TEXT Help appreciated. Alex


title: Problem with query_posts for a custom taxonomy in theme options

text: I am having some issues with querying the output of custom taxonomies in my theme options. I have included what I think are the necessaries below. Many thanks for your help in advance.               // Pull all the custom taxonomies into an array          $options_taxonomies = array();     $taxonomies_terms_obj = get_terms('portfolio_category');     foreach ($taxonomies_terms_obj as $taxonomy) {         $options_taxonomies[$taxonomy->term_id] = $taxonomy->name;     }          // Select a Featured Homepage Category          $options[] = array(         'name' => __('Featured Homepage Category', 'options_framework_theme'),         'desc' => __('Choose a category to feature on your homepage.', 'options_framework_theme'),         'id' => 'homepage_feature',         'type' => 'select',         'options' => $options_taxonomies);     }          //The query          if ( function_exists( 'of_get_option' ) ) :         query_posts( 'cat=' . $homepage_feature = of_get_option( 'homepage_feature' ) . '&posts_per_page=3' );


title: update_option() updating the option with an empty value?

text: I have a call to update_option() inside a class which edits some keys from the options array passed to it and then saves the updated array to the database, I don't have any fancy code, the function is only calling the `update_option()` function like this:               update_option( 'my_options', $this->updated_options );      Now this class is initialized in an admin page:               $instance = new My_Class($options_to_update);          $instance->init(); // the function that updates the option is called here      The thing is that `update_option()` is returning `true` and updating the option with an empty value. also I checked the array just before the call to this function and nothing is wrong:               print_r( $this->updated_options );      I also tried to update with a string:               update_option( 'my_options', 'any string' );      Now my questions are:   * Am I doing something wrong ?   * Is there a specific time to call `update_option()` ? because I have it in a function hooked to `admin_init` and it's working fine. **Update:** I found out that it's not working only if i's called inside the display function of `add_menu_page()` any reason why ? the passed value is always `null`.


title: Hereditary Subpages Nav

text: I'm trying to create an automatically generated navigation using Wordpress child pages - which will only show the next child pages down from the selected one (example page). You'll see that I can get it working using CSS rules for 3 generations of pages, but then I run out of child classes, so when it gets to 4th generation pages onwards it just show every child ... I'm possibly looking at it too simply just trying to use CSS to control this, but I can't find the WordPress PHP which will do this. Currently using:               <ul class="products-sidebar">         <?php         global $id;         wp_list_pages("depth=10&title_li=&child_of=10"); ?>     </ul>      Does anyone have any ideas please?


title: Pagination - works on local but not live dev!

text:
Can anyone please shed some light as to why the following to print out page numbers works on my local dev server but not on my live server? Both server are running same version of PHP. My Loop               <?php     global $paged;     $args = array(         'orderby' => 'post_date',         'posts_per_page' => 5,         'paged' => $paged     );     $query = new WP_Query($args);     if($query->have_posts()) : while ($query->have_posts()) : $query->the_post();     //do stuff     endwhile; ?>      My Pagination               <?php echo '
     [First]';     for($i=1;$i<=$query->max_num_pages;$i++)     echo ''.$i.'';     echo 'max_num_pages).'">[Last]
     ';     endif;     wp_reset_query();     ?>      The issue clearly lies within:               for($i=1;$i<=$query->max_num_pages;$i++)      The first & last print out fine - the page numbers do not. Thanks in advance **EDIT** If i do this it works:               for($i=1;$i<=99;$i++)      So the issue is with:               $query->max_num_pages;      Any more thoughts?


title: Display custom text when comments are closed

text: When I close comments on a post it's showing "Comments are closed". Is there any way to edit this text and show a personal note instead of the pre- configured one? I would prefer to do this in a 'universal' type of thing, meaning that the same message would appear even if I change the wordpress theme.


title: Blur.js with WordPress - Enqueued, but server not finding file

text: So as the title suggests, I'm trying to run blur.js on my WordPress theme. I have enqueued the script in functions.php:                   function load_oves_methods(){         wp_enqueue_script( 'blur', get_stylesheet_directory_uri() . '/js/blur.js', array('jquery') );         wp_enqueue_script( 'flexcroll', get_stylesheet_directory_uri() . '/js/flexcroll.js', array('jquery') );     }          add_action( 'wp_enqueue_scripts', 'load_oves_methods' );      jQuery is loaded before this. In the header.php file, I am calling the blur.js function as such:               <script>     jQuery(document).ready(function($){         jQuery(".head").blurjs({             source:'body',             radius:5,             overlay:'',             offset:{                 x:0,                 y:0             },             optClass:'',             cache:false,             cacheKeyPrefix:'blurjs-',             draggable:false         });     });     </script>      The script is called after wp_head();. And the files in question are most assuredly on the server, in my themes /js folder. The error I get in the console is: "Failed to load resource: the server responded with a status of 404 (Not Found)" Previously I was calling said script via a tag in the header, and it was able to find the file, but it kept tossing errors in blur.js, and saying that it could not find the variable "jQUery", despite jQuery UI scripts working just fine on my theme. EDIT: Both scripts now have the array('jquery') dependency added to them, but still no dice. I have checked the file source via my browser and triple- checked all folder destinations - everything checks out as a-ok. My jQUery UI scripts work just fine, by the way, but neither blur.js or flexcroll.js work. Disabling plugins didn't have an effect, either. I checked file permissions as well, and those are set properly.


title: Localizing a string with html tag with word inside that tag

text: I have translated many string successfully previously, but this one gives me a headache. This part is used inside my content-related.php file which I use to display related posts Here is the current string I'm using `<?php echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and wacth the video.' ?>` My problem in the localization process is the `<a href="'. esc_url( get_permalink() ) . '">here</a>` part in the middle. The best I could come up with is `<?php printf(__('Click %s to go and wacth the video.', 'pietergoosen'), '<a href="'. esc_url( get_permalink() ) . '">here</a>'); ?>` OK, I know I can just create a variable for the `<a>` tag and rather use the variable in the `printf()` string instead of the whole `<a>` tag, but that is not the concern now, and that was only done to test the result first. With the string in its changed order, the string translates, except for the word "here" which is inside the `<a>` tag. How can I get the string to translate the word "here" as well. I've read somewhere, think it was in the Codex, that it is not a good idea breaking up a string into several strings as it may cause problems for certain languages as word order differ in some languages. Any more suggestions to solve this problem?


title: What are the disadvantages of using global variable?

text: I am a newbie at WordPress. In my "recent posts" shortcode, I used `global $post` variable, because `the_title()` function was giving me page's title, not post's title. I am not exactly sure, but I thought that's because of loop inside of a loop. Some advanced users here tell me not to use `global` variable, so using `global $post` variable inside my "recent posts" shortcode is good or not?


title: Redirect blog page to latest post?

text: How can I make it so when the blog link in the nav bar is clicked it redirects to the most recent post? I know how to display just the latest post on the blog page, but I want it to actually redirect to the post page itself as I'm displaying a full screen background image called in via a custom metabox on each post page. Is there perhaps a PHP query and redirect function I can apply to the blog page template, or is there a better way? UPDATE: the following redirect script works great but I just need a way to get the URL of the latest post:               $URL = "http://www.google.com";     wp_redirect( $URL, 301 );      exit;


title: Dynamically create check boxes for given post titles in WPAlchemy

text: I'm using WPAlchemy to create meta boxes. What I want to do is to dynamically create a group of check boxes with post titles. In other words, I want to replace `a`, `b` and `c` with the query of post titles.               <?php     $items = array('a', 'b', 'c');     while ($mb->have_fields('cb_ex', count($items))) {         $item = $items[$mb->get_the_index()];         ?>         <input type="checkbox" name="<?php $mb->the_name(); ?>" value="<?php echo $item; ?>"<?php $mb->the_checkbox_state($item); ?>/> <?php echo $item; ?><br/>         <?php     }     ?>      How can I do this?


title: ACF plugin categories bug in WordPress 3.9

text: i recently started using ACF plugin, i noticed that variables for custom fields i created and use in categories are saved in ‘wp_options’ tables, and although i am doing everything right they do not appear in the front-end i get a bool(false) for the field, i do not know if this has something to do with the WordPress update and the way it handles categories but i noticed that category metadata are stored in wp_postmeta table. So now i can not get the data to show on front-end everything works great in back-end. The interesting part is if i add the field in the first post of this category (maybe i should mention this is a custom section not the default category-post one that i use as a portfolio) the call on the category will start getting data, the ones that i specify on the post. Could anyone please help me or suggest anything else that i need to check, i am using WordPress 3.9 and ACF 4.3.6. This might even be a template related bug, but since i am not that familiar with WordPress architecture and i have yet to receive any answer from plugin developers i thought of asking here.


title: How to get specific string in explode array?

text: I have a shortcode where I'm trying to get a specific string from the $args array below. Query:               <?php     $args = array(     //'post_type' => $posttype,     'post_type' => explode( ', ', $posttype ),     );     $myquery = new WP_Query( $args );     ?>      Conditional:               <?php if( $posttype == 'cpt_press' ) : ?>       <?php the_content(); ?>     <?php else : ?>       <?php the_excerpt(); ?>     <?php endif; ?>      Shortcode:               [myquery posttype='cpt_press']      In the conditional above, I'm able to retrieve all posts with post type "cpt_press" if **I don't use explode**. The reason I used explode is so I could do this:               [myquery posttype='cpt_press, cpt_two, cpt_three, cpt_etc']      Any help? Thanks so much! UPDATED CODE BLOCK               <?php     function myshortcode( $params, $content = null ) {     global $post;     extract( shortcode_atts( array(     'posttype'      => '',     'meta_key'      => '',     'priority'      => '',     'meta_compare'  => '',     'layout'        => 'rows',     'cols'          => 1,      'tag'           => '',     'count'         => 10,      'orderby'       => 'date',     'order'         => 'DESC'     ), $params ) );          $args = array(     'post_type' => explode( ',', $posttype ),      );     $myquery = new WP_Query( $args );       ob_start();     ?>     <div class="row">     <?php     // The Loop     if( $myquery->have_posts() ) : while( $myquery->have_posts() ) :     $myquery->the_post();     ?>          <?php if( $posttype == 'cpt_press' ) : ?>       <?php the_content(); ?>     <?php else : ?>       <?php the_excerpt(); ?>     <?php endif; ?>          <?php endwhile; endif; wp_reset_postdata(); ?>     </div>     <?php      return ob_get_clean(); }     add_shortcode('myquery', 'myshortcode');


title: Define/declare new custom types with fields in plugin?

text: I want to develop a plugin using Pods but I want to create all the necessary custom types, fields, etc… on activation of my plugin. Is it possible? what are the good practices/approach? my plugin would depend on pods framework but everything done in code without the user having to create the custom types and fields via admin ui manually.


title: Adding onload to body

text: I'm currently trying to develop a plugin that will embed a Google Earth Tour into a WP post / page via a shortcode. The issue I am running into is that for the tour to load, I have to add an `onload="init()"` into the `<body>` tag. I can modify a specific template file, but since this is for release, I need to add it dynamically via a hook. Any ideas?


title: How can I make a Live Demo of my Premium Plugin? Are there security risks?

text: I'm glad to have the opportunity to ask my first question here. The scenario is this: My team and I released a Premium Plugin last week. We have since received a number of requests for a Live Demo. I'm considering creating a subdomain at demo.mysite.com, and modding the admin login page to display the demo username and password. Will it be sufficient, from a security standpoint, just to run it on a separate WordPress installation? Are there admin-level features I'll want to disable? I basically want the demo to be as realistic as possible without somehow compromising the security or integrity of my primary site. Any advice appreciated, SethMerrick


title: Random background image showing on website per click/load

text: Without using a plugin I would like to have a big background image changing on every click/load (or later on maybe every hour). So, I created a random_img.php file and put some code into header.php. Do not wonder about that header code! It is neccessary because some browsers (Safari, Chrome) otherwise do not accept background image changes because of caching purposes. random_img.php:               <?php     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");     header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1     header("Cache-Control: post-check=0, pre-check=0", false);     header("Pragma: no-cache"); // HTTP/1.0     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past     header('Content-Type: image/jpeg');     $bilder = glob( "../is/images/*.jpg" );     shuffle( $bilder );     $zufall = imagecreatefromjpeg($bilder[0]);     imagejpeg($zufall);      ?>      head of header.php:               <?php echo '<style type="text/css">        body {background: url(http://www.xxx.de/wp-content/themes/is/random_img.php?'.rand().') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;}     </style>'; ?>      This is working so far, but I have some problems/questions:   1. Right now I have declared a certain location for images with `$bilder = glob( "../is/images/*.jpg" );`, but this is bad, because once more I have to do something, meaning I have to upload pictures there. Instead I want to use a certain format/size, which I have defined before with `add_image_size( 'hintergrundbild', 1500, 1500 );` in functions.php. How to do/connect that?   2. Is there a cleaner way to do that instead of putting that line above into the head of header.php? I have a feeling, something is wrong about that, BUT on the other hand I could not find a solution for the caching problems with Safari and Chrome.   3. Instead on loading a new picture EVERY click/load, how to code it to change automatically every full hour or so? I think, that might be nicer and less aggressive. Thank you very much in advance, guys.


title: apply_filters, EMBEDS and AJAX not a friends?

text: I encountered a problem... There is content that contains a YouTube link > Lorem ipsum bla bla bla http://www.youtube.com/watch?v=nTDNLUzjkpg My plugin display this content with that code in the view:               <?php echo apply_filters( 'the_content', $data['meta']->start_page_content ); ?>      The problem is that if you open a page with usual GET method via the browser - the link becomes a YouTube player, but when i loaded the same template via AJAX - it seems that apply_filters does not work - at the output I get just a link, not a YouTube player code. How can i fix it?


title: Host a blog engine in my wordpress site

text: Hi I have a website like www.shankpress.com, it is wordpress v3, and i want my users to have blogs hosted in my site and have url like: blogs.shaknpress.com...and I can show who got the most popular blog entry etc... users can openly register, create a blog, start blogging and so on ... I am willing to buy solutions if no free stuff is available...


title: Featured Image Size

text: I am in the process of developing a new theme for my blog and am making a featured content slider. The issue that I am having is getting wordpress to force the image to the dimensions that I want it to be. The exact dimensions are 494px x 168px. I've tried simple using `the_post_thumbnail( array(494, 168) );`, but that didn't work. I also tried adding a custom image size to my functions file. This would sometimes get the height right (but not always), but didn't get the width right a single time. Could somebody please give me a way to force the dang image to be 494px X 168px?


title: Use translated taxonomy labels in plugin

text: I'm writing a plugin that works with taxonomy terms. It has, among other things, the capability to create new terms. I'm going to suppose that if users have custom taxonomies, they have taken care of having the singular and plural names set up and translated. The question is: How do I format my plugin messages to use translated labels for taxonomies? I need to output messages such as:   * "Created 1 category."   * "Matched 2 tags."   * "Updated 5 movies." (Supposing "movies" is a custom taxonomy.) In my understanding, the (translated) singular and plural labels for a taxonomy are available as `$term_object->labels->singular_name` and `$term_object->labels->name`. Is it correct to assume that these properties contain translated strings? Or is it necessary to wrap them with some i18n function? The `_n()` and the `_nx()` functions provide for singular and plural forms, but it doesn't make sense using them. I've been using:               $message = sprintf(          'Created %d %s',          count($created),          count($created) == 1 ?             $term_object->labels->singular_name             : $term_object->labels->name      );      What is the best practice here?


title: Gallery image doesn't show up after exporting and importing, how to fix?

text: I am trying to merge my multisite child sites to parent site. One of my blog (child site) is gallery based site and most of the post has wordpress media gallery attached to it. I have exported from the child site using wordpress export tool and imported using wordpress import tool. Import got failed at many times due to time out...finally one fine day that got imported, I have move all the media from child to parent (uploads folder) using c-panel, corrected urls. All feature image showing up, NextGen Gallary showing up but missing is images attached to post using wordpress media gallery. I am wonder if there is way to export media details and able to import so that all the media attachment information will be up again. Another thing what I notice is, post id are changing after importing to parent id, please please provide a solution.


title: How to change the order in which users are displayed in admin?

text: I would like to change the order in which users are displayed in the admin. At the moment it seems that they are order by the username. I think I have found the right place in the wp-admin/users.php, which is around line 187:               ORDER BY user_login");      I am not 100% sure if this is right as I don't know much about the code. Could anyone confirm if I am in the right place and what I should do to change the order. Also is it only possible that I could have an ascending or descending order for example, A,B,C,D,E or E,D,C,B,A? It would be idea if I could specify the order differently, for example, C,A,D,B,E or similar. Thanks


title: A function that returns true when the Author is a certain role is_author(admin)?

text: I need a function that returns true when the author is an admin or an editor or of a certain role. I can't use is_single because I have set up a forum and there are a million singles out there and I need a different layout for THE posts (the ones written in the blog by admins and editors) than from the forum entries


title: How to have "Page Title" different than "Menu Title" in wordpress 3.0.3?

text: I'd like to have the home page have a menu title of "Home" and a different page title "What we can do for you". How to do this without going into code. Is there any plug in to do this?


title: Count widgets of a certain type

text: How can I get the number (count) of, let's say, text widgets from a sidebar? for eg. if I drop 4 text widgets in the sidebar, I want to get this number somehow from another widget


title: How to Embed a post Automatically without having to write down the data all the time

text: hello when i click on create new post ![Wordpress](http://i.stack.imgur.com/YLVpE.png) I want this automatically Embed Is there any way i can do it ? So i dont have to manually do it all the time for creating new posts. Can you please help me?


title: Override Theme Customizer Cookie Expiration

text: I'm working on a Multisite network which has a forked/custom signup form. As part of the signup success process the user is automatically logged in, given a password, etc. I've got this all strung together successfully with `wpmu_activate_signup()`, `wp_signon()`, and `wp_redirect($newSiteAdminUrl . '/wp-admin/customizer.php')`. Unfortunately, while the user is logged in successfully (I can redirect them to the main dashboard without issue), the session is somehow immediately timing out and asking the user to log in, when they already are. Any ideas the source of this behavior? Part of me wonders if it's part of some behavior that pivots on a boolean related to "first-time logged-in users" and WordPress insisting they see the admin dashboard before anything else. Sorry I don't have any more info just now, would be grateful if anyone else has insight! ![screenshot](http://f.cl.ly/items/0L040K142Q072z3y2a2X/Screen%20Shot%202013-11-10%20at%201.52.27%20AM.png)


title: Fatal error after changes to functions.php, even with original file

text: Getting `Fatal Error: Cannot redeclare theme_feature_setup()` message after code changing in the functions.php file. I've tried deleting functions.php file and uploading the previous version but I still get the same error message.               define( 'WP_DEBUG', true );     define( 'WP_DEBUG_LOG', true );      included in config.php file. Also NO error.log file is created in wp-content. ERROR MESSAGE:               Cannot redeclare bean_feature_setup() (previously declared in htdocs/wp-content/themes/koi-child/functions.php:33) in htdocs/wp-content/themes/koi/functions.php on line 33      How should I proceed?


title: Delete posts without category with SQL

text: A website I am working on has a 'lost' category uncategorized. It got deleted and now I have thousands of posts without category. Those posts are old an need to be deleted. How can I do this with SQL if I don't have a term_ID? (term_ID = NULL). I need to delete the posts, the meta, and everything else connected to those posts.


title: Where is the "Posts"/"Blog" template?

text: I want to modify the "Posts" template. But I can't find it's location, I believe it's unrelated to my theme. Where is it located? Could I copy it and create an identical template in my theme so as to not mess around with the original?


title: Profiling wordpress performance

text: I am migrating a wordpress site from a shared hosting to a dedicated cloud virtual server. In theory the latter should be better however, with the same data, plugins and setup the cheap shared hosting has a much better response time. When I do Network profiling using Chrome, the shared hosting index page comes through in less than 2 seconds and the full document is loaded in less than 5 seconds. The new virtual server takes 7 seconds to deliver the index page's HTML and nearly 10 seconds to transfer the rest of the resources to complete the page load. There seems to be a bottleneck somewhere which I can't identify. When I put a simple PHP file doing something like `phpinfo()` it loads in a few milliseconds, so it doesn't seem to be a PHP issue. I have installed APC to supposedly improve performance (to no avail) and on both the shared hosting and the new virtual server I have W3 Total Cache configured too. The virtual cloud server is not loaded at all, CPU 99.3% idle with load average 0.01 if not less most of the time. Physical memory is not used up either (786Mb of 1Gb). When I used the Debug Queries plugin to find if Mysql was the problem it seemed that most queries return really fast and it gave this final report: `Page generated in 6.90618s, 94.32% PHP, 5.68% MySQL` Which seems to suggest that there is something not related to the database that is introducing delays. No idea what that 94% is doing. Is there a way to effectively understand what is going on in a situation like this?


title: "Price Not Announced" removal in JigoShop

text: Can you tell me How to remove **"Price Not Announced"** in JigoShop shop page?


title: Can you manage multiple domain names from a single WordPress multisite network?

text: My Main Purposes   * To centralise all of my WordPress sites (different domains - different clients) in one place controlled by the main dashboard. Be able to choose which site is in need of a theme, plugins, or core file updates.   * Saving loads of time by not updating and maintaining each site one by one.   * Only one core WordPress file update affecting the rest. Questions   1. Can I create a Network within the MultiSite (WP v3.7.1 to-date) configuration but NOT based upon subdirectories or sub-domain basis as each site has its own theme, plugin, and domain name: **Site1.com, Site2.com, Site3.com** for example?   2. The main site will not be under "root" directory but dwell within /subfolder instead, if the question#1 above is achievable, all the rest of the sites will be within /subfolder/wp-contents/theme << each theme per site in different folders, is it possible?   3. Is this the good solution in terms of a security issue as it seems all the sites are under one roof?   4. Each client, each site, each domain has their own login screen and could be able to claim their rights over their site only, what if they do have multiple users who need a log-in, will it mess up with another client site including my own main site as well?   5. Don't quite see the whole picture how InfiniteWP plugin could help me either to minimise the WP core installation or centralise all the sites in one place? Any recommendations in order to achieve all of my main purposes are welcome as it's quite a chaotic to update one by one and wasting hosting space by installing the core file on each site.


title: If Media Type .GIF

text: Been looking for a way to do this but cant seem to find anything, not even here. I am using timthumb to re-size my sites images. As most of you know after re- sizing a animated gif its not going to work any more. So i need a way to skip over the image if its a .gif file type. Something like               <?php if( typegif() ) { ?>     <img src="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),'full' ); echo $src[0]; ?>" alt="Image# <?php the_ID(); ?> "/>       <?php } else { ?>      <img src="<?php bloginfo( 'template_url' ); ?>/thumbs/timthumb.php?src=<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); echo $src[0]; ?>&w=280" alt="Image# <?php the_ID(); ?> "/>       <?php } ?>      After some more digging i found this code, however its not working.                 $attachment_mime = wp_check_filetype(wp_get_attachment_url($post->ID) );        if ( $attachment_mime['type'] == 'image/gif') {             echo 'this is gif';            }            else {            echo 'this aint gif';            }


title: Is it a bad practice to use switch_to_blog in the frontend?

text: From Wordpress Codex (although related to the same function in WPMU and not WP3.0+): http://codex.wordpress.org/WPMU_Functions/switch_to_blog it says: > _This switch is to be used for internal and admin area functions. It's too > expensive a query to run on the front end._ in the new page for the same function in WP3+ there's no such mention. So, is it a normal or a bad practice to use switch_to_blog in themes? I have a multisite setup with 4 blogs and would like to use this function often to pull content from one to another.


title: Is it possible to get_terms by author?

text: I get terms from all my posts with `get_terms`,               $tags = get_terms( 'mytags', '&number=5&orderby=date&order=desc&hide_empty=1' );     foreach ( $tags as $tag ) {         echo 'slug.'">'.$tag->name.'';     }      Is it possible to get_terms included to the posts made by author? I try to add a list with all the terms (tags) in author.php template, thanks a lot!


title: Testing performance of WordPress files

text: I would like to test the performance of PHP files in my installation, to find any bottlenecks. I already use plugins like Debug Queries and WPDB Profiler to watch the SQL Queries being generated, but I would like something that shows me the execution time of each php file to identify if some plugin is not optimised. Is there any plugin for this?


title: How to link to featured image to media file URL

text: I have enabled a function when I uploaded an image, it auto create a post with that image as the featured image. Now I wish to link to that featured image to that of the image file/media file URL so that lightbox effects can work on it. But not sure how to implement this? Any help will be highly appreciative. The function that I have used is -               add_action('add_attachment', 'create_post');     function create_post( $attach_ID ) {          $attachment = get_post( $attach_ID );          $my_post_data = array(     'post_title' => $attachment->post_title,     'post_type' => 'post',     'post_category' => array('0'),     'post_status' => 'publish'     );     $post_id = wp_insert_post( $my_post_data );          // attach media to post     wp_update_post( array(     'ID' => $attach_ID,     'post_parent' => $post_id,     ) );          set_post_thumbnail( $post_id, $attach_ID );          return $attach_ID;     }


title: Sorting Posts by Date - get_blogs_of_user_id()

text: I am a newbie who needs to produce a chronological list of recent posts from all sites to which a user is subscribed on a WordPress multisite network. Using the code below, I am able to produce a list where the posts are ordered chronologically (DESC) but grouped by site:   1. Site A Wednesday   2. Site A Tuesday   3. Site A Monday   4. Site B Wednesday   5. Site B Tuesday   6. Site B Monday I need to produce a list where all posts are ordered chronologically:   1. Site A Wednesday   2. Site B Wednesday   3. Site A Tuesday   4. Site B Tuesday   5. Site A Monday   6. Site B Monday                      $user = get_current_user_id();             $blogs = get_blogs_of_user( $user );                  if( $blogs ) {                  foreach( $blogs as $blog ) {                     switch_to_blog( $blog->userblog_id );                             $query = new WP_Query ('posts_per_page=2');                                     if ($query->have_posts()) :                                             while ($query->have_posts()) : $query->the_post();                                                  <li>                                             <a href="<?php echo $string; ?>$                                             </li>                                                   <?php                                             endwhile;                      $                     restore_current_blog();                                  }          }     ?>      ?> When I have attempted to apply 'order by' to the WP_Query using (new WP_Query( array( 'order by' => 'date' ), I'm producing the first list above (a list ordered chronologically, grouped by site). I have the feeling that I'm supposed to be sending the output of WP_Query to an array, sorting the array, and then printing this to the page, but as I am extremely new to all of this, I could really use some guidance at this point. Thanks.


title: A form in a custom widget

text:
I'm trying to build a contact form custom widget. So i would like to display a contact form with a WordPress widget and send a message. No problem to display the form with my widget but when i click on the send button i can't retrieve my data. The isset($_POST['my_data']) doesn't work. When I put my form code out of the widget in a simple php file, everything is ok, the isset($_POST['my_data']) work well. I do the test with this simple snippet:               <?php          //$form_action = '';     $form_action = get_bloginfo('url').'#contactBox';          if (isset($_POST['send'])) {     echo "The isset 'send' work well      ";     $name = (isset($_POST['name'])) ? $_POST['name'] : '';     echo "name = ".$name." ";     } else {     echo "There is something WRONG !!!";     }          // Display the form     echo '<form method="post" action="'.$form_action.'">'."\n";     echo '
'."\n";     echo '  Name'."\n";     echo '  <input type="text" name="name" value="'.$name.'" />'."\n";     echo '
'."\n";     echo '
<input class="submit" type="submit" name="send" value="Send" />
'."\n";     echo '</form>'."\n";          ?>      Is it possible to implement a form with a WordPress custom widget ? This is the complete code of my custom widget with the contact form: www.pixenjoy.com/documents/widget.zip I add two echo messages in this code to test the retrieve of my data form (if(isset...) > line 145 "ok" line 190 "ko"


title: How do I get Link for Oldest Custom Post Type (dynamically)

text: Anyone know how I could take the below script that was answered for retrieving the latest permalink for a Custom Post Type and flip it to get the oldest post instead? This is the link for retrieving custom post type latest post


title: Adding extra info via GET while registeration in wordpress

text: i am trying to make a little referral sort of system for my site. so for that i settuped an extra parameter in the registeration url as : www.domain.com/wp-login.php?action=register`&register_me=site_name` and one is adding ip address while registeration, at first i thought it would be a simple form in wp-login.php but i just found out its all based on filters etc.. very complicated stuff. I did setuped two extra fields in the wp_user table. called `'reg_ip' and 'referral'` .. now i need to understand how to add these two things in wp-login.php so they will be inserted in teh database while registeration. Help is really really appreciated :) cheers Ayaz


title: Is there a way to 'Lock' a Taxonomy?

text:
I was wondering if there was a way to prevent the addition of new categories into a taxonomy, essentially 'locking' the taxonomy. I'm programatically registering a taxonomy and filling it with terms via functions.php and would like it so you cannot add anymore into it. ## The Vision, REALIZED... Heres how my solution ended up looking, and it works great! THANKS to everyone who helped. Upvotes all over the place up in your face!               // some stuff happens before this...         $labels = array(             'name' => _x( 'Attendees', 'taxonomy general name' ),             'singular_name' => _x( 'Attendee', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Attendees' ),             'all_items' => __( 'All Attendees' ),             'edit_item' => __( 'Edit Attendee' ),              'update_item' => __( 'Update Attendee' ),             'add_new_item' => __( 'Add New Attendee' ),             'new_item_name' => __( 'New Attendee Name' ),             'menu_name' => __( 'Attendees' )         );         $rewrite = array(             'slug' => 'attendee'         );         $capabilities = array(             'manage_terms' => 'nobody',             'edit_terms' => 'nobody',             'delete_terms' => 'nobody',             'assign_terms' => 'nobody'         );         $args = array(             'hierarchical' => true,             'labels' => $labels,             'show_ui' => true,             'query_var' => 'attendee',             'rewrite' => $rewrite,             'capabilities' => $capabilities         );         register_taxonomy('attendees', 'meetings', $args);     }     add_action( 'init', 'todo_create_taxonomies', 1);     function todo_register_attendees() {         $users = get_users();         foreach ( $users as $user ) {             wp_insert_term( $user->display_name, 'attendees', array('description'=> $user->display_name, 'slug' => $user->user_nicename) );             $lockdown[] = $user->user_nicename;         }         $terms = get_terms('attendees', array('get' => 'all') );         foreach ($terms as $term) {             if ( !in_array($term->slug, $lockdown) ) {                 wp_delete_term( $term->term_id, 'attendees' );                 $message = new WP_Error('force_terms', __('Only Registered Users can be Attendees, ' . $term->name . ' has been deleted.'));                 if ( is_wp_error($message) ) { ?>                     <div id="aphid-error-<?php echo $message->get_error_code(); ?>" class="error aphid-error">
<?php echo $message->get_error_message(); ?>

                 <?php }             }         }     }     add_action( 'admin_notices', 'todo_register_attendees' );


title: Show button only for certain Woocommerce Product Categories

text:
I'm trying to add a button to my product pages which allows the user to request a sample, however I only need this to be seen on products within certain catagories. I've managed to get the button working by adding this code into the meta.php file:
     Request a Sample

<?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?>

      But I'm not sure how to get it to only show on products within these categories. I tried wrapping my code in:               <?php if (in_category('11,12,13')) { } ?>      But this didn't work. I'm thinking maybe it's because my categories were created in woocommerce. Any help will be greatly appreciated! Thanks in advance! EDIT I've just tried this but still nothing...               <?php if ( is_product_category() ) {     if ( is_product_category( 'coving' ) ) {     echo '
Request a Sample

<?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?>

';     } elseif ( is_product_category( 'skirting-boards' ) ) {     echo '
Request a Sample

<?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?>

';     } elseif ( is_product_category( 'dado-rails' ) ) {     echo '
Request a Sample

<?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?>

';     } elseif ( is_product_category( 'indirect-lighting-by-orac' ) ) {     echo '
Request a Sample

<?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?>

';     } else {     echo ' ';     }          }?>      Anyone have any other ideas? Thanks


title: Separate Wordpress themes for each category page

text: I've read http://codex.wordpress.org/Category_Templates, which tells you how to change your index.php for each category. But I want to load a whole different theme directory in for my site when a particular category is viewed. So for example, if I go to: http://www.mysite.com/mycategory/ It will load a separate theme. Is this possible?


title: Multiple Category Query

text: Is it possible to display a wordpress category page but have it pull posts from mulitple categories? For example, let's say I need to pass in params for `cat_id` in this fashion               /category/dining/?location=2&activity=2      And have the resulting page produce a list of posts from the categories specified by `location` and `activity`. Thanks!


title: How to hook into unregistering a widget instance?

text: I would like to hook into a widget instance after it is removed from a sidebar panel on the Appearances -> Widgets admin page. So if the instance was an active widget and then removed, I would like to hook into that instance before it is removed. Can it be done?