Passing array in add_option() in WordPress custom theme

I have to create a option page in my custom theme wordpress. here is is a sample of code               <?php              function bguru_register_settings(){             $default_options=array(             'bguru_logo'=>'http://templategraphy.com/demo/businessguru/images/logo.png',             'bguru_vimeo'=>'',             'bguru_skype'=>'',             'bguru_dribbble'=>'',             'bguru_slide_one_image'=>'',             'bguru_slide_one_heading'=>'',             'bguru_slide_one_text'=>''              );                  add_option('bguru_options',$default_options);                  register_setting('tgbusinessguru', 'bguru_options');         }              add_action('admin_init', 'bguru_register_settings');              function bguru_register_options_page(){              add_theme_page('Business Guru Options', 'Theme Customizer', 'edit_theme_options', 'bguru-options', 'bguru_options_page');          }              add_action('admin_menu', 'bguru_register_options_page');              function bguru_options_page(){             $options=get_option('bguru_options');                  ?>
         <?php      screen_icon(); ?>
Business Guru Options
         <form method="post" action="options.php">              <?php      settings_fields('tgbusinessguru'); ?>

General

                              Logo:	                              <input type="text" id="bguru_logo" size="50" name="bguru_options[bguru_logo]" value="<?php echo $options['bguru_logo']; ?>" />

Social Links

                         Vimeo:	                         <input type="text" id="bguru_vimeo" size="50" name="bguru_options[bguru_vimeo]" value="<?php echo $options['bguru_vimeo']; ?>" />

                         Skype:	                         <input type="text" id="bguru_skype" size="50" name="bguru_options[bguru_skype]" value="<?php echo $options['bguru_skype']; ?>" />

                         Dribbble:	                         <input type="text" id="bguru_dribbble" size="50" name="bguru_options[bguru_dribbble]" value="<?php echo $options['bguru_dribbble']; ?>" />

                              Image:	                              <input type="text" id="bguru_slide_one_image" size="50" name="bguru_options[bguru_slide_one_image]" value="<?php      echo $options['bguru_slide_one_image']; ?>" />

                         Heading:	                         <input type="text" id="bguru_slide_one_heading" size="50" name="bguru_options[bguru_slide_one_heading]" value="<?php      echo $options['bguru_slide_one_heading']; ?>" />

                         Description:	                         <textarea type="text" id="bguru_slide_one_text" style="width:439px;height:100px;" name="bguru_options[bguru_slide_one_text]"><?php  echo $options['bguru_slide_one_text']; ?></textarea>

               <?php submit_button(); ?>            </form>
     <?php  } ?>      All the form details are passed by dashboard I want if admin forget to fill the logo field then by default this $default_options work so by default logo field fill up but when I try to access the array using get_option I'm not getting the results I expect.


WP query taxonomy input differs to output?

I'm trying to build a custom query and I need to include the current category ID. I previously had the WP_Query args as:               Array     (         [post_status] => publish         [posts_per_page] => -1         [post_type] => courses         [cat] => 70      When I output SQL result behind this argument query using $query->request; the taxonomies read as 95 and 203, instead of 70?               SELECT wp_posts.* FROM wp_posts                  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)                  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)                  INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)                  INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id)                  INNER JOIN wp_postmeta AS mt3 ON (wp_posts.ID = mt3.post_id) WHERE 1=1                  AND ( wp_term_relationships.term_taxonomy_id IN (95,203)      Can anyone tell me how/why this is happening and what I need to do to find 95,203 from this initial 70 so that I can also build this query manually? Many thanks


How to restrict actions and filters "properly" by conditions

Which one is correct when adding actions/filters/etc.... Both methods work fine and I've seen people do things both ways, but I'm assuming one is correct. My gut tells me that wrapping the if statement around the action only is better but I'm not sure... Method A: Wrapping `if` around `add_action`:               function unregister_default_wp_widgets() {         unregister_widget('WP_Widget_Pages');         unregister_widget('WP_Widget_Calendar');         unregister_widget('WP_Widget_Archives');         unregister_widget('WP_Widget_Links');         unregister_widget('WP_Widget_Meta');         unregister_widget('WP_Widget_Search');         unregister_widget('WP_Widget_Text');         unregister_widget('WP_Widget_Categories');         unregister_widget('WP_Widget_Recent_Posts');         unregister_widget('WP_Widget_Recent_Comments');         unregister_widget('WP_Widget_RSS');         unregister_widget('WP_Widget_Tag_Cloud');         unregister_widget('WP_Nav_Menu_Widget');     }          if( !current_user_can('administrator') ) {         add_action('widgets_init', 'unregister_default_wp_widgets', 1);     }      ---- OR ----- Method B: Wrapping `if` around both function definition and `add_action`:               if( !current_user_can('administrator') ) {              function unregister_default_wp_widgets() {             unregister_widget('WP_Widget_Pages');             unregister_widget('WP_Widget_Calendar');             unregister_widget('WP_Widget_Archives');             unregister_widget('WP_Widget_Links');             unregister_widget('WP_Widget_Meta');             unregister_widget('WP_Widget_Search');             unregister_widget('WP_Widget_Text');             unregister_widget('WP_Widget_Categories');             unregister_widget('WP_Widget_Recent_Posts');             unregister_widget('WP_Widget_Recent_Comments');             unregister_widget('WP_Widget_RSS');             unregister_widget('WP_Widget_Tag_Cloud');             unregister_widget('WP_Nav_Menu_Widget');         }              add_action('widgets_init', 'unregister_default_wp_widgets', 1);     }


Stop post submission without losing data?

Is it possible to stop a post from publishing/updating, and instead redirect back to the post with the same data that was being submitted? I want to do this so I can show an error message, should they enter invalid information in a metabox. Right now it just doesn't save the values of that metabox, but that isn't a very good option. I think it may be possible by abusing the auto-save system a bit, but before I go digging around I thought I'd see if anyone else has run into this issue.


Creating Multiple Loops in Genesis, One Post then 20, each with custom fields

I need to create a custom loop for a custom post type archive template, that is as similar to this page as possible (www.manta.com/totd) using the Genesis framework. Here is a paste of what I have, which is not working. http://pastebin.com/g1EK5f6M As well as the current archive template http://pastebin.com/A6UufNMu which produces this: m.angiemeekerdesigns.com/totd Can someone help me learn why my current code isn't working? Update: After working on it some, I've come to the paste below - it's working about 80% of what I need, except that the one post from the first loop at the top (feature) is showing the content that the posts from the second loop below should be showing, and vice versa. Here's a link to page on the site now: http://m.angiemeekerdesigns.com/totd and the code as far as I've gotten.               <?php          /**      *      * Display the Tip of the Day Custom Post Type archive custom fields using      * ACF.      *      * @author Angie Meeker      * @uses   Advanced Custom Fields      */           add_action('genesis_entry_content','genesis_do_post_title', 2);           //* Removes Continue Reading from the echoed excerpt      function sbt_auto_excerpt_more( $more ) {     return 'aaa';     }     add_filter( 'excerpt_more', 'sbt_auto_excerpt_more', 20 );          function sbt_custom_excerpt_more( $output ) {return preg_replace('/]+>Continue reading.*?<\/a>/i','',$output);     }     add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more', 20 );                //* Add Tip of the Day body class to the head     add_filter( 'body_class', 'add_tiparchives_body_class' );     function add_tiparchives_body_class( $classes ) {        $classes[] = 'tiparchives-post-type-archive-{tipoftheday}';        return $classes;     }           // Return Category and Tip of the Day on Single Posts     add_action ( 'genesis_before_content', 'show_totd', 9 );     function show_totd() {         echo '
Tip of the Day
';     }        // Remove Post Author      add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );     function remove_post_author_totd_posts($post_info) {         $post_info = '[post_date]';         return $post_info;     }               /** Replace the standard loop with our custom loop */     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'manta_tips_feature' );     add_action( 'genesis_loop', 'manta_tips_teasers' );                              /** Show the first first post from the TOTD Custom Post Type */          function manta_tips_feature() {                echo '
Current Tip of the Day
';         global $paged; // current paginated page         global $query_args; // grab the current wp_query() args         $args = array(             'post_type' => 'tipoftheday',             'posts_per_page'=> '1',             'paged'  => $paged,         );              genesis_custom_loop( wp_parse_args($query_args, $args) );      // Return if CPT Tip of the Day     add_action( 'genesis_after_entry_content', 'manta_tips_pre_features' );     function manta_tips_pre_features() {                  // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                          echo '

';                                          echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

Share This Tip:

';                               echo '

';             }     }     }          /** Show the first 10 previous posts from the TOTD Custom Post Type */          function manta_tips_teasers() {                echo '
Previous Tips
';         global $paged; // current paginated page         global $query_args; // grab the current wp_query() args         $args = array(             'post_type' => 'tipoftheday',             'posts_per_page'=> '10',             'paged'  => $paged,         );              genesis_custom_loop( wp_parse_args($query_args, $args) );                // Return if CPT Tip of the Day     add_action( 'genesis_after_entry_content', 'manta_tips_teaser_pre' );     function manta_tips_teaser_pre() {                  // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] !='') {                          echo '

';                                          echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                          echo '

';             }     }     }               genesis();


Posts in loop all show the same author when there are many authors

I am iterating through an array of post IDs `$ids`. All is displayed correctly except for the authors. Every post shows the same author, although the posts are by different authors. I can't seem to get this worked out...               <?php      $ids = array();     $bookid = get_post_meta(get_the_ID(), 'prefered_book', true );      $args = array(         'post_type' => 'post',         'post__not_in' => array($post->ID),         'tax_query' => array(             array(                 'taxonomy' => 'books',                 'field' => 'id',                 'terms' => "$bookid",             )         )     );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {          while ($my_query->have_posts()) : $my_query->the_post();               $ids[]= $post->ID;           endwhile;         }     ?>          <?php     $bookdesc = get_term( $bookid , 'books');          if(count($ids)) : ?>
Post about <?php echo $bookdesc->description; ?>

          <?php foreach($ids as $id) : ?>
                  <a href="<?php echo get_permalink( $id ); ?>">
                      <?php $img = wp_get_attachment_url( get_post_thumbnail_id($id,'size-200') ); ?>                      <?php if ($img) : ?>                          <img class="smallImage" src="<?php echo $img ?>" />                      <?php endif; ?>
<?php echo get_the_title($id); ?>

By <?php the_author($id);                                   // Here it fails, incorrectly showing same author for every post                          ?>

          <?php endforeach; ?>
     <?php endif; ?>


wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

I'm having a weird problem I have written the code as below:               add_action('save_post', 'save_post_func');          function save_post_func(){         include_once(ABSPATH . WPINC . '/feed.php');              $rss = fetch_feed($url);              if (!is_wp_error($rss)) {             //ini_set('xdebug.max_nesting_level', 1000); <-- Doesn't work                  $maxitems = $rss->get_item_quantity(5);                  $rss_items = $rss->get_items(0, $maxitems);                  foreach ($rss_items as $item) { // count($rss_items) = 5 ???                 wp_insert_post(array('post_title' => 'a')); // inserts > 100 records ???             }              }          }      Displays this error: > Fatal error: Maximum function nesting level of '100' reached, aborting! Any help? Where is the problem all seems ok...


How to use jquery included with wordpress for jpanelmenu

I have successfully been using jpanelmenu in my wordpress themes for some time, loading jquery from the google api, like this:               if ( !is_admin() ) {              // jQuery         wp_deregister_script('jquery');         wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"), false);         wp_enqueue_script('jquery');              // load jPanelMenu         wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");          }      I'd rather use the version of jquery that comes included with wordpress, but can't figure out how to make that happen. Can anyone advise me on how to do that, or tell me if I'm wrong in thinking that using wp's built-in jquery would be better than what I'm doing in the code above? I am instantiating jpanelmenu like this:               $(document).ready(function () {         var jPM = $.jPanelMenu({         duration: 100,         openPosition: "240px",         direction: "left",         keyboardShortcuts: false         });         jPM.on(); // turn on jPanelMenu     });      Thanks in advance! _**edited_** Based on the answers below I tried the following, but jpanelmenu would not function (clicking on the menu trigger does not reveal the off-canvas menu):               function wpa_132328_enqueue_scripts(){     if ( !is_admin() ) {                  // jQuery             wp_enqueue_script('jquery');                  // load jPanelMenu             wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");              }     }     add_action( 'wp_enqueue_scripts', 'wpa_132328_enqueue_scripts' );      and               if ( !is_admin() ) {              // jQuery         wp_enqueue_script('jquery');              // load jPanelMenu         wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");          }      and               wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') );      and               if ( !is_admin() ) {              wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') );           }


Related Post ignore certain tags?

I'm seeking some help, I want my related pages to ignore a certain tag in my pages. How can I get it ignore tags with "sports" in it for my related posts, below is the code I use for related posts on my website:               function getRelatedPosts( $count=4) {     global $post;     $orig_post = $post;          $tags = wp_get_post_tags($post->ID);     if ($tags) {         $tag_ids = array();         foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;         $args=array(             'tag__in' => $tag_ids,             'post__not_in' => array($post->ID),             'posts_per_page'=> $count, // Number of related posts that will be shown.             'ignore_sticky_posts'=>1         );         $my_query = new WP_Query( $args );         if( $my_query->have_posts() ) { ?>

Related Posts

             <?php             while( $my_query->have_posts() ) {             $my_query->the_post(); ?>

             <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { /* if post has a thumbnail */ ?>             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><?php the_post_thumbnail('small-thumb'); ?>             <?php } else { ?>             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><img src="<?php echo bloginfo('template_url'); ?>/images/default145.jpg" />             <?php } ?>
         <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
             <?php }             echo '

';         }     }     $post = $orig_post;     wp_reset_query();      }


How can you use a TinyMCE 3x function in WordPress 3.9

I want to use tinymce 3x width function `createControl` in wordpress 3.9. How can I achieve this ?               createControl: function(n, cm){        return null;     }


Rewrite rule is not working

I want a custom rewrite rule for my plugin. But for some reason it is not working. I tried flushing url, registered query var. But still it wont work and it gives output like this:               http://domain.com/page_name/?gallery_id=6      URL without prettifying:               http://domain.com/index.php?page_id=5&gallery_id=6      I want to rewrite above url to:               http://domain.com/page_name/gallery/id      I have added custom query var `gallery` and `gallery_id`. Here is my rewrite rule:               "pagename/gallery/([^/]+)/?"          => "index.php?page_id=".$base_page_id."&gallery_id=".$wp_rewrite->preg_index(1),      Please tell me what I am doing wrong. Thanks


How to display counter for post in navigation?

I have custom post type called Booking. It have custom post status : "waiting confirmation" and "confirmed". I want to display counter in navigation menu to count total post which status is "waiting confirmation". It would look like this. ![enter image description here](http://i.stack.imgur.com/dPqfK.png) How could I do that? My source code is here: https://github.com/rahmatawaludin/morpha-event


I am trying to hide a custom post type category to logged in users with Pre_Get_Posts

I have a custom post type in my theme called portfolio. It's categories are called project-categories. I am trying to exclude a project category for logged in users. I cannot get this to work at all. I have read through the pre_get_posts codex but I am just stuck. I'm not sure if I am defining the categories for my custom post type or if it would be the same as a normal post category. When I click on the category to edit it, this is in the browser url bar `wp-admin/edit-tags.php?action=edit&taxonomy=project- type&tag_ID=94&post_type=portfolio` Here is the code I'm trying right now.               function exclude_category( $query ) {         if ( is_user_logged_in() && $query->is_main_query() ) {             $taxquery = array(             'taxonomy' => 'project-type',             'field' => 'id',             'terms' => array( 94 ),             'operator' => 'NOT IN'         );                  $query->set( 'tax_query', $taxquery);         }     }     add_action( 'pre_get_posts', 'exclude_category' );      Any ideas on what I might be doing wrong would be greatly appreciated. Thanks


Get all custom_post_type posts + blog posts from one category in a single query

Is there a way to query posts from multiple post_type's and filter the normal blog posts by a category? I am trying to display the 10 latest custom_post_type posts and blog posts on my homepage in a single query - so that I have 10 posts in total, sorted by post_date in DESC order, containing all posts from my custom_post_type and blog posts from a certain category. Let's say I have custom post type called news. I want to query both news and posts, but limit posts to category with id 3. I do NOT want to limit news to any category.               $args = array (         'cat' => 3,         'post_type' => array ( 'news', 'post' )     );      The above code seems to only work half - it only fecthes blog posts from the category 3, but no custom_post_types at all...


Why, Where, and When to use reference pointers in filters/hooks? What are the potential cons of not using them when suggested or required? Just looking for a more detailed answer than the codex provides and maybe some real world applications of this. For example: `add_filter('some_wp_filter', array(&$this, 'my_function_to_filter');`


Changing $latex $ equation background color globally

## Background Unfortunately, when hosting your blog with WordPress.com you can't use the MathJax-LaTeX pluging, and have to use the default wordpress LaTeX. The way it works, is by rendering the LaTeX math into an image, and sticks that image into your blogpost. Since it is an image, it has a background color. The feature was designed so that it tries to figure out the proper background color for your theme to fit the LaTeX in naturally. Unfortunately for me, my background color is white, but the LaTeX is rendered with background gray. There is a way to change the color of a single equation. For instance: `$latex E = mc^2$` would produce the default background color, while `$latex E = mc^2&bg=ffffff$` would force the background to be white. This is what I want to achieve, but for every equation in my post. I don't want to have to type `&bg=ffffff` at the end of each LaTeX environment manually (it is already a big enough hassle to write `$latex` instead of just `$`!). * * * ## Question > Is there a way to change the background color of all the math equations at > once? Alternatively, if no such method exists. > From where does the `$latex $` feature guess the background color, and how > can I change what it guesses? Keep in mind that I am on WordPress.com so I can't simple switch to the MathJax-LaTeX plugin.


Whats the difference between blog_info('stylesheet_url') difference get_stylesheet_uri()

The question is in the title really. What is the difference between blog_info('stylesheet_url') difference get_stylesheet_uri(), and if it's a case that one is newer then which. The codex says: > 'stylesheet_url' - Returns the primary CSS (usually style.css) file URL of > the active theme. Consider using get_stylesheet_uri() instead.


Hook on trash post

I want to perform an action when I delete one of my custom post types, which hook should I use: wp_trash_mycpt or trash_mycpt My action should run solely when mycpt is in the 'publish', 'draft' or 'future' state and moves towards the 'trash' state. When it is removed from trash itself there is no reason to run the function again.


Attaching images to posts manually (i.e. with custom code, without the use of an API)

I am working on mobile API for a WordPress site.   The API is written in PHP and provides methods actions such as creation of a post. Now, I can create a post with one image (thumbnail) of the post. How can I create post with multiple images, what records in what WP tables must I create to connect all this data?   I mean without using WP code, with pure PHP?


Creating a dynamic URL structure

I want to create a directory structure for my WordPress links and for the final page to be based on the taxonomy of the page. So I have a business that belongs to a `city` (meta) and `country` (taxonomy). I would like the final URL to be               http://example.com/{country}/{city}/{post_title}/      Is this at all possible? I have tried `add_rewrite_rule()` but either it can't do what I want or I'm doing it wrong (I got rid of the code so I can't show it, apologies).


Adapting plugin for custom post type?

I am trying to reformulate a function (in a plugin) so that it applies to posts in a custom post type rather than normal posts.                function saving_posts($post_id)     {         global $wpdb, $user_ID;         $this->setup_links();         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return;         if('post' == $_POST['post_type'])         {             if(!current_user_can('edit_post', $post_id))                 return;         }         else             return;         $mydata = ($_POST['mf_post_to_forum'] == 'true')?true:false;         if($mydata)         {             $date = $this->wpf_current_time_fixed('mysql', 0);             $fid = (int)$_POST['mf_post_to_forum_forum'];             $_POST['mf_post_to_forum'] = 'false'; //Eternal loop if this isn't set to false             $post = get_post($post_id);             $sql_thread = "INSERT INTO {$this->t_threads} (last_post, subject, parent_id, `date`, status, starter) VALUES('{$date}', '".$this->strip_single_quote($post->post_title)."', '{$fid}', '{$date}', 'open', '{$user_ID}')";             $wpdb->query($sql_thread);             $tid = $wpdb->insert_id;             $sql_post = "INSERT INTO {$this->t_posts} (text, parent_id, `date`, author_id, subject) VALUES('".$this->input_filter($wpdb->escape($post->post_content))."', '{$tid}', '{$date}', '{$user_ID}', '".$this->strip_single_quote($post->post_title)."')";             $wpdb->query($sql_post);             $new = $post->post_content."\n".'
get_threadlink($tid).'">'.__("Join the Forum discussion on this post", "mingleforum").'
';             $post->post_content = $new;             wp_update_post($post);         }     }       I assumed I could just change `if('post' == $_POST['post_type'])` to `if('my_custom_post' == $_POST['post_type'])` and the rest would work the same. The `$mydata`value comes from here:               function send_wp_posts_to_forum()     {         add_meta_box('mf_posts_to_forum', __('Mingle Forum Post Options', 'mingleforum'), array(&$this, 'show_meta_box_options'), 'my_custom_post');     }     function show_meta_box_options()     {         $forums = $this->get_forums();         echo '<input type="checkbox" name="mf_post_to_forum" value="true" /> '.__('Add this post to', 'mingleforum');         echo ' <select name="mf_post_to_forum_forum">';         foreach($forums as $f)             echo '<option value="'.$f->id.'">'.$f->name.'</option>';         echo '</select>
'.__('Do not check this if this post has already been linked to the forum!', 'mingleforum').'';     }      which works fine as the meta box is present in the right place.


Redirect to a page if ancestors is empty

I have this script to get the ancestors ID               //Get root ID     $post_id = $post->ID;      $ancestors = get_post_ancestors($post_id);      I would like to make a redirection if it's empty to a specific page ID so no one could be on a page with no ancestors. How ?


Getting deleted users in database

I am using the database that is being used by a WordPress site. I am trying to get all the users from `wp_users` table with SQL query. But there is also previously deleted users in `wp_users` table. I searched other tables like `wp_usermeta` but I couldn't find any status or column which identifies if that user deleted or not. Are there any table or column where WordPress website stores information about deleted users?


Is there a good way to use CMS images with CSS

I am building a responsive wordpress theme that allows for a custom banner image to be uploaded to each page. However, because of the responsive nature of the theme I need to set the images as background images using css to achieve the right effect. But, I do not want to throw random css styling into my html markup. Is there any to pull the image url from within the page template and drop it into a css file dynamically? I found an example of what I am looking to do here but without the slider functionality.: http://emporiumpies.com/ It seems they are hard coding the images in the css file, but that is the visual effect I am going for. I just need to figure out how to tie this into the wordpress CMS. Any help would be greatly appreciated! Thank you!


Sending post information to a coldfusion site.

I have a requirement where I need to send the post title, excerpt and permalink to an external coldfusion site. Basically, the coldfusion site would display this information as a teaser and then allow the reader to click on the permalink to go to the wordpress post page to read more. Is there a web service available that can help with this? Thanks


update_post_meta after form is submited

I'm using the plugin "Formidable" to easily manage and create forms. I have set a custom post type, and created an extra post_meta. I can use meta('test'); within the loop to show my meta value on the posts single page. Everytime someone creates an entry by submitting the form thats on the single post page i want the value for the meta key 'test' to be subtracted by one(updated). The Formidable plugin comes with a action hook:               add_filter('frm_after_create_entry', 'after_entry_created', 30, 2);     function after_entry_created($entry_id, $form_id){         if($form_id == 7){ //change 7 to the ID of your form               //do stuff here         }     }      I have put this in my functions.php. But how do I target the right post and right meta key? Thanks


Echo author slug in post edit page

On the Post edit page in the back-end, how do I echo the author's `user_nicename`? I am referring to the author of the post, not current user.


Front end form submission/processing, without using a template file

I'm writing a plugin which has a front end form that is generated by a shortcode. I'm struggling with processing the form submission in any way. Many tutorials describe placing form processing code at the top of a template file. But as a plugin I don't have a template file. This is what I have at the moment. The shortcode just calls this function:               function get_testimonial_submission_form () {     ?>     <form action="" id="testimonialPostForm" method="POST">              <fieldset>             <?php _e('Name:', 'rhl-testimonial') ?>             <input type="text" name="testimonialclientname" id="testimonialclientname" />         </fieldset>              <fieldset>             <input type="hidden" name="submitted" id="submitted" value="true" />             <button type="submit"><?php _e('Submit Feedback', 'rhl-testimonial') ?></button>         </fieldset>          </form>          Result is <?php echo $testResult; ?>

          <?php     }      And for form processing, I'm using this test code:               function testimonial_submission_form(){         if($_POST['testimonialclientname'] == ''){             $testResult = 'Yes';          } else {             $testResult = 'No';         }     }          add_action( 'init', 'testimonial_submission_form' );      Currently after submitting the form, $testResult is empty.


Run an action only when Widget actually instantiated (not just registered)

Suppose you have a widget that depends on a metabox being added to, say, your Posts. An easy way to do this is to simply add the `add_meta_boxes` action to your Widget's constructor and off you go. When that widget is registered with `register_widget()` function, your metaboxes are added and off you go. The _problem_ with this approach is that, well, if the user hasn't actually dragged that widget into one of his sidebars, we _still_ add the metaboxes. And, if for some reason we register two different versions of this widget (say we extend the widget), then we're uselessly running the function twice. `wp_register_sidebar_widget` is called when the widget is registered, but that means it runs regardless of whether the widget actually appears in a sidebar or not. Is there a corresponding action that is run when a widget is actually loaded into a sidebar? So in other words an action that will only run for each widget that is actually added to a sidebar? Or do we have to dig through a list of widgets gotten through `wp_get_sidebars_widgets()`?


Pageline V1.4.5: background color of my title

Wow do I change the background color of my title in Blog articles? Not the color of the page but the backgroundcolor of the blogtitle.


Post pagination wp-pagenavi

i'm having some problem with page pagination using wp-pagenavi, i'm using this query:               $myposts = query_posts( array( 'showposts' => 10, 'paged' => get_query_var('paged') ) );;      i would that had 10 posts per page, in fact, it pages, but it only pages with 5 posts per page, i have 18posts, and cant have success to paginate. At Configurations > Reading > Posts per page: 10. What can be my problem? code: http://pastebin.com/TC7eBuFh


Togle wordpress metaboxes

While some excellent posts and tutorials have been written about removing and un-setting metaboxes, what i am looking for is to be able to turn them and off through a `settings page` for my theme. I am working on a function (reproduced below) to manage the widgets on the dashboard, it retrieves a get_option array which includes only the id's (as keys) of the metaboxes i want displayed, it compares this array to an array (keys) of all metaboxes i have given the option to be removed (right now only core ones but in the future custom ones also); the arrays are merged and unique remaining id's are passed to a foreach loop where they are removed using `remove_meta_box()` method (could have used the unset here also). This all works fine but is there a simple easy way to add these metaboxes back again without having to go through all the work of redefining all the arguments of `add_meta_box()` ? I mean something similar to `wp_register_script()` and then `wp_enqueue_script()` where once wp_register_script is defined, wp_enqueue_script can be called easily with just one argument. The function i have so far is:               function manage_dashboard_widgets() {          $show_metaboxes = (array) get_option( 'dashboard_show' );          $all_metaboxes = array(         'dashboard_quick_press',        // 'QuickPress'         'dashboard_secondary',          // 'Other Wordpress News'         'dashboard_primary',            // 'Wordpress Blog'         'dashboard_incoming_links'      // 'Incoming Links'         );          $metaboxes_to_remove = array_unique( array_merge( $all_metaboxes, $show_metaboxes ) );          if( ! empty( $metaboxes_to_remove )){         foreach ($metaboxes_to_remove as $metabox_to_remove ) {             remove_meta_box( $metabox_to_remove, 'dashboard', 'side' );             remove_meta_box( $metabox_to_remove, 'dashboard', 'normal' );         }     }          // Remove the welcome panel, irrespective of user.     update_user_meta( get_current_user_id(), 'show_welcome_panel', false );          }      add_action( 'wp_dashboard_setup', 'manage_dashboard_widgets', 20, 0 );      Thank you


How to display list of categories when using multi category filter

I'm using a multiple category filter by linking to URLs such as: domain.com/category/reviews+books domain.com/category/reviews+art etc This works fine as a filter but I can't find any built in WordPress function that will display the list of categories queried on the page. On a normal category page I would use single_cat_title() but this only retrieves the first category in the URL. How do I display both, or all if there are more? Thanks


Specify Table Column Width on a Page

I currently have the following html on my Wordpress page
         <col width="50">         <col width="100">

NLP

                 Overview	                 A natural language processing challenge.

      However the `<col width="50">` seems to be getting ignored. Is this getting overridden by something in the CSS and if so how do I fix it?


Can I create my own custom Attachment Display Setting?

I'm porting a client site over to WP from an old customized .Net CMS and something their existing system does well is the site admin interface contains a simple utility for uploading media to the server and format it automatically for the page so visitors can download the file. (Where file downloads appear in their site there's a special icon and it adds the file size after the anchor text) It would be a very successful migration for me if I could provide a similar solution in WP from within the Media Library, and extending the Attachment Display Settings with one additional custom option would seem to do it nicely.   * Is this possible? Can I add an option to the Attachment Display Setting menu?   * Can it be done so that it won't be overwritten when WP updates? I'm glad to figure things out myself although I'm not the best PHP guy. But any clues on where to start would be a tremendous help. Thanks!


wp_query->max_num_pages always returns 0 on custom post type

Hi there I am developing a theme where I have to load some posts with ajax, in my index page everything works properly, the problem is when I need to use it on custom post type, I pass the values for a jquery file using wp_localize_script, it pass the correct value when I have regular posts, but it always pass 0 when I have a custom post type. Can you help me? Many thanks. Code to pass arguments to my jQuery script               function core_ajax_init() {              global $wp_query;              // Add code to index pages.         if( !is_admin() ) { //!is_singular()                  // Enqueue jQuery Script to Process Ajax             wp_enqueue_script(                 'core_custom',                 get_template_directory_uri(). '/core/js/ajax-load-posts.js',                 array('jquery'),                 '1.0',                 true             );                  // What page are we on? And what is the pages limit?             $max = $wp_query->max_num_pages;             $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;             //echo $max;                  // Add some parameters for the JS.             wp_localize_script(                 'core_custom',                 'core',                 array(                     'startPage' => $paged,                     'maxPages' => $max,                     'nextLink' => next_posts($max, false)                 )             );         }      }          add_action('template_redirect', 'core_ajax_init');      The following is a template where I call to print the button to load more posts               <?php      global $wp_query;          $found_posts = $wp_query->found_posts;     $per_page = get_option('posts_per_page');     $post_count = $found_posts - $per_page;          if($found_posts > $per_page) :     ?>

                                                                    <div id="loader" data-perpage="<?php echo $per_page; ?>">

<?php _e('Click here to load more', CORE_THEME_NAME);  ?>

      <?php endif; ?>      And here I have a snippet where I make a custom query for a specific post type               global $wp_query;                                             $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                                             $wp_query = new WP_Query(array( 'post_type' => 'course', 'order' => 'DESC', 'orderby' => 'date', 'paged' => $paged ));                                             if($wp_query->have_posts()): ?>      The problem here is it seems no matter how many pages I have wp_query var here always return 0 to my function core_ajax_init(), if I have regular posts it returns the correct number of pages but for custom post type it always returns 0. Why? Thank you for your answers.


Passing html tags as shortcode parameters

I want to let the user of my plugin define html tags to use before and after the text output by the shortcode, so I am using parameters where they can enter the tags. However the tags are being converted to html entities. I therefore resorted to using html_entity_decode(), is this good practice?                   extract( shortcode_atts( array(                              'count'         => -1,                 'category_name' => '',                 'q_before'      => '<h3>',                 'q_after'       => '</h3>',                 'orderby'       => 'date', //'none','ID','author','title','name','date','modified','parent','rand','menu_order'                 'order'         => 'ASC', //'DESC'           ), $atts, 'myfaq' ) );              $q_before   = html_entity_decode( $q_before );         $q_after    = html_entity_decode( $q_after );


custom field functionality

I have to build a custom functionality based on custom fields. I have a sidebar that displays a blockquote testimonial. At the moment this is achieved by giving a post a category of block quote. But the customer wants to make it more user friendly by adding a field for the title, the quote and an author. I can do this by adding custom meta boxes and using the post meta data. But they also want to be able to choose the page it will be displayed on. Currently the block quote is a template part, and is called via a conditional in various template files. So it is not known in advance the pages it will appear as content grows and different pages are added. I will need a select box in the post edit screen that has been auto populated with all the current pages that display a block quote. But I am at a loss how to populate this select box as its not known in advance which pages end up with a block quote on them. I was thinking about finding a way to every time a page displays the block quote this info is logged and then used to populate the select box, but I am not that great with custom php, I am a front end Dev that is learning how to build WordPress back end. I have good HTML CSS JavaScript, but my php knowledge is limited to simple conditionals and the custom functions of WordPress. I assume this will be hooking into a filter somewhere but I can't see where. Any help on this would be much appreciated.


modify a function filter

I am using the latest version of wp-ecommerce (3.89) and a new filter has been introduced to enable role based access to certain dashboard features such as the sales page or upgrade capability. However, the default role in the core file is currently set to "administrator". What I would like to do is take the original filter and modify it by placing the modified code in my functions file to over-ride that. So how to modify this: (from plugin file wp-ecommerce/wpsc-admin/admin.php               $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );     $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );      to something like this               remove_filter('wpsc_purchase_logs_cap', 'administrator');     function sh_wpsc_admin_pages($purchase_logs_cap) {     apply_filters( 'wpsc_purchase_logs_cap', 'editor' );          }


Why is the media upload button not in the main toolbar & can it be placed there instead?

Is there a good reason why the wp media upload button is not placed within the main edit toolbar, and can we put it there instead of floating above??


How do I remove a menu from a theme?

I have a very simple question, how do I remove a menu from a WordPress site? Is there a plugin out there that can handle this or do I have to go into my theme's code and remove something from there?


Does the 3.4.2 Dashboard have Chrome Frame headers?

A quick google search for "Wordpress Dashboard Chrome Frame" seems to indicate that 3.2 and up integrate Google Chrome Frame is included in the Dashboard, but I haven't been able to find anything official from Wordpress about it, and when I inspect the headers in Chrome, I don't see the standard Chrome Frame headers. Anyone know anything about this?


Why when I create a new post I found 2 record related to this post into the posts database table?

I am very new in WordPress development and I have a doubt about the WP database table named **posts** I have observe that when I create a new post (into the WP administration panel) are created 2 record into the **posts** table. For example, after that I have create a single post titled as **DB TEST** into the **posts** table I found these 2 records:               29  1   2014-08-14 20:36:43 2014-08-14 20:36:43 deb test    DB TEST     publish open    open        db-test         2014-08-15 20:37:34 2014-08-15 20:37:34     0   http://localhost/wordpressAsper/?p=29   0   post        0          30  1   2014-08-15 20:36:43 2014-08-15 20:36:43 deb test    DB TEST     inherit open    open        29-revision-v1          2014-08-15 20:36:43 2014-08-15 20:36:43     29  http://localhost/wordpressAsper/2014/08/15/29-revi...   0   revision        0      As you can see the 2 records contains the same informations except for the ID (that is univocal) and for the **post_type** field. In the first record this field have **post** as value while in the secondo record the valie is **inerith** So why when I create a new post I have 2 records and not a single record? Moreover I noted that, for other posts, I have more the 2 records related to the same post. What exactly means?


Best practices for multiple Custom Feeds functions

I created two new WordPress RSS feeds in my theme functions: `               // Custom Feed 1     add_action('init', 'customRSS');     function customRSS(){      add_feed('feedname', 'customRSSFunc');     }     function customRSSFunc(){     get_template_part('rss', 'feedname');     }                              // Custom Feed 2     add_action('init', 'customRSS2');     function customRSS2(){      add_feed('feedname2', 'customRSS2Func');     }     function customRSS2Func(){     get_template_part('rss', 'feedname2');     } ` It's working perfect, however based on the DRY concept I feel that may have a better approach to this code instead of adding the whole function for each new custom feed. Is that true? The tutorial I followed is this if anyone interested.


Custom CSS for plugin form

I have a short code that is adding a form to a page. How do I ensure that the CSS for the form is loaded in time with the shortcode?


Can I exclude a post by meta key using pre_get_posts function?

I see many people prefer to use `pre_get_posts` hook instead of `query_posts`. The code below works and shows all posts which have meta key "featured"               function featured_posts( $query ) {         if ( $query->is_main_query() ) {            $query->set('meta_key', 'featured';            $query->set('meta_value', 'yes';         }}     add_action( 'pre_get_posts', 'featured_posts' );      But I want the posts which have '`featured`' meta_key to be **excluded** from the main query. Is there an easy way for this?


How to include posts with a theme

I am making a theme and would like to submit the posts that i have made with the theme to the user. How can this be done?


Define add_editor_style to specific post types?

I am wondering is it posible to define add_editor_style to specific post types? Currently I am using this function..               // EDITOR STYLE     add_editor_style('editor-style.css');      But I would like have multiple editor styles for various post types. So guessing it could be like this...               if ( ... ) {          // EDITOR STYLE POSTS & PAGES     add_editor_style('editor-style.css');          } else if ( ... ) {          // EDITOR STYLE CUSTOM POST-TYPE BOOKS     add_editor_style('editor-style-books.css');          }      My post types are `page`, `post`, `book`    Any ideas would be great thanks


How to show custom post type in page hierarchy?

Is it possible to show a list of pages with a custom post type included in that list if it's parent is a page? So if I was using the query more specifically something like `get_pages()`, `wp_list_pags()`, etc... could I show a list/sitemap that was more like a sitemap that that matched your entire sites structure? So consider these are all the public facing links of a site:               example.com      example.com/about      example.com/contact-us     example.com/services     example.com/services/service-one     example.com/services/service-two     example.com/services/service-three     example.com/services/service-four     example.com/services/service-five      These links were created with "pages" built in post type:               example.com/about      example.com/contact-us     example.com/services      Assume there is a custom post type called services that has the **page** "services" as it's parent when registering the psst type. So the following links were created under the services cpt:               example.com/services/service-one     example.com/services/service-two     example.com/services/service-three     example.com/services/service-four     example.com/services/service-five      Can I use the query somehow to produce a list that includes cpt's in it?


scripts not enqueueing

I have been beating my head against this for a couple of hours now and can't seem to figure it out. I am trying to enqueue a script into my page with the following code in my functions.php.               function my_slider_scripts() {     $scriptsrc = get_stylesheet_directory_uri().'/js/jquery.nivo.slider.pack.js';     wp_register_script( 'nivo-slider-pack', $scriptsrc );              wp_enqueue_script('nivo-slider-pack');     }           add_action( 'wp-enqueue_scripts', 'my_slider_scripts' );      I have looked at the codex and every tutorial I can find and nothing seems to make this work. I should mention I am using a child theme. Any ideas would be greatly appreciated.


Resize Rich Post Editor in Chrome

For some reason, I'm not able to resize the text editing area on my site's WordPress install in Chrome or Firefox. I can resize the HTML editor, which shows a resize indicator in the white text editor area, but the rich editor will not resize even though it shows the resize indicator in the grey area - http://cl.ly/5zgH. I can resize the editor in other WordPress sites I use, but not this one. Has anyone seen this, and do you have any suggestions?


Modify images when inserted in to WYSWYG Editor

When an image get added it currently adds                     I am aware that user can directly add the link. However the editors make mistake of not doing so. Also have IIRF set up so the actual domain used for wordpress is different to the actual host So I need to change the output of the the_content to be (this is for the existing posts)                     When inserting new image whatever the option editor choose insert only the image as                     I saw this Modifying the HTML Output of Inserted Images but I am not quite sure how to actually change it to my requirements


Settings API - Checkboxes validation in a menu with multiple subpages

I'm building a theme using the settings API. I have a top level menu with multiple subpages and everything is working fine, except checkboxes. I am saving the options to a single options array. This is my sanitation function:               public function sanitize($input) {              $options = get_option(THEMEOPTIONS);         $fields = gosu_adminpanel_fields();              foreach ($fields as $key => $field) {             if($field['callback'] == 'gosu_controls_checkbox') { // if the field is a checkbox                      if(!isset($input[$key])) {                     $options[$key] = "off";                 }                  }         }              foreach($input as $key => $field) {             $options[$key] = $value;         }              return $options;          }      $fields is an array with all the field data like type, default values, etc. Since checkboxes fields are not sent in the POST array when the option is unchecked, it requires the extra validation. This would work fine if I was using a single menu page, but since I'm using more than one, when I submit one of the pages that doesn't have a checkbox, it sets the value to "off" thinking the user unchecked the box because the field does not exist. I'd like to be able to validate the checkbox only when the page it is on is submitted or have some other way to make this work without the checkboxes value being set incorrectly. I want to use only one options array for all the theme's settings; using a variable for each page is out of the question. I'm considering changing the checkboxes for yes/no dropdowns but that wouldn't really be an elegant solution.


$post->ID displays wrong ID

This one is pretty weird. This code:               $post->ID      Displays right ID every time excepting the blog page (the page set as blog on /wp-admin/options-reading.php). On that page $post->ID returns the ID of first blog post for given page. Now, the tricky part, I've tried to remove all the loops from all my pages, totally erased loop.php file, disabled all the widgets that might have been affecting $post and it still returns the wrong ID. Any hints? My index.php is pretty standard:               <?php get_header();?>               <?php get_template_part( 'loop', 'index' ); ?>          <?php get_footer(); ?>      And the loop.php is:               <?php while ( have_posts() ) : the_post(); ?>      contents     <?php endwhile; ?>      Maybe the problem is I'm trying to get the ID in header.php? And yes, `wp_reset_postdata()` doesn't seem to help as well :/


Need to add/remove group of options and display them as rows

I am creating a plugin which has 5 textbox for options. What I need to do is to treat these 5 options as 1 item, and being able to add more items. I've always worked with static hardcoded options for my wordpress plugins, so I am not sure how to do this, but I will try to do my best to explain myself. I want to have a table similar to the posts table, then I want to be able to add/remove rows. Each row will be one "item" containing the 5 options. **Does someone knows a plugin that works similar to this so I can check it out? (if it also uses ajax that would be awesome)** My main problem is I am not sure how to save/retrieve the multiple rows because I always hardcoded my option names on the code.


The right way to create a custom search page for complex custom post types

I am trying to create a custom search page to show only custom posts types that meet specific search criteria. I have a complex form that involves different selects, radio buttons and text input fields. I am comfortable using the WP_Query class to query for the posts that are identified via the search form, but I'm not sure if I should create additional templates or use the built in search page. Let me give you a for instance to help communicate my conundrum. Imagine you have the CPT "Person". For each person, you have "Birth Date", "Gender", "Height", and "Weight". You want to search for all males born after 1972, who are taller than 6 feet tall. How would you work out this search? Again, I can easily put together `$args` for the WP_Query class to get these posts. I need to know the best way to integrate this with WordPress. Ultimately, I need a solution the satisfies the following: 1) Preserves pagination on the search page 2) Only searches for the specific CPT, not other CPTs And, I have the following questions 1) Should I have a separate template for this, or can I integrate this directly with `search.php`? My current solution feels hacky and I would like to develop an alternative. I have created a new Page in the WP admin. I use this page's URL as the `action` attribute in the search form. I then use a custom template to display results of that page. This seems wrong to me. 2) If I integrate this with `search.php` how do I preserve the regular search results, in addition to having these lovely custom search results? Thank you so much for your help! EDIT: On further investigation, I'm beginning to think that `pre_get_posts` will likely be involved in a "better way" to do this.


What's the easiest way to duplicate an entire navigation menu? I don't care if it involves SQL commands or whatnot. I just have some really big menus that I'd like to duplicate. Didn't see a plugin to do this. For clarification, I wan to duplicate the menu so I can make some edits to it and use it as a secondary menu elsewhere. I'm not trying to display the menu twice. ![wordpress.jpg](http://img16.imageshack.us/img16/2006/wordpressg.jpg)


I need ideas for a complicated menu

I have a slightly complicated menu to code from PSD document and integrate into wordpress. this is how it looks: (link in the comment bellow) The result of my work is this: http://slavisaperisic.com/FlexE/meni_setap.html Now, when I write function I get the default markup

      But the markup I created (that gives me the appropriately styled dynamic menu) looks like this:

                                     Exploring

                                     Using

                                     Downloading

      I styled it so that it follows the length of the word in the menu item. Obviously I can't use the `wp_list_pages()` function because the structure it gives me is different than the one I need. Do you have some ideas? Maybe point me to somewhere where I can learn to code it differently or explain it to me? Thanks


How Can I Organize the Uploads Folder by Slug (or ID, or FileType, or Author)?

I want to store all attachments (media) in folders named with each post title. Example: `/wp-content/uploads/my-post-about-stuff/` The folder should contain all media attached to that post. Is that possible?


Prevent Registration Where Role is None?

My blog is being hammered by sploggers. The good news is that in every case the role displays as "None" in the list of Users. Is there a way to use add_action("user register") in functions.php to prevent these registrations based on the role being empty or None? While I assume the code would look something like this:               add_action("user register","spike_registrations");          function spike_registrations($user_id){       //pull out role, evaluate role, if role = "" or None stop registration     }      What I'm unsure about is the specific code that goes into my function. What is the data set used by the registration process, for example, and how do I pull out the role from that data set? Is there any special way to evaluate the value of role? And what WP function is used to stop the registration process? Thanks for any ideas how to pull this off. It would save me an hour every few weeks spent going through 20 plus pages worth of bogus registrations.


Multiple Domains For WordPress MultiSite Subdirectories

How can I use example.com and example1.com for all WordPress multisite subdirectories? For example if a user navigated to example1.com/site/ they would see the same site as if someone navigated to example.com/site/ (or were forwarded). Currently I have my DNS for both domains pointing to my servers IP but only the domain I set in the WordPress settings (for example: example.com) is working. The second domain (example1.com) works, but it doesn't work with subdirectories (for example if I got to example1.com/site/ it just goes back to example.com). It sounds like I need to change something on my server or in the WordPress settings to allow both domains to be used, but I don't know. I purchased and tested this plugin but it just allows you to have switch between multiple domains per subsite (still only 1 domain), I need multiple domains for all subsites.


How do I delete all generated images from my server except those currently used in posts

I have a new set of image sizes for my site's in-development theme. My server is filled with old image sizes, most of which have never been used. You've heard this one before, right? **The Question**   How do I delete all WP generated thumbnails from my server _but not those thumbnails currently used in posts_? That is to say something like: `$ find . -name "*-*x*.jpg" | xargs rm -f` is too wide of a hammer because `myimage-300x250.jpg` might be used in a post. Its 6 other variations are welcome to go away though! I think I need to generate a list of used images, compare that to my directory and delete the difference (minus the originals). But how to go about that escapes me. * * * The " **why?** " sidebar:   Extra image sizes on the server is generally no big deal but we have over 2.7 gigs in their right now and it just seems a waste to leave them and back them up. Plus, we're about to start fresh - why not do the spring cleaning? As far as regenerating the thumbs, while the new design has new image specifications, none of us have the time to go and update hundreds of older posts with RTE inserted images. Let bygones be bygones, I say.


Fill post titles from post content?

I imported over 1000 posts from a Tumblr gallery. All the posts are untitled, but each has a photo and name inside of the post. How do I make take the content of each post and make it the post name?


Custom field not updating when value is empty

I've added a few custom fields to the WordPress image uploader using the hooks `attachment_fields_to_edit` and `attachment_fields_to_save`. Everything works very well, except when a field is erased by the user. For example, the field used to say 'Oil Painting' and the user erased it, wanting the field to be blank - but the field still says 'Oil Painting'. Changing the text to something else works fine however. Any ideas why this is happening? Thanks in advance Here is my code:               // Add custom fields to the media uploader     function wpf_fields_edit( $form_fields, $post ) {         $post->post_type == 'attachment';         $form_fields[ 'wpf_g_medium' ] = array(             'label' => __( 'Medium' ),             'input' => 'text',             'value' => get_post_meta( $post->ID, '_wpf_g_medium', true )         );         $form_fields[ 'wpf_g_medium' ][ 'label' ] = __( 'Medium' );         $form_fields[ 'wpf_g_medium' ][ 'input' ] = 'text';         $form_fields[ 'wpf_g_medium' ][ 'value' ] = get_post_meta( $post->ID, '_wpf_g_medium', true );              // A couple more fields are added here, using the same code              return $form_fields;     }         add_filter( 'attachment_fields_to_edit', 'wpf_fields_edit', NULL, 2 );          // Save the fields' data     function wpf_fields_save( $post, $attachment ) {         $fields = array('wpf_g_medium', 'wpf_g_dimen', 'wpf_g_collabs');         foreach( $fields as $field ) {             $key = '_' . $field;             if( isset( $attachment[ $field ] ) ) {                 if( trim( $attachment[ $field ] ) == '' ) $post[ 'errors' ][ $field ][ 'errors' ][] = __( 'Error! Something went wrong.' );                 else update_post_meta( $post[ 'ID' ], $key, $attachment[ $field ] );             }             }         return $post;     }          add_filter( 'attachment_fields_to_save', 'wpf_fields_save', NULL, 2 );          // Print the values, called in attachment.php     function get_artwork_fields_info() {         global $post;         $fields = array('wpf_g_medium', 'wpf_g_dimen', 'wpf_g_collabs');         $title = $post->post_title;              if( $fields ) {             echo '

' . $title . '
';             foreach ( $fields as $field ) {                 $key = '_' . $field;                 $meta =  get_post_meta( $post->ID, $key, true );                 if ( $meta ) {                     echo '
';                     echo $meta;                     echo '
';                 }            }            echo '
';         }     }


How to enable user_can_rich_edit for guests?

Using wp 3.3beta1 with the wp_editor on the front-end for bbPress. When calling the editor on the front end, how do I allow a guest to see the visual editor? I only see options to disable the visual editor site wide, or on a per user basis, but no option to allow guests to use visual?


Editing Pages that Have Already Been Published

Sorry for the simple question. I've published a page. Let's say that I now need to make changes to the page. Can I simply edit it, after it's been published? Or should I use a maintnenace mode? If someone tries to view the page at the same time that I'm editing it, will they be greeted by an error message? Thank you. -Laxmidi


How to fix missing information in a wordpress feed?

I am a new wordpress developer maintaining an existing site. The site has a custom template. If I go to `mysite/mytemplate/feed` I get a feed of that template -- except that one of the fields is empty. The feed XML looks like this:               <description>     <![CDATA[ ]]>     </description>      I know the description field is filled in the database because it shows up in the UI. Where is the code located that fills the description field in the feed? Once I know that I will be able to dig into the PHP that fills the description field.


Testing local server with MAMP/wordpress on mobile device?

I am currently developing a wordpress site locally using MAMP PRO, which obviously involves using a local database. I would like to test this site on my iPhone via a remote link. I have managed to do this by typing the following into my mobile phone URL...               192.234.2.32:8888       (IP Address : Port number) The problem is the index page is displayed but with no CSS styling. Then when I click on another page, it says the page cannot be found It seems it has connected to the server properly, but not to the wordpress database. (at least I think this is the problem) Does anyone have any information on how to get this working or point me in the right direction? Do you need another application to do this, or can it be done with mamp/IP address etc? Thanks in advance


Transient not working for custom loops

I'm working at a WordPress theme. Since I need to display featured posts, related posts, some widgets with recent posts and so on, I need to use multiple custom loops. Because of this, the number of database queries have also increased. In an attempt to optimize the theme for better performance I came across http://codex.wordpress.org/Transients_API , which seems like a good way to cache the loops that I don't need to be updated to every page reload. So far so good, I used transient for wp_nav_menu and it worked as it should. I managed to decrease a bit the number of db queries. The problem occured when I tried to use the transient for custom loops. The transient is saved. I can get the transient value. The only problem is that the number of the database queries seems to be significantly higher than when using WP_Query without a transient. Here is my custom loop:               if( false === ( $loop = get_transient('featured') ) ) {         $loop = new WP_Query( array( 'posts_per_page' => 20 ) );         set_transient('featured', $loop, 60 * MINUTE_IN_SECONDS);     }          if( $loop->have_posts() ) :              while( $loop->have_posts() ) : $loop->the_post();                  the_title();             the_post_thumbnail('thumb');              endwhile;          endif;     wp_reset_postdata();      The code used to display the number of database queries and execution time is the following:               <?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.      Using a query debug plugin, I see that _update_meta_cache()_ generates a lot of queries. I can't explain why the number of database queries increases instead of decreasing and why this worked for menues, but not for custom loops. Maybe I missed something. Any help is appreciated.


Dynamic Sidebar and XHTML Validity?

My question is concerning dynamic sidebars and wrapping the dynamic sidebar code in the `<ul>` tag. When I have widgets/dynamic sidebar enabled do _not_ add widgets to the sidebar, and _do not_ wrap the dynamic sidebar php code in the `<ul>` tag my theme it is XHTML valid. But when I add a widget it is invalid and requires the `<ul>` tag to make it valid! How do I make it valid in _all_ circumstances?               <?php if ( !function_exists('dynamic_sidebar')             || !dynamic_sidebar() ) : ?>     <?php endif; ?>


WordPress on a subfolder but accessible from root

I've searched quite a lot without finding a solution. I have a wordpress blog in `/_wp` and something else in `/other` What I'm trying to is that every request gets redirected to the WordPress. Except those to `/other` and its child directories. I also want the access to the blog to be rewritten. Few examples to make it clear:               / --> /_wp/          /ablogpost --> /_wp/ablogpost          /other --> /other          /other/bingou --> /other/bingou       I've tried a few things but what seems the most logical to me is:   * don't touch the .htaccess of /_wp/   * edit the .htaccess of the root '/' by adding:               RewriteEngine on     RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$     RewriteCond %{REQUEST_URI} !^(/other|/other/.*)$     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^/?(.*)$ /other/$1      ` # EDIT So i've set correctly the /_wp dir as explained online. Though I can't access to `/other` this is my htaccess now: RewriteEngine On               RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      I was thinking of adding `RewriteRule ^other - [L]` though it still doesn't work....


Remove parent slug for child pages

I'm looking for a plugin/custom function that removes the parent slug of a child's page permalink. Something that _automatically_ changes the permalink for child pages. Example: www.blog.com/products/apple becomes www.blog.com/apple Anyone got a clue if that could be done? Thanks in advance


How do I translate this string - PHP syntax question

I need some help on how to correctly format this code snippet for translation:               <?php next_post_link( '%link', __( '← Nästa nyhet') ); ?>      I've used this method in my theme before:               _e( 'Nästa nyhet', 'mytheme');      But I don't know how to correctly type the _e translation method in my link output. I want to translate "Nästa nyhet". Anyone?


I've implemented a way to show the Twitter feed without a plugin. It's worked for weeks(months even, on a different site), but is now giving me trouble. Here is the error: Fatal error: Call to undefined method WP_Error::get_item_quantity() in ... home.php on line 27 Line 27: $maxitems = $rss->get_item_quantity(3);               <?php     include_once(ABSPATH . WPINC . '/feed.php');     $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=urbanpalatela');     $maxitems = $rss->get_item_quantity(3);     $rss_items = $rss->get_items(0, $maxitems);     ?>
     <?php if ($maxitems == 0) echo '
No items.
';     else     // Loop through each feed item and display each item as a hyperlink.     foreach ( $rss_items as $item ) : ?>
     <a href='<?php echo $item->get_permalink(); ?>'>     <?php echo str_replace('UrbanPalateLA: ', '•', $item->get_title()); ?>
     <?php endforeach; ?>
      Any ideas what could be causing the error?


Open Graph in Index Loop

I have an index of posts where I'm wanting to insert a Facebook Like button for each post. Thus far, I've set all Open Graph data in the head for single posts. Any ideas on using the open graph data (particularly, the thumbnail) within the loop?


Use jQuery Datepicker code from plugin

Is it possible to access a plugins' functionality from a page template? I would like to use http://wordpress.org/plugins/acf-field-date-time-picker/ in a custom page with a form, so the user can choose date and time for a custom post type. Is there a way to achieve this?


Import csv for events manager plugin

i am neewbie to wordpress. I have a situation of importing the events and attended users for the events into wordpress through admin panel.Used events management plugin for creating events.Have to import CSV file for events and users attended for the events. in functions.php               function my_em_submenu () {         $plugin_page =   add_submenu_page('edit.php?  post_type='.EM_POST_TYPE_EVENT, 'Event.   Import', 'Styles', 'edit_events', "events-   manager-styles", 'my_em_admin_styles_page');       }     add_action('admin_menu','my_em_submenu', 20);


Display_rows() and column_cb() strange behaviour

I found a strange behavior of my functions. I thought to pass the id from `display_rows()` to `column_cb()`, but the problem is that the program passes only the first digit. Any hint? `column_cb()`:               function column_cb($item) {         return sprintf('<input type="checkbox" name="id[]" value="%s" />', $item['id']);     }      `display_rows()`:               function display_rows() {         $records = $this->items;         list( $columns, $hidden ) = $this->get_column_info();              if(!empty($records)){             foreach($records as $rec) {                 echo '
id.'">';                 foreach ( $columns as $column_name => $column_display_name ) {                     $class = "class='$column_name column-$column_name'";                     $style = "";                     if ( in_array( $column_name, $hidden ) ) $style = 'style="display:none;"';                         $attributes = $class . $style;                         $editlink  = '/wp-admin/link.php?action=edit&id='.(int)$rec->id;                              //Display the cell                         switch ( $column_name ) {                             case "cb":  echo ''.$this->column_cb(stripslashes($rec->id)).'	'; break;                             case "col_name":    echo ''.$this->column_title(stripslashes($rec->product_name_name)).'	'; break;                         }                  }                         echo'
';             }          }      }      The same problem happens if I try to pass the value name to `column_title()`. `column_title()`:               function column_title($item){         $actions = array(                          'edit'      => sprintf('Edit',$_REQUEST['page'],'edit',$item['ID']),                          'delete'    => sprintf('Delete',$_REQUEST['page'],'delete',$item['ID']),             );                 //Return the title contents            return sprintf('%1$s %3$s',                 /*$1%s*/ $item['product_name'],                 /*$2%s*/ $item['id'],                 /*$3%s*/ $this->row_actions($actions)             );         }


wordpress add field to post_class

I need to add a custom field to my article post but not sure how to add an additional class to it. Currently the classes get pulled through like this `<?php post_class($classes); ?>`. However I need to add a custom field to this as well. To demonstrate ive added a class= but this doesnt work as class= is being added twice.               <?php post_class($classes); ?> class="<?php the_field( "size" ); ?>      So i need post_class and the_field to work together.


Add section (add_settings_section) to a custom page (add_submenu_page)

I have a plugin page created with add_submenu_page. I want to add a new section there but nothing happens:               add_submenu_page('parent', 'Foo', 'Foo', 'manage_options', 'foo-settings', 'anothercallback');     add_settings_section('foo-settings-section', 'Settings', 'acallback', 'foo-settings');      What's the right call to use it in a custom page? Do you have a complete example? Thanks.


Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?

I would like to style the attachment page for each gallery differently, but i'm not sure how (sorry for the noob question, i'm still new to wp development!). I was hoping i could use Attachment.php for one and Image.php for the other, but Image.php overrides both because both are simply Galleries of images. I suppose i might have to add some sort of Else IF type statement to attachment.php, which would sub-divide the galleries...but in that case i'm not sure how i can have the .php distinguish between each one. any and all help here would be much appreciated! thanks, eric


Get Each user recent post in wordpress

I have a Multi Author Blog, I want to show Recent post of each user / author. Image has been attached for more convenient, see the Red selected area where author's recent post is showing. ![Author Recent post](http://i.stack.imgur.com/1B1IO.png)


Display Custom comments field number

I have some custom comments fields, I need to display the number of times that a meta value is used Example : I have a custom comments field "Do you like this post" with multiple choice :   * Yes    * No I need to display how much person say "Yes", how much say "No" for each post, It's an example. Don't tell me to use "post rating" plugins ;)


WordPress adding <br> tags into plugin content

We've written a plugin that shows reviews upon usage of a shortcode. On some sites, Wordpress is adding `<br>` tags throughout the shortcode content, and others it does not. The shortcode works here (Nearby Now). The shortcode has tags inserted here (Dent Biz). There's a couple of articles here and here that recommend adding tho following code to the functions.php file.               remove_filter( 'the_content', 'wpautop' );     add_filter( 'the_content', 'wpautop' , 12);      I've tried this on the 2nd site above (Dent Biz), but it doesn't fix the problem. Also, I've tried disabling all other plugins on the site with no success. I would hope there was an easy way to prevent WordPress from molesting the html returned by the plugin. Any help would be appreciated!


Function to prevent users from trashing comments

Is there any way to prevent/hide trash button for comments? Note that I only want to prevent users from emptying the trash for comments. Can't seem to find a way. Is there any possible way to do that without plugin? But if I have to, I'll use a plugin. This is what I've tried so far, but not getting it to work.               add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );     function remove_row_actions( $actions )     {         if( get_post_type() === 'post' )             unset( $actions['edit'] );             unset( $actions['view'] );             unset( $actions['trash'] );             unset( $actions['inline hide-if-no-js'] );              return $actions;     }


Passing multiple variables through url (php)

I'm trying to pass two values to another page. Both pages are WordPress page templates. First, I pass the value as such:               <tr onclick="window.location.href='http://www.areal-agro.nl/tool/?page_id=780&user=<?php                  urlencode( the_title() );             ?>&aanvraag=<?php                  echo urlencode($current_aanvraag) ;             ?>'">      Then, in the other file, I accept these two variables               $doorgekregenuser = $_GET['user'];         if ($doorgekregenuser != ''){             $doorgekregenuser = urldecode($doorgekregenuser);             update_usermeta( $current_user->id, 'current_user', $doorgekregenuser );         }         if ($doorgekregenaanvraag != ''){             $doorgekregenaanvraag = urldecode($doorgekregenaanvraag);             update_usermeta( $current_user->id, 'current_aanvraag', $doorgekregenaanvraag );         }      If I only try to pass the user variable it works. When I add the second one it won't work anymore. If I echo the second value on the page, it says:               aanvraag van Geling H. te Oploo op 6 februari 2013 om 11:16 op 14 maart 2013 om 11:17      When I encode it, it passes this in the url:               http://areal-agro.nl/tool/?page_id=780&user=Geling%20H.%20te%20Oploo%20op%206%20februari%202013%20om%2011%3A16&aanvraag=aanvraag%20van%20Geling%20H.%20te%20Oploo%20op%206%20februari%202013%20om%2011%3A16%20op%2014%20maart%202013%20om%2011%3A17      Every time I try this, it sends me to a 'Page not found'-page. Any suggestions on how I might be on the wrong track?


Could use some help with Shortcodes

So I am starting with shortcodes and this is my first time trying to make one, I am using it to make css/js tabs for information and basing off code I got from themeforest.. So I will do the best to explain what I have and what I am trying to do. * * * ## HERE is what my short code looks like               [tabs]     [tab title="This is tab 1 Title"]Tab 1 Content [/tab]     [tab title="This is tab 2 Title"]Tab 2 Content [/tab]     [tab title="This is tab 3 Title"]Tab 3 Content [/tab]     [tab title="This is tab 4 Title"]Tab 4 Content [/tab]     [/tabs]      ## HERE is the code I am using to make the tabs                /* -----------------------------------------------------------------             Tab     ----------------------------------------------------------------- */                // Set up Scripts For Tabs       function add_tabs_scripts_to_head(){         wp_register_script( 'custom-script', get_template_directory_uri() . '/js/zozoTabs.js' );         // For either a plugin or a theme, you can then enqueue the script:         wp_enqueue_script( 'custom-script' );     }           // Set up Style For Tabs       function add_tabs_style_to_head(){         wp_register_style( 'custom-style', get_template_directory_uri() . '/css/zozoTabs.css');         // For either a plugin or a theme, you can then enqueue the style:         wp_enqueue_style( 'custom-style' );     }          add_action('template_redirect', 'add_scripts');           extract(shortcode_atts(array(             'style' => false,             'orientation' => false,         ), $atts));          function add_scripts() {         global $wp_query;         if ( is_singular() ) {            $post = $wp_query->get_queried_object();            if ( false !== strpos($post->post_content, '[tabs') ) {            // Adding the style JUST when needed           add_action( 'wp_enqueue_scripts', 'add_tabs_style_to_head' );           add_action( 'wp_enqueue_scripts', 'add_tabs_scripts_to_head' );           }         }      }     add_shortcode('tabs', 'ts_tab');         function ts_tab($atts, $content = null, $code) {         if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $count)) {             return do_shortcode($content);              } else {             for($i = 0; $i < count($count[0]); $i++) {                 $count[3][$i] = shortcode_parse_atts($count[3][$i]);     }     $output = '

     ';               for($i = 0; $i < count($count[0]); $i++) {             $output .= '
' . $count[3][$i]['title'] . '
';         }         $output .= '
';              $output .= '
';         for($i = 0; $i < count($count[0]); $i++) {             $output .= '
' . do_shortcode(trim($count[5][$i])) . '
';         }         $output .= '
';         return '
' . $output . '

         ';}     }      And a pastebin of the same: http://pastebin.com/wZ6VRPwm * * * So all of that works just fine, but what I am trying to do is make it so I can make my short code start out like this               [tabs orientation="vertical"]      and it will add `orientation: "vertical"`, to line 52 of the pastebin to make it look like this                     * * * So that is the problem, and I have tried about all I can think of and search but an getting no where.


Is it possible to remove the word "date" from archives?

I can't figure out how to remove the word "date from the permalink for yearly archives. For example: [http://localhost/wordpress/news/date/2012] On single news pages the permalink looks like this: [http://localhost/wordpress/news/2012/news-article/] I've created a custom post type called "News". The slug for this post_type is obviously "news". I've set 'archive' to true and 'with_front' to false. I want a clean News Archive which can be broken down by years. I tried a different solution, but it posed problems. I set the 'archive' to false and created a News page with a custom template, for current News Articles. I then created child pages for each year's News Articles, but Wordpress added -2 to the permalink.. For example: 2012 = news/2012-2 I just want my permalinks to be like this: news news/2012 news/2012/news-item I've tried a few plugins but nothing seems to work. Any Ideas?


Limit number of users a role can create

Just wondering if there is a way to limit the amount of users a specific role can create? For example, if Editors can create new accounts, I only want them to be able to create 20, and then they can't create any more... I've Googled and all I seem to get is limit the amount of posts a role can create. Not what I want... Thanks


Redirect to a file in a WordPress theme directory

I have a site where http://mysite.com/wp-content/themes/mytheme/pdf.php creates a pdf of some content based on what's in a cookie. That URL is pretty ugly. I'd love the url to simply be http://mysite.com/pdf. I've tried to use mod_rewrite with no success. E.g. In my .htaccess file I have: `RewriteRule ^/pdf$ http://mysite.com/wp-content/themes/mytheme/pdf.php` This just returns a 404. Any ideas what I might be doing wrong? Thanks.


Why do I have to specify all parameters for wp_enqueue_script to load my jquery in the footer?

wp_enqueue_script('jquery', includes_url() . 'js/jquery.js', array(''), '1.7.2', true); // loads in the footer          wp_enqueue_script('jquery','', array(''), '', true); // loads in the head      I just think it seems like backwards development to have to include a non-null value for each parameter to get the script to load where I want it to.


Show list of Search results in Admin

Having spoken to someone this morning about "Zero result searches", I was wondering how easy it would be to have a page in the admin that lists all the searches that have happened on your site (using the search form). Has anyone had any experience with this kind of information? I'm not even sure if wordpress' search can be stored to a log / database for the admin to read from, or if a custom search plugin would be needed. If anyone has any thoughts on this, or has tackled this issue before, I'd love to know the results.


add_rewrite_rule not registering on Multisite

I have a multisite install of WordPress. I have installed the plugin Monkeyman Rewrite Analyzer so I can see all the rules I have registered. The code below is how I am registering the rule:                add_action( 'init', 'add_init_rules' );           function add_init_rules() {          add_rewrite_rule('^car/([^/]*)/([^/]*)/?','index.php?pagename=car&id=$matches[1]&make=$matches[2]','top');      }      The rule I have added does not appear in the Monkeyman Rewrite Analyzer list and does not appear to make any difference to the site when trying to visit mysite.com/32423/testmake Any suggestions?


One custom loop with condition to check child posts

I have one loop of pages with 999 page ID as a parent (pages from this loop have also another child pages)               $args = array(      'post_type' => 'page',     'post_parent' => 999,     'order' => 'ASC',     'posts_per_page' => -1     );     $loop = new WP_Query( $args );      Now I want to get the pages, but with condition, when the page in the loop have child pages I would like to display another structure.               <?php if ( have_posts() ) : ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>            <?php if (condition if current post have subpages ) : ?>                 //  html structure,             <?php else : ?>                 // another default structure            <?php endif; ?>         <?php endwhile; ?>     <?php endif; ?>      I've tried with get_page_children, but with no success, I need only the proper condition. Thanks in advance for any help.


Custom wp_bootstrap_navwalker file

I got a little problem right here. So I installed the wp_bootstrap_navwalker and it works so far. I got a 3 stage Navigation. The problem is that the navwalker adds the dropdown-menu class to every single child element. But I need it to be like this (main navigation in the header section): http://www.dotsource.de/ So the third child should not have the dropdown class and should always be visible. Do you know how I can remove the class attribute from only the third child element? I tried to google it but I think my problem might be too specific.


Wordpress admin WP_table_list show incorrectly

![enter image description here](http://i.stack.imgur.com/Ut0r9.png) As the image above, my custom wp_list_table didn't show correctly. Code as below               <?php     if ( !class_exists( 'V2OMLVG_Video_Table' ) )     {         class V2OMLVG_Video_Table extends WP_List_Table         {             function __construct ()             {                 parent :: __construct (                     array(                         'singular'  => 'wp_list_video',                         'plural'    => 'wp_list_videos',                         'ajax'      => false                     )                 );             }                  function get_columns()             {                 return $columns = array(                     'cb'                        => '<input type="checkbox" />',                     'col_id'                    => __('ID'),                     'col_video_title'           => __('Video Title'),                     'col_video_description'     => __('Video Description'),                     'col_created_time'          => __('Created'),                     'col_updated_time'          => __('Updated'),                     'col_last_modified_user'    => __('Last Modified User'),                     'col_video_type'            => __('Video Platform'),                 );             }                  function column_cb($item) {                 return sprintf(                     '<input type="checkbox" name="id[]" value="%s" />', $item['id']                 );                 }                  function col_video_title ($item, $column_name)             {                      var_dump($item);                 $actions = array(                     'edit'      => sprintf('Edit', 'v2omlvg_edit_video', $item['ID']),                     'delete'    => sprintf('Delete', 'v2omlvg_edit_video', 'delete', $item['ID']),                 );                      return sprintf('%1$s %2$s', $item['video_title'], $this->row_actions($actions) );             }                  function get_bulk_actions() {                 $actions = array(                     'delete'    => 'Delete'                 );                 return $actions;             }                  public function get_sortable_columns ()             {                 return $sortable = array(                     'col_video_title'           => array('video_title', false),                     'col_created_time'          => array('created_time', false),                     'col_updated_time'          => array('updated_time', false),                     'col_video_type'            => array('video_type', false)                 );             }                  function prepare_items ()             {                 global $wpdb, $_wp_column_headers;                 $screen = get_current_screen();                      $table_name = $wpdb -> prefix . 'v2omlvg_video_gallery';                      /* -- Preparing your query -- */                 $query = "SELECT * FROM {$table_name}";                      $where = !empty( $_GET['v_type'] ) ? " WHERE video_type='" . mysql_real_escape_string( $_GET["v_type"] ) . "'" : "";                 $query .= $where;                 /* -- Ordering parameters -- */                 //Parameters that are going to be used to order the result                 $orderby    = !empty( $_GET["orderby"] ) ? mysql_real_escape_string( $_GET["orderby"] ) : 'updated_time';                 $order      = !empty( $_GET["order"] ) ? mysql_real_escape_string( $_GET["order"] ) : 'ASC';                 if ( !empty( $orderby ) & !empty( $order ) )                     $query .= ' ORDER BY ' . $orderby. ' ' . $order;                      /* -- Pagination parameters -- */                 //Number of elements in your table?                 $totalitems = $wpdb -> query ( $query ); //return the total number of affected rows                 //How many to display per page?                 $perpage = 20;                 //Which page is this?                 $paged = !empty( $_GET["paged"] ) ? mysql_real_escape_string( $_GET["paged"] ) : '';                 //Page Number                 if( empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }                 //How many pages do we have in total?                 $totalpages = ceil($totalitems/$perpage);                 //adjust the query to take pagination into account                 if( !empty($paged) && !empty($perpage) ){                     $offset = ($paged - 1) * $perpage;                     $query.=' LIMIT ' . (int) $offset . ',' . (int) $perpage;                 }                      /* -- Register the pagination -- */                 $this->set_pagination_args( array(                     "total_items" => $totalitems,                     "total_pages" => $totalpages,                     "per_page" => $perpage,                 ) );                 //The pagination links are automatically built according to those parameters                      /* -- Register the Columns -- */                 $columns = $this->get_columns();                 $hidden = array();                 $sortable = $this->get_sortable_columns();                 $this->_column_headers = array($columns, $hidden, $sortable);                      /* -- Fetch the items -- */                 $this->items = $wpdb->get_results($query);                 // echo $query;             }                  function display_rows() {                      //Get the records registered in the prepare_items method                 $records = $this->items;                      //Get the columns registered in the get_columns and get_sortable_columns methods                 list( $columns, $hidden ) = $this->get_column_info();                      //Loop for each record                 if(!empty($records)){                     foreach($records as $rec){                              //Open the line                         echo '
id.'">';                         foreach ( $columns as $column_name => $column_display_name ) {                             //Style attributes for each col                             $class = "class='$column_name column-$column_name'";                             $style = "";                             if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"';                             $attributes = $class . $style;                                       $wp_userdata = get_userdata( $rec->user_id );                                  $video_desc = $rec->video_description;                                  if( strlen ( $video_desc ) >= 50 )                                  $video_desc = substr($video_desc, 0, 50) . '...';                                  //Display the cell                             switch ( $column_name ) {                                 case 'col_id':  echo ''.stripslashes($rec->id).'	';   break;                                 case 'col_video_title': echo ''.stripslashes($rec->video_title).'	'; break;                                 case 'col_video_description': echo ''.stripslashes($video_desc).'	'; break;                                 case 'col_created_time': echo ''.$rec->created_time.'	'; break;                                 case 'col_updated_time': echo ''.$rec->updated_time.'	'; break;                                 case 'col_last_modified_user': echo ''.$wp_userdata->user_login.'	'; break;                                 case 'col_video_type': echo ''.$rec->video_type.'	'; break;                             }                         }                              //Close the line                         echo'
';                     }                 }             }         }     }     ?>


Wordpress Login Footer URL

I want to change the url of the Wordpress 'Back to XXXX' on the wordpress url. I've used this function to change the logo url, but there doesnt seem to be a footerurl reference.               add_filter( 'login_headerurl', 'custom_login_header_url' );     function custom_login_header_url($url) {       return 'http://www.myurl.com/';     }      Any ideas how I can change this url with a filter? My wordpress installation is a micro-site sitting under a main site, which is why I want it to go to a different url that `home_url`.


Pagination doesn't work on multiple categories

I have the following problem. In my custom menu (`wp_nav_menu`) I added a category. This category uses the template `category.php`. Now I have multiple categories that are shown on the page. My problem is that the pagination doesn't work. It shows the link en all but page/2/ display's an 'page not found'-page. I have no idea what I'm doing wrong. See my code:               <?php             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // allow for pagination             $getcat = query_posts('category_name=array("cat1", "cat2", "cat3","cat4","cat5","cat6")');              $args = array (                 $getcat,                 'posts_per_page' => 5,                 'paged' => $paged             );             query_posts($args);         ?>         <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<?php the_title(); ?>

<?php the_excerpt(); ?>
         <?php endwhile; ?>

<?php previous_posts_link('« recent', 0); ?>

<?php next_posts_link('older »', 0); ?>

         <?php else : ?>         <?php endif; ?>       Hope anyone can tell me where I went wrong M.