Split custom post list into two columns

can anyone help me split this custom post type into two lists? i'm a novice PHPr but have been left with this code by someone who said it was too complicated...               function listforcontinent($name, $top = false){         // top=true - show name, no columns         // top=false - dont show name, columns              $slugname = sanitize_title($name);         $args = array('tax_query' => array(array(                                                       'taxonomy' => 'jurisdiction_continents',                                                  'field' => 'slug',                                                  'terms' => $slugname)),                                                   'post_type' => 'jurisdiction',                                                  'orderby' => 'title',                                                   'posts_per_page' => 35,                                                  'order' => 'ASC');              $postslist = get_posts( $args );         if ($postslist) {             if($top) echo '
'.$name.'
';             echo '
';             foreach ( $postslist as $post ) {                 setup_postdata($post);                 echo '
ID).'">'.get_the_title($post->ID)."
";             }             echo '
';         }else{             if($top) echo '
'.$name.'
';         }                                    }      any help would be most appreciated, thanks :)


weekly archive for custom category

` <?php $args = array( 'cat' => '2', ); ?>` `<?php wp_get_archives($args); ?> ` I pull out the custom category with the above codes, it works fine & shows up "February 2013". here, My question is can I display it in "weekly". I put (type = weekly) in $args . but it displays weekly posts archive, not the category. my question is almost same with this question. How would you create a "weekly" archive? it seems the questioner didn't get a clear answer yet. I'm also looking for the answer.. if someone could help me. thanks in advance


theme & plugin customisation

I need to modify a theme quite a bit. I think it goes further than just templating. I need to add extra fields to a form and obviously then have the info captured by the system and be retrievable etc. I also have to modify the product display page also. what's my best path here. I am a developer and have built WP sites before from scratch, but never had to modify another theme quite this much before. Would I be using some kind of include system? The theme/plugin I am needing to modify is classifiedEngine. I need to add form elements to the post add form. I can do the html bit fine it looks great, but obviously its not capturing any of the data. I know what files I need to modify, but then what does my client do about updates? I need some general advise about theme/plugin modding at this kind of level - some further reading pointers also would be fine (although deadline is approaching!!).


Meteor Slides as header only for homepage and Use featured image of each page as header for respective pages

I am using meteor-slides plugin to make header as a slideshow. I am using twenty-eleven theme. Now i need to make this slideshow for my homepage only and featured images of other pages as headers for the respective pages. Can anyone help me with this?


plugins_url() works everywhere but wp_reqister_script()

So I should probably mention up front that I'm developing a plugin so my url is 'mysite.com/plugin' (Just in case this is related to my issue. So, In my main plugin file (myplugin.php) I have added the following:               $plugin_url = plugins_url('/my-plugin-directory/');      immediately followed by               wp_enqueue_style('wp_enqueue_scripts', $plugin_url . 'css/boxes.css');      Great, so far so good. The plugin url is properly concatenated and the script is added to the page and appears in the source as               <link rel='stylesheet' id='wp_enqueue_scripts-css'  href='http://mysite.com/plugin/wp-content/plugins/my-plugin-directory/css/mystyle.css?ver=3.5.1' type='text/css' media='all' />      at this point I can even `echo $plugin_url;` which returns:               http://mysite.com/plugin/wp-content/plugins/my-plugin-directory/       Directly below that I have written the following function:               add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);         function my_jquery_enqueue()    {             wp_enqueue_script('jquery');             wp_register_script('jquery_masonry', $plugin_url.'js/jquery.masonry.min.js', array('jquery'), '2.0.110526' );             wp_enqueue_script('jquery_masonry');         }      Should work right? It doesn't. Instead, in the source it looks like this:               <script type='text/javascript' src='http://georgespake.com/pluginjs/jquery.masonry.min.js?ver=2.0.110526'></script>      Boooo... So for the time being, I just wrote it out:               /****Add jquery stuff to header****/     add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);         function my_jquery_enqueue()    {             wp_enqueue_script('jquery');             wp_register_script('jquery_masonry', $plugin_url . '/wp-content/plugins/my-plugin-directory/js/jquery.masonry.min.js', array('jquery'), '2.0.110526' );             wp_enqueue_script('jquery_masonry');         }      This feels sloppy though because this is the only place I have to do this. Everywhere else, the `$plugin_url` seems to return the proper string. What am I missing here?


Date Archive pages 404 error

I am building my own theme and realized that all date archive pages (all date, month and year) are throwing a 404 (its a locally hosted site). Its not theme specific as I thought earlier, because I thought its happening because of a custom post template I created. But when I changed the theme to twentythirteen (latest version), the same thing happened. My wordpress is also at its latest version and permalink settings are set to: http://domain.name/sample-post/ I will really appreciate your thoughts on this! **UPDATE1:** I changed to the default permalink structure and it works. Daily archive link now is: http://domain.name/?m=20140505 and its not giving a 404. BUT if I change back to the %postname% permalink structure   1. I installed URL Rewrite Module and did the mod_rewrite changes in web.config. still getting a 404   2. Then I added these rules to my .htaccess(I had to create it, as per wordpress codex instructions): #BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress Still got a 404.   3. I am asked to remove write access on web.config file. So I did that by manually removing write access in the file's properties (right click a file->properties->permissions...). Still getting a 404! here's my web.config now:                <?xml version="1.0" encoding="UTF-8"?>      <configuration>      <system.webServer>      <rewrite>      <rules>      <rule name="WordPress Rule" stopProcessing="true">       <match url=".*" />      <conditions>      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />      </conditions>      <action type="Rewrite" url="index.php?page_id={R:0}" />      </rule>      </rules>      </rewrite>      </system.webServer>      </configuration>      Please share if I am doing something wrong here. Will much appreciate your response!


Display and register custom categories for custom post types

Ok here we go. I have 2 different custom post types. The first is called 'portfolio', the second one 'games'. All the game reviews I write are 'games' posts. To have a better overview I created custom categories like reviews, playstation xbox etc. Unfortunately everytime I would like to display the posts of one categorie (http://www.zock- around-the-clock.com/games_category/testcategory) I just get an 404 Error Page. I dont really use the 'portfolio' posts but with them the arrengement into categories would work just perfectly. (http://www.zock-around-the- clock.com/portfolio-view/testcategory). I would like to ask you what is the difference between these two types and why is it working with the portfolio posts but not with the games posts. I also tried adding normal categories into the games posts by adding `'taxonomies' => array('category'),` but unfortunately it is still not possible to display the games posts of a single category. Here's the single-portfolio.php               <?php get_header(); ?>          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>     <?php       $custom = get_post_custom($post->ID);       $lightbox = $custom["lightbox-url"][0];     ?>     <div id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>

<?php the_title(); ?>

        <?php if(has_post_thumbnail()) {                     echo '

'; the_post_thumbnail(''); echo '

';                     }                 ?>           <?php the_content(); ?>           <?php wp_link_pages('before=
&after=
'); ?>

          <?php comments_template( '', true ); ?>      and the init. for the portfolio posts:               function my_post_type_portfolio() {     register_post_type( 'portfolio',                 array(                  'label' => __('Portfolio'),                  'singular_label' => __('Porfolio Item', 'theme1575'),                 '_builtin' => false,                 'public' => true,                  'show_ui' => true,                 'show_in_nav_menus' => true,                 'hierarchical' => true,                 'capability_type' => 'page',                 'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',                 'rewrite' => array(                     'slug' => 'portfolio-view',                     'with_front' => FALSE,                 ),                 'supports' => array(                         'title',                         'editor',                         'thumbnail',                         'excerpt',                         'custom-fields',                         'comments')                     )                  );     register_taxonomy('portfolio_category', 'portfolio', array('hierarchical' => true, 'label' => 'Portfolio Categories', 'singular_name' => 'Category', "rewrite" => true, "query_var" => true));}add_action('init', 'my_post_type_portfolio');      Here's the single-games.php               <?php get_header(); ?><div id="content" class="grid_8 <?php if (of_get_option('blog_sidebar_pos') == "right" ) {echo "alpha";} else {echo "omega";} ?> <?php echo of_get_option('blog_sidebar_pos') ?>">     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>     <div id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
             <?php $post_meta = of_get_option('post_meta'); ?>             <?php if ($post_meta=='true' || $post_meta=='') { ?>
                     <?php _e('Geposted am', 'theme1575'); ?> <?php the_time('j. F, Y'); ?> <?php _e('by', 'theme1575'); ?>  <?php the_author_posts_link() ?>
             <?php } ?>

         <?php if(has_post_thumbnail()) {                     echo '

'; the_post_thumbnail(''); echo '

';                     }                 ?>           <?php the_content(); ?><?php wp_link_pages('before=
&after=
'); ?>

                            <?php /* If a user fills out their bio info, it's included here */ ?>

<?php _e('Written by', 'theme1575'); ?> <?php the_author_posts_link() ?>

<?php if(function_exists('get_avatar')) { echo get_avatar( get_the_author_email(), '80' ); /* This avatar is the user's gravatar (http://gravatar.com) based on their administrative email address */  } ?>

           <?php the_author_meta('description') ?>

<?php _e('View all posts by:', 'theme1575'); ?> <?php the_author_posts_link() ?>

         <?php previous_post_link('%link', __('« Previous post', 'theme1575')) ?>

         <?php next_post_link('%link', __('Next Post »', 'theme1575')) ?>
           and the init. for the games posts:               function my_post_type_games() {     register_post_type( 'games',                 array(                  'label' => __('Games'),                  'taxonomies' => array('category'),                 'public' => true,                  'query_var'=> true,                  'publicly_queryable'=> true,                 'show_ui' => true,                 'show_in_nav_menus' => false,                 'menu_position' => 5,                 'rewrite' => array(                     'slug' => 'games-view',                     'with_front' => true,                     'hierarchical' => true,                 ),                 'has_archive' => true,                 'supports' => array(                         'title',                         'author',                         'thumbnail',                         'revisions',                         'comments',                         'editor',                         'excerpt')                     )                  ); register_taxonomy('games_category', 'games', array('hierarchical' => true, 'label' => 'Games Categories', 'singular_name' => 'Category', "rewrite" => true, "query_var" => true)); } add_action('init', 'my_post_type_games');?>


Custom post type and taxonomy - show related posts

I have a Projects custom post type with a custom taxonomy of Services. Each project can have multiple services ticked. On the project page I am using the following code to pull back related projects                   <?php     //for in the loop, display all "content", regardless of post_type,     //that have the same custom taxonomy (e.g. genre) terms as the current post     $backup = $post;  // backup the current object     $found_none = '';     $taxonomy = 'services';//  e.g. post_tag, category, custom taxonomy     $param_type = 'services'; //  e.g. tag__in, category__in, but genre__in will NOT work     $post_types = get_post_types( array('public' => true), 'names' );     $tax_args=array('orderby' => 'none');     $tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);          if ($tags) {     echo "
";     echo "
";     echo "
Related projects
";     echo "
";       foreach ($tags as $tag) {         $args=array(           "$param_type" => $tag->slug,           'post__not_in' => array($post->ID),           'post_type' => $post_types,           'showposts'=>3,           'caller_get_posts'=>1         );         $my_query = null;         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {           ?>           <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
               <a href="<?php the_permalink(); ?>">                 <img src="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 315,225 ), true, '' ); echo $src[0]; ?>" />
<?php the_title(); ?>
                 <?php the_field('client'); ?>
                   <?php $found_none = '';           endwhile; ?>                <?php         }       }       echo '
';       echo "
";       echo "
";     }     if ($found_none) {     echo $found_none;     }     $post = $backup;  // copy it back     wp_reset_query(); // to use the original query again     ?>      Initially it looked like it was working fine but on closer inspection if a project has more than one service then it is duplicating the posts that are pulled back. So any tips? Is there a better way to pull back related posts (by taxonomy) and how do I stop the duplication of results? Thanks!


Search within table?

I have a nice plugin that is called Select WP-Table Reloaded and that works well, except the contents don't show up in a useful manner. The page the table is embedded shows up in a search, but not the specific term.   Is there any way to remedy this?   This is the page the table is embedded in: http://henschelhausbooks.com/authorsbooks/ If you were to search for an author, like "Baake", only the page with the short blurb would show up.


Comment Approval Message Showing to All Users

I'm using a custom function to output comments. It seems to work fine, however I've added the following notice for when comments are yet to be approved: `<p class="awaiting-approval">New comment is awaiting approval</p>` However, rather than this just showing to the comment author, it seems to be showing to everyone. Is WP supposed to use cookies to determine who the author was? Here is the full code for the function if that helps: http://pastebin.com/Wrs3LaZ7               <?php         function theme_commentCustom( $comment, $args, $depth ) {             $GLOBALS['comment'] = $comment;             switch ( $comment->comment_type ) :                 case 'pingback' :                 case 'trackback' :     ?>

<?php _e( 'Pingback:', 'customtheme' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'customtheme' ), '
', '
' ); ?>
     <?php                     break;                      default :     ?>                     <li id="li-comment-<?php comment_ID(); ?>" class="grid_6">
                             <?php if ( $comment->comment_approved == '0' ) : ?>
New comment is awaiting approval
                             <?php else : ?>

<?php echo get_comment_text(); ?>

<?php comment_author(); ?>

                             <?php endif; ?>
     <?php                     break;             endswitch;         }     ?>      Also, I'm calling the function like so, in my WordPress comments file: http://pastebin.com/r4fweRQJ               <?php         // determine id depending on whether sidebar or member comments page         $id = 'feed-comments';         if ($post->ID != 9) {             $id .= '-sidebar';         }     ?>          <div id="<?php echo $id; ?>" class="feed-comments">         <?php if ( post_password_required() ) : ?>
<?php _e( 'This post is password protected. Enter the password to view any comments.'); ?>

         <?php             /* Stop the rest of comments.php from being processed,             * but don't kill the script entirely -- we still have             * to fully load the template.             */             return;             endif;         ?>              <?php             $comments = get_comments(array('post_id' => 9));             // limit comments if comments displaying in sidebar                  if (is_page(9)) {                 $args = array('callback' => 'theme_commentCustom');             } else {                 $args = array('callback' => 'theme_commentCustom', 'per_page' => 3);             }         ?>
             <?php                 /* Loop through and list the comments. Tell wp_list_comments()                 * to use theme_commentCustom() to format the comments.                 * If you want to overload this in a child theme then you can                 * define theme_commentCustom() and that will be used instead.                 * See theme_commentCustom() in customtheme/functions.php for more.                 */                 wp_list_comments( $args, $comments );             ?>
              <?php if (is_page(9)) : ?>             <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php next_comments_link( __( 'Older Comments →', 'customtheme' ) ); ?>

<?php previous_comments_link( __( '← Newer Comments', 'customtheme' ) ); ?>
                              <?php endif; // check for comment navigation ?>         <?php endif; ?>


wp_enqueue_script registers script but does not create html tag

I wrote a plugin that enqueues a script and stylesheet only on a specific admin page. It works in my dev environment and multiple production servers; however, was introduced recently to a site that is utilizing the plugin and it will not render the script or stylesheet tag to the page. Here is the code:               add_action( 'admin_enqueue_scripts', 'gf_notification_attachment_attach_script');     // actual function to enqueue     function gf_notification_attachment_attach_script(){         global $gf_notification_attachment;         $plugin = $gf_notification_attachment;         if( GFForms::get_page() == 'notification_edit'){             $script = $plugin->plugin_url . 'script';             $script .= ( WP_DEBUG ) ? '.js' : '.min.js';             wp_enqueue_script( $plugin->text_domain, $script, array('gform_gravityforms'), $plugin->version, true );             wp_enqueue_style( $plugin->text_domain, $plugin->plugin_url . 'style.css', array(), $plugin->version );                  }     }      I have inserted debug code to echo `$script` within the conditional in the function and it lists the path correctly. I also have dumped the global `$wp_scripts` var to the screen after calling the enqueue and see it listed correctly along with all the other scripts in the list. As a bit of further testing I confirmed the only 2 plugins active were Gravity Forms and my plugin (which is dependent on GF). I also activated the default 2014 theme. I also removed the dependance on the Gravity Forms (conditional check for admin page) and tried and it still will not render the script tag. I'm at a loss here as to what could be causing it to not show on this one site. Even `wp_enqueue_script` works within other plugins. Any ideas? If you wish to test the plugin and have "Gravity Forms" you can download and test the full code base yourself.


How to change the default post type over the loop?

I want to include some kinds of posts in the default query. When the loop begins:                       if ( have_posts() ) :                 // Start the Loop.                 while ( have_posts() ) : the_post();      the default type post is `'post'`, so other kind of posts won't enter the loop (e.g. I have a custom post type called `'news'`). I could use the WP Query object and do:                   $type = 'news';         $args = array ('post_type' => $type);         $temp = $wp_query; // assign ordinal query to temp variable for later use           $wp_query = null;              $wp_query = new WP_Query($args);            while ( $wp_query->have_posts() ) : $wp_query->the_post();      And this will work. But is there any way to just let other kinds of posts to the main query object to don't worry about changing the loop everywhere? **Edit:** I've also tried with `pre_get_posts` without success:               // Load Home Page Posts( reviews and news )     function search_home_posts( $query ) {         if( $query->is_home() && $query->is_main_query() && !is_admin() ) {             $query->set( 'post_type', array( 'reviews', 'news' ) );         }     }     add_action( 'pre_get_posts', 'search_home_posts' );      but doesn't do anything. I've tried more combinations like `$query->set( 'post_type', 'reviews' );`, but the same behavior. Any idea?


Remove meta info for one specific category on all posts in that category

As for the moment each post on my site http://wonderfulwanderings.com (hope this is okay, just want you to know what I'm talking about) is displaying which category it belongs to. I would like to make it so that if a post belongs to category X, that category does _not_ show in the meta info and when a post belongs to category x and category y, it only shows that the post belongs to category y. In other words: category x should only be a category for me to use 'in the background', without my readers being able to know it exists. Thanks!


Name Input from widget displays Sidebar name instead of saved data

I wasn't sure how to title this question,so I apologize. Let me first state that I have no experience with this type of code but I really need to this feature for my website, so I appreciate all the help anyone can provide! Anyway, I recently got a solution to a previous issue I had which can be found here// Create Image Uploader for Widget It worked perfectly, but the new* issue now is that I wanted to add a "Name" input and a way to display default text that would show up on the front end. I found a tutorial here// http://wp.tutsplus.com/tutorials/creative-coding/building-custom-wordpress- widgets/ it uses `if ( $name ) printf( '<p>' . __('Hey their Sailor! My name is %1$s.', 'example') . '</p>', $name );` to display the name. So I tried to add it into my functions.php. and came up with this//               // register sidebar     if (function_exists('register_sidebar')) {     register_sidebar(         array(         'name' => 'Left Sidebar',         'id' => 'left-sidebar',         'description' => 'Widget Area',         'before_widget' => '
',         'after_widget' => '
',         )     );     }          // register widget     add_action('widgets_init', 'eotw_widget');     function eotw_widget() {     register_widget( 'eotw_w' );     }          // add admin scripts     add_action('admin_enqueue_scripts', 'ctup_wdscript');     function ctup_wdscript() {     wp_enqueue_media();     wp_enqueue_script('ads_script', get_template_directory_uri() . '/js/ads.js', false,    '1.0', true);     }          // widget class     class eotw_w extends WP_Widget {          function eotw_w() {         $widget_ops = array('classname' => 'eotw-w');         $this->WP_Widget('eotw-w-widget', 'EOTW', $widget_ops);     }          function widget($args, $instance) {         extract($args);              // widget content         echo $before_widget;                   if ( $name )             printf( '
' . __('Hey there Sailor! My name is %1$s.', 'example') . '
', $name );     ?>         <img class="eotw-edit" src="<?php echo esc_url($instance['image_uri']); ?>" />          <?php         echo $after_widget;          }          function update($new_instance, $old_instance) {         $instance = $old_instance;         $instance['name'] = strip_tags( $new_instance['name'] );         $instance['image_uri'] = strip_tags( $new_instance['image_uri'] );         return $instance;     }          function form($instance) {     ?>
             <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Your Name:', 'example'); ?>             <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" />

         <label for="<?php echo $this->get_field_id('image_uri'); ?>">Image
              <?php             if ( $instance['image_uri'] != '' ) :                 echo '
';             endif;         ?>              <input type="text" class="widefat custom_media_url" name="<?php echo $this->get_field_name('image_uri'); ?>" id="<?php echo $this->get_field_id('image_uri'); ?>" value="<?php echo $instance['image_uri']; ?>" style="margin-top:5px;">              <input type="button" class="button button-primary custom_media_button" id="custom_media_button" name="<?php echo $this->get_field_name('image_uri'); ?>" value="Upload Image" style="margin-top:5px;" />
          <?php         }     }     ?>      The image is displayed on front end and so is// _Hey there Sailor! My name is._ But instead of the "name" inserted into the input field the "Left Sidebar" name is displayed instead. I'm not sure how to fix this. So my question is, where did I go wrong? What part of the code can I alter in order for the data from the name input to be displayed correctly instead of the name of the sidebar? Please Help.


Related post using post title

Is it possible to fetch related post based on post title rather than based on tags and category? Like-   post 1 title : WordPress tips   post 2 title : WordPress tricks   In this example the related post should be generated on keyword WordPress picked from title instead of pulling it from used tags or category it's posted into. Here is what i am using for now in functions.php               add_image_size( 'related', 100, 100, true );     add_action( 'genesis_after_post_content', 'child_related_posts' );     add_action( 'genesis_after_entry_content', 'child_related_posts' );          function child_related_posts() {          if ( is_single ( ) ) {              global $post;              $count = 0;         $postIDs = array( $post->ID );         $related = '';         $tags = wp_get_post_tags( $post->ID );         $cats = wp_get_post_categories( $post->ID );              if ( $tags ) {                  foreach ( $tags as $tag ) {                      $tagID[] = $tag->term_id;                  }                  $args = array(                 'tag__in'               => $tagID,                 'post__not_in'          => $postIDs,                 'showposts'             => 5,                 'ignore_sticky_posts'   => 1,                 'tax_query'             => array(                     array(                                         'taxonomy'  => 'post_format',                                         'field'     => 'slug',                                         'terms'     => array(                                              'post-format-link',                                              'post-format-status',                                              'post-format-aside',                                              'post-format-quote'                                             ),                                         'operator'  => 'NOT IN'                     )                 )             );                  $tag_query = new WP_Query( $args );                  if ( $tag_query->have_posts() ) {                      while ( $tag_query->have_posts() ) {                          $tag_query->the_post();                          $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '';                          $related .= '
' . $img . get_the_title() . '
';                          $postIDs[] = $post->ID;                          $count++;                 }             }         }              if ( $count <= 4 ) {                  $catIDs = array( );                  foreach ( $cats as $cat ) {                      if ( 3 == $cat )                     continue;                 $catIDs[] = $cat;                  }                  $showposts = 5 - $count;                  $args = array(                 'category__in'          => $catIDs,                 'post__not_in'          => $postIDs,                 'showposts'             => $showposts,                 'ignore_sticky_posts'   => 1,                 'orderby'               => 'rand',                 'tax_query'             => array(                                     array(                                         'taxonomy'  => 'post_format',                                         'field'     => 'slug',                                         'terms'     => array(                                              'post-format-link',                                              'post-format-status',                                              'post-format-aside',                                              'post-format-quote' ),                                         'operator' => 'NOT IN'                                     )                 )             );                  $cat_query = new WP_Query( $args );                  if ( $cat_query->have_posts() ) {                      while ( $cat_query->have_posts() ) {                          $cat_query->the_post();                          $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '';                          $related .= '
' . $img . get_the_title() . '
';                 }             }         }              if ( $related ) {                  printf( '

Related Posts

%s

', $related );              }              wp_reset_query();          }     }      Since i am using genesis theme i got limit room to edit files usually restricted to editing functions.php and style.css in child theme. Tried few other codes as well but this is closest i could get to things without plugin. The issue with this code is, it pull's related post based on tags rather then title of post.


Change page title in admin area

Is there someway to change the title in wp-admin? Been looking all over google but no one seem to mention it. I simply want to get rid of "-- WordPress" and possibly change the "‹" into some other symbol. Any ideas?


Call to undefined function get_current_screen() on my localhost

I'm using Wordpress 3.9.1 and I get the > Fatal error: Call to undefined function get_current_screen() if I put the following in my funcitons.php or in any file of my theme:               $screen = get_current_screen();     echo $screen;      Initially when I got the error, I was working on a theme that I'm creating. However, I tried this with few other themes including TwentyFourteen, and I still got the same error. I even deleted my Wordpress database, created a fresh one and re-installed Wordpress, but still it didn't help. I checked the `get_current_screen()` function by going to to wp- admin/includes/screen.php and it is there. I am working on Xampp and I don't have any plugins activated as it is a fresh install. Also in my wp-config.php I haven't changed anything but the 'MySQL settings' (database, username and password) and 'DEBUG mode'. Any suggestions on how to rectify this?


How do I get taxonomy terms by ID in a specific order. Below is my code and I thought if I passed `get_terms` the arguments to with ID and post_in but I am not seeing the results I thought I should.               $args_terms = array(                     'post_in' => array(47, 48, 49, 46 , 50, 5),                     'orderby' => 'post_in',                     'parent' => '0'                 );          $custom_post_type = 'menu-food';     $taxonomy = 'menu-food-categories';     $taxonomy_terms = get_terms( $taxonomy, $args_terms);


Is it bad not to cache only requests with the same URL as the site's site address?

I'm sort of new to WordPress and W3 Total cache? In setting up the page caching there is an option that reads "Cache requests only for my-site.com site address Cache only requests with the same URL as the site's site address." What does this mean and what is the down side or up side to checking it or leaving it unchecked. I know my site pulls in a few iFrames. Would his reduce the page load somewhat? Thanks


Extend WordPress 3.8 Site Activity Dashboard Widget to include more comments

The new Site Activity dashboard widget defaults to showing 5 comments. I'd like to show 10. I can see the code in core `/wp-admin/includes/dashboard.php` where it calls the function `wp_dashboard_site_activity`, and uses `wp_dashboard_recent_comments ( $total_items = 5 )`. But I don't know the syntax to hook into this function to update it. I know how to create a custom functionality plugin & edit `functions.php`, I'm just unsure of the syntax and/or hook to use. Any help is greatly appreciated. Thanks.


wp_head hook content showing up at top of RSS feed

The RSS feed for a site I maintain recently stopped working. I did a little investigating and found that the `wp_head` hook contents of several plugins is getting injected at the top of the page, causing an XML parse error (obviously). I'm really not sure what the problem is. I'm not really familiar with how WordPress generates its feeds, so I don't have much insight there. I recently upgraded the blog to 3.8, but the upgrade was done yesterday, and the guy who brought the issue to my attention made it sound like it had been going on for longer. I don't know for sure though, it certainly could be a 3.8 bug. I've tried different themes, tried disabling plugins. When every plugin is disabled, the feed works, because nothing is hooking onto the `wp_head` hook that's causing the problem.


Inserting A Feed and Sidebar into an HTML Page

I have a website I've built and the last step is to configure the blog page. My html and css is solid but my php and wordpress development knowledge is almost non-existent. I don't need a dynamic header or footer. All I need is a blog feed and a sidebar for recent items. Is it possible to take an existing blog's (using default wordpress 2014 theme) blog feed and recent items widget and insert it into a static html page? So whenever a person updates a blog the static page will be updated as well? Basically I need a user to be able to log into a blog with a default theme and make posts just as they would on a normal wordpress blog but for it to be updated to the static page I've created. Maybe this isn't even the right way to go about doing this. I know this is kind of a shortcut approach but I don't have much time to do an entire page with wordpress. If anyone has any information or suggestions or can just point me in the right direction I would really really appreciate it. Thanks in advance for anyone who takes the time to read this and comment :)


Login redirects to 127.0.0.1

In the past couple of hours, something very strange has started happening. I run about 10 WP sites and I am not able to log into the dashboards of any of them. Instead I am redirected to 127.0.0.1 or else shown a blank page. I have tried `/wp-login.php`, `/wp-admin.php`, `/wp-login`, and `/wp-admin`. I have tried going into phpMyAdmin and checking siteURL in `wp-options`, but these were set correctly. I have tried deleting the `.htaccess` file for some of them but this made no difference. I have tried renaming the plugins folder for some of them, but this also made no difference. I have contacted my hosting provider and asked if they are somehow blocking access. They say they are not. (I called them twice.) I have googled this all over the place and have not been able to find any solutions. I did install MAMP yesterday, but I have not used it to develop any of these sites. Some of these sites have been running for years without any problem. As I say, it started happening very suddenly with no changes having been made beforehand. I am freaking out and any help would be appreciated.


Creating an item to list Contributors in main menu

I'm trying to figure out if there is a way to create a dropdown menu item that would list contributors? The hope is whenever a contributor is added it would automatically add them to the list. I've been looking and can't seem to find a way to do this without actually entering them manually? If anyone knows, I would love the help!


NextGEN Conditional Statement

What I'd like to do is if the NextGEN gallery has more than one page (pagination) execute some code...I got close:               <?php         $nggpage  = get_query_var('nggpage');         if ($nggpage > 1) {             echo "duck";         }     ?>      This code appears on all pages but the first page, how do I make it work on the first page? Because if I use `$nggpage >= 1` it executes the code on all pages, even if there is no pagination...I want it to only execute the code if there is pagination. Any ideas?      Thanks,   Josh


Does search.php autofilter The Loop?

I just did a normal form that redirects the results from index.php to search.php, where I pasted the normal loop code of my index.php that displays the latest posts, and I noticed only the posts from my search query appears. I did not put any filters with $_GET in the loop, is it possible search.php automaticly filters the loop to get results that matches my search???


Can you get the themes options page to turn on/off which custom post types are registered?

I have a theme that is being used for a multisite installation that will be used by 6 sub-brands of an organization. Each sub-brand will only require some of the custom post types set up by the theme – thus I would like to hide the ones not needed. The theme has an options page where I can set a variable to state which brand is using the theme. Can I then get the functions.php to check what the variable has been set to and then register post types depending of this variable? eg. If the brandX then register post types A & C, if brandY then register post type B, if BrandC then register none.


Echo post title in post

I am looking to echo the post title at the beginning of each post. I've tried adding the following to `functions.php` with no luck:               function add_post_content( $content ) {         if ( ! is_feed() && ! is_home() ) {             $content .= '<p>.get_post('post_title').</p>';         }         return $content;     }     add_filter('the_content', 'add_post_content');      Should I be trying to update the `functions.php` file or `single.php`?


Undefined index error when saving content on metabox

I am trying to debug 'undefined index' errors on the WP backend when debug is set to TRUE. The offending lines are:                       if ( !wp_verify_nonce( $_POST['pdwt_meta_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }       Which I have then changed to check whether the value has been set by adding                   if ( isset( $_POST['pdwt_meta_noncename']) || ! wp_verify_nonce( $_POST['pdwt_meta_noncename'], plugin_basename(__FILE__) )) {     return $post->ID;     }      The later part makes the error disappear but when I enter information on the custom field it does not save. Here is how the post This is how the custom field has been set               echo '<input type="hidden" name="pdwt_meta_noncename" id="pdwt_meta_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';       Here is the save_post part               foreach ($pdwt_meta as $key => $value) { // loop through the $pdwt_meta array         if( $post->post_type == 'revision' ) return; // make sure the data isn't stored twice         $value = implode(',', (array)$value); // if $value is in an array, make it a comma seperated value         if(get_post_meta($post->ID, $key, FALSE)) { // if the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // AND IF IT DOESN'T ALREADY HAVE A VALUE             add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // DELETE IF IT'S EMPTY     }       } add_action('save_post', 'pdwt_save_meta', 1, 2); // SAVE THE CUSTOM FIELDS For info I did not write this specific part of the theme. Any thoughts on what could be wrong? Thank you.


$_SERVER['SERVER_NAME'] in WP_SITEURL

My client has two domains, and wishes to split a product catalogue over them. They want to have a shopping cart that is shared over both, i.e. a shared session over the two domains, this is solved in principle at least, and not the point of this question. Am using WooCommerce (no choice in this). Since the products need to available to be ordered in one transaction, they need to be in the same database, so I don't think a normal multisite install is going to work. I'm hoping therefore to be able to use a single WP install, and simply put `$_SERVER['SERVER_NAME']` in `WP_SITEURL` & `WP_HOME`. I've seen very few references to doing this, so I'm nervous about possible unforeseen consequences. Can anyone reassure me, or perhaps tell me why I shouldn't do this?


Find out total number of pages in global query on archive page?

I'm trying to find out whether there is more than one page of posts (I've set my posts per blog page to 5 in the reading settings) in a custom category template. I would think the global query would have the total number of pages as a property but I can't find the call to it.


PHP class to add pages and fields in admin panel

I'm trying to build a little class to help build some simple input fields into a custom page in WordPress admin panel, here's what I've got:               <?php          class create_panel {          public $default_settings = Array('blog_banner_image' => 'main.jpg');          public function set_ref_name( $str ) {         $this->ref_name = $str;      }          public function set_sidebar_title( $str ) {         $this->side_bar_title = $str;        }          public function create_panel() {         add_action('admin_menu', array(&$this, 'admin_menu'));         add_action('admin_head', array(&$this, 'admin_head'));         if ( function_exists( 'register_sidebar' ) )             register_sidebar( array( 'name' => 'Sidebar' ) );         if ( ! is_array( get_option( $this->ref_name ) ) )             add_option( $this->ref_name, $this->default_settings);         $this->options = get_option( $this->ref_name );     }          public function admin_menu() {         add_theme_page('Theme Control Panel', self::$this->side_bar_title, 'edit_themes', $array_name, array(&$this, 'optionsmenu'));     }          public function admin_head() {         echo '<link rel="stylesheet" href="' . get_bloginfo('template_url') . '/code/' . $array_name . '.css" type="text/css" media="screen" />';     }          public function set_input_fields( $array ) {         if( ! is_array( $array ) ) {             Throw new Exception('set_input_field() perams must be an array.');           }else{             foreach( $array as $input_arrays ) {                 if( count( $input_arrays ) != 3 ) {                     Throw new Exception('Perams must per input must total 3. input type, name and label');                   }else{                     $type = $input_arrays[0];                     $name = $input_arrays[1];                     $label = $input_arrays[2];                     if( ! isset( $this->inputs->{$name} ) ) {                         $this->inputs->{$name} = array( 'type' => $type, 'label' => $label );                     }else{                         Throw new Exception('Cannot redeclair input perams.');                       }                 }             }         }     }          public function optionsmenu() {         if ( $_POST['ss_action'] == 'save' ) {             if( isset( $this->inputs ) ) {                 foreach( $this->inputs as $name => $array ) {                     $this->options[(string)$name] = $_POST[$name];                   }                 update_option( $this->ref_name, $this->options );                 echo '

Settings saved.

';             }         }         ?>         <form action="" method="post" class="themeform">             <input type="hidden" id="ss_action" name="ss_action" value="save">
Edit Static Text
             <?php             if( isset( $this->inputs ) ) {                 foreach( $this->inputs as $name => $array ) {                     switch( $array['type'] ) {                         case 'text' :                             echo '
' . $array['label'] . '<input type="text" name="' . (string)$name . '" id="" value="' . $this->options[(string)$name] . '" />
';                         break;                       }                 }              }             ?>
<input type="submit" value="Save Changes" name="cp_save"/>
         </form>     <?php         }     }          try{         $cp = new create_panel();         $cp->set_ref_name( 'styles' );         $cp->set_sidebar_title( 'Edit Styles' );         $cp->set_input_fields( array( array( 'text','telephone','Telephone:' ) ) );     }catch(Exception $err){         die( $err->getMessage() );       }      it seems to work but then when i reload the page the data has not saved.


How to use HubSpot Forms API in Wordpress pages? I have to pass dynamic values to the Hubspot Form. Thanks in advance


Regarding post text filtering

What does this statement actually do?               $text = apply_filters('the_content', $text);      It follows only these ones:               $text = get_the_content('');          $text = strip_shortcodes( $text );      What filter(s) is applied here?


Problem with inserting Iframe in post_meta with Cron

I am trying to automatically post from Tumblr to Wordpress. I've made some scripts that enable Wordpress to put the first image of the content as Featured image and put the first `<iframe>` in post_meta table as video to display it in my theme. This script seems to be ok when i launched it manually. However, when i launch it with Cron, only half of it works. In fact, my post are added to wordpress and images are put as feature images but my iframes are not inserted into the post_meta table. I don't understand why ! I use WP-o-matic to post, and below is my code for auto-add videos in post_meta :               add_action('save_post', 'fetch_video');          function fetch_video( $post_ID )       {            $post = get_post($post_ID);           if(preg_match_all('/<iframe.*src=\"(.*)\".*><\/iframe>/isU', $post->post_content, $matches)){                  remove_action('save_post', 'fetch_video');                    $first_video = $matches[0];             $comma_separated = implode("", $first_video);                  // Update post by deleting video             $updated = preg_replace('/<iframe.*src=\"(.*)\".*><\/iframe><br\/><br\/>/isU', '', $post->post_content);                  // Replace the video in the post             wp_update_post(array('ID' => $post_ID, 'post_content' => $updated));                       //Check to make sure function is not executed more than once on save             if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )              return;                  if ( !current_user_can('edit_post', $post_ID) )              return;                  // Set the post format to image             set_post_format($post->ID, 'video' );                  $table = 'wp1_postmeta';                  global $wpdb; // the wordpress database object                  $last = wp_get_recent_posts( '1');             $last_id = $last['0']['ID'];             $id = $last_id;                  $comma_separated = implode("", $first_video);                  $sql = $wpdb->insert(                  $table,                  array(                      'post_id' => $id,                     'meta_key' => 'video',                     'meta_value' => $comma_separated                 )             );                  $wpdb->query($sql);                  // re-hook this function             add_action('save_post', 'fetch_video');         }          }      Thanks in advance


Custom rewrite rules for a $_GET request

Assuming I have this URL: `http://site.com/?get=something` How can I change it to a nice URL that looks like: `http://site.com/get_something` using WP's URL rewriting system?


can't use the page_test method to check pagination

I've tried to follow the example for Testing for paginated Pages but i don't know why it isn't working. i put it in the single.php file for post detection. i don't know why the page_test is broken. example code here:               <?php     get_header();     ?>
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

<fb:share-button href="<?php the_permalink(); ?>" class="url" type="button_count"></fb:share-button>
                  <?php                 $page_test = $wp_query->get( 'paged' );             if ( ! $page_test || $page_test < 2 ) {                      something here...                      <?php } else { ?>                      another here...                      <?php } ?>


What is the best way to output plugin result in certain url

Knowing that wordpress doesn't follow MVC pattern. What is the best way in worpress to output plugin's result in a certain url. lets say I would like to show "hello world" in main area under "www.example.com/show-hello-world" url. thanks. hope question is clear! more details: Let's say url "example.com/show-hello-world"   1. how could I specify template name, let's say "page" ?


Moving Wordpress to new server: no posts found

I have a weird problem with moving a Wordpress installation to a new server (just the server changes, domain remains the same, I'm currently accessing the site on the new server via the same domain and a hosts-file entry). Although the blog is displaying and I can access the admin area, there are no posts shown. The weird thing is, that the posts screen shows the correct statistics ("All (137) | Published (92) | Drafts (45)") but the posts table says "no posts found". On the frontend no posts are shown, but the "newer/older" links are shown and the archives list the months were posts were created. So it seems to find the posts, but somehow is missing some important information. I tried exporting/importing the DB with mysqldump/mysql on the command line and with phpmyadmin - same issue. Did anybody experience this problem before?


How Does Wordpress Uninclude/Deactivate A Plugin?

Wordpress uses the Observer Pattern for its plugin system and operates on the premise of checking if a plugin is activated, scanning the plugins directory and storing everything in an array in the plugins class. Once it gets the activated plugins, it then proceeds to include the plugin script files, however I am curious as to how Wordpress un-includes plugins when they are deactivated in the admin? If Wordpress is merely including the file via a standard include_once or require_once, how does Wordpress deactivate a plugin and therefore un-include it? It's from my understanding that you cannot include and then un-include a file in PHP (not that I know of). Can anyone point to me specific files where the plugins are included, and the appropriate functions and files where they are deactivated? If Wordpress is storing activated plugins in an array of activated plugins, then including them; how does Wordpress know not to let a function inside of a deactivated plugin be called if it's already included?


Get post ID outside of the loop

I am trying to accomplish something somewhat simple I think. I have a menu item at the top of my page that I want to link to the latest post in a certain category. I just need to get the post ID of the latest post in the category so I can pass it to the menu. I want to do this outside of the loop and create a function in functions.php that will return the post ID. Does anyone have any suggestions on how to do this?


add_rewrite_rule() vs $wp_rewrite->rules vs 'rewrite_rules_array'?

I've written Rewrite rules for my custom post types. they work well except that WP doesn't update the url in the User Agent when the redirect_url doesn't match the requested_url. everything else works great though including my custom permastructs ('post_type_link') and custom template options ('single-template'). my rules:               // custom URL rewrite for Album posts     add_action( 'init', 'gregory_rewrite_album_link' );     function gregory_rewrite_album_link()     {         // album--%album_slug%/ OR album/%album_slug%/         // preferred permastruct: album--%album_slug%/         add_rewrite_rule(             '^album(/|--)([^/]+)/?$',             'index.php?post_type=gregory-cpt-album&name=$matches[2]',             'top' );     }          // custom URL rewrite for Track posts     add_action( 'init', 'gregory_rewrite_track_link' );     function gregory_rewrite_track_link()     {         // accepts and rewrites the following permutations:         // where album would be: album--%album_slug% OR album/%album_slug%         // where track would be: track--%track_slug% OR track/%track_slug%         // preferred permastruct: album--%album_slug%/track--%track_slug%/         add_rewrite_rule(             '^(album(/|--)[^/]+/)?track(/|--)([^/]+)/?$',             'index.php?post_type=gregory-cpt-track&name=$matches[4]',             'top' );     }      I was wondering what the differences were between using add_rewrite_rule(), appending rules directly to $wp_rewrite->rules, and hooking into rewrite_rules_array? are there any differences? would one of the alternatives force WP to update the url in the User Agent when the targeted post's permalink differed to the requested url? one example of the url not updating... the album and track posts are linked by a mutual taxonomy term. the hook into 'post_type_link' for tracks finds the linked album and inserts its slug into the permalink. the Rewrite rules above make sure that both new and traditional permastructs work, but requesting this url `/album/serenity/track--beetle-attack/` will find the post but not update the url to `/album--serenity/track--beetle-attack/`. it's unlikely that anyone will use the traditional permastructs because I won't advertise them or use them in my site, but it'd be a nice extra to see the url's get updated in the User Agent anyway, if possible. cheers,   Gregory


Jetpack Publicize and Android

I'm using the Jetpack plugin's Publicize module to push out post links to Facebook and Twitter. This works fine through the normal website, but not when I write and publish a post through the Android app. I'm wondering if there's any way to get it to do so.


How can I make all gallery images to open in a new window?

How can I make all gallery images to open the high resolution image in a new window?


Database structure cheatsheet

I am trying to create a custom search page for a site I developed, but I lack the information needed to create the custom sql queries. Are there any useful resources you guys might know of?


Internationalization of Blog Posts

I have 4 domains all pointing to the same server with a server alias. They are like australia.com, america.com, china.com etc. So i have a domain for a couple of countries. I run a WordPress blog, but now I want to show certain blog posts on certain locale's or domains so to speak. Like the Americans wouldn't want to know about the things happening in Australia and vise versa. Is there a plugin to do this? I was thinking to just code a little block in the backend, witch check boxes with each domain, then when i generate the page, i just do an if statement on the $_SERVER array's. My only problem is i need todo this everywhere, sidebars, sitemaps etc, or is there a better solution?


How to update Post Meta values through the comment system

I'm working on allowing users to rate posts - through the comment meta. Storing and displaying individual ratings is working, however, I would like to be able to store the average rating in the post meta. I have this thus far, seem to get stuck on passing values to the post meta.               add_action( 'comment_post', 'add_av_rating', 1 );     function add_av_rating($comment_ID)     {                    $commentdata=get_comment($comment_ID, ARRAY_A);          $parent_post=get_post($commentdata['comment_post_ID']);         //get rating, get post meta & calc      update_post_meta($parent_post, 'average_wr', $commentdata);     }      Even when I put a value such as 'thisText' instead of $commentdata it seems to fail. What am I doing wrong?


WP_Query calls all posts?

I have this code that picks a random testimonial post.                   <?php             $quote_args = array(                 'post_type' => 'post',                 'category' => 'quote',                 'orderby' => 'rand',                 'posts_per_page' => 1             );                  $quote  = new WP_Query($quote_args);                  if($quote->have_posts()):                 while($quote->have_posts()):                     $quote->the_post();         ?>
             <?php the_content_rss(); ?>             <?php echo the_title(); ?>
                  <?php                 endwhile;                 endif;                      wp_reset_postdata();             ?>      The testimonials are posts with a category of 'quote', the title of the post is the name of the person. I have other posts in the site that have other categories but only the testimonial posts have a category of 'quote'. The code works but I'm getting a random post picked from all the posts and not just the post's with a quote category. Can anyone see a reason why I getting this, or any other reason this is happening


images are broken

I have a piece of code, which is used to display images on every post from RSS FEEDS, the images will be fetched from yahoo images search, I will paste this code into my single.php file, so that it will appear after my post, This code I found in one of the website where, this was used for the same reason to fetch images but not from yahoo but from different feeds The code which I am using is this:-                <?php         include_once(ABSPATH.WPINC.'/rss.php'); // path to include script         $feed = fetch_rss('http://news.search.yahoo.com/news/rss?p=car'); // specify feed url         $items = array_slice($feed->items, 0, 5); // specify first and last item         ?>         <?php if (!empty($items)) : ?>         <?php foreach ($items as $item) : ?>
<img id="niraj" src=" <?php         $pubdate = substr($item['pubdate'], 0, 16);         $a='http://mbas.in/wp-content/uploads/';         $a.=substr($pubdate,12,4);         $a.='/';         $m=substr($pubdate,8,3);         if($m == 'Jan'){$a.='01';}         elseif($m == 'Feb'){$a.='02';}         elseif($m == 'Mar'){$a.='03';}         elseif($m == 'Apr'){$a.='04';}         elseif($m == 'May'){$a.='05';}         elseif($m == 'Jun'){$a.='06';}         elseif($m == 'Jul'){$a.='07';}         elseif($m == 'Aug'){$a.='08';}         elseif($m == 'Sep'){$a.='09';}         elseif($m == 'Oct'){$a.='10';}         elseif($m == 'Nov'){$a.='11';}         else{$a.='12';}         $a.='/';         echo $a;         $str= $item['link'];         $len=strlen($str);         $test=substr($str,27,($len-1));         echo $test;         ?>.jpg" width="90" height="60" alt=<?php echo $item['title']; ?> style="border: none;align:left;"/>

<a href="<?php echo $item['link']; ?>"><?php echo $item['title']; ?>
         <?php endforeach; ?>         <?php endif; ?>      I tried this code, but the problem is the images are not coming. If this is not a correct way to fetch images from yahoo search, then is there any appropriate way to do it?


Add social media icon in header area

I have installed the Swift Theme. I want to know how to put a social media button on the right of the logo. I have not much knowledge of theme editing.


get posts based on category and post meta

I am coding a Live Show box for a radio website to show who is on air and who is up next. I've been using the get_post function to retrieve posts based on the category (in this case the day of the week), and whether the show has yet to reach its End Time (custom field) in order to display the show which should be live on air now. However, it's had a turn and will work sometimes, and will show the wrong show title at others. Any ideas where I am going wrong? Code is below and visit http://livewire1350.com to see it in action. EDIT: I have modified the code based on @CharlesClarkson 's comments but there is still a problem occurring. For debugging purposes I set the code to show the whole entire list of posts in ascending order of time but between 0:00 and 9:00, it begins to list 22:30 descending to 18:00 before resuming at 9:00 in ascending fashion up until 17:00 (like below). Any ideas why this could be happening? LIVE: 9:29 0:00 LIVE: 9:29 22:30 LIVE: 9:29 21:00 LIVE: 9:29 19:30 LIVE: 9:29 18:00 LIVE: 9:29 9:00 LIVE: 9:29 10:30 LIVE: 9:29 12:00 LIVE: 9:29 12:30 LIVE: 9:29 14:00 LIVE: 9:29 15:30 LIVE: 9:29 17:00               <?php     date_default_timezone_set('Europe/London');     $now  = time();     $time = date( 'G:i');     $day_of_the_week = date( 'w', $now );     //                                    S   M   T   W   T   F   S     $day_of_the_week_categories = array( 17, 18, 12, 13, 14, 15, 16 );     $day_of_the_week = date( 'w' );          // The Query     $the_query = new WP_Query( array(         'cat'            => $day_of_the_week_categories[ $day_of_the_week ],         'posts_per_page' => -1,         'offset'         => 0,         'orderby'        => 'meta_value_num',         'order'          => 'DESC',         'meta_query'     => array(             array(                 'key'     => 'Start_Time',                 'type'    => 'TIME',             )         )        )     );     // The Loop     if ( $the_query->have_posts() ) :     while ( $the_query->have_posts() ) : $the_query->the_post();?>

LIVE: <?php echo $time ?>

<a href="<?php the_permalink() ?>"><?php $short_title = substr(the_title('','',FALSE),0,18);                                                     echo get_post_meta( get_the_ID(), 'Start_Time', true );                                                       ?>

     <?php     endwhile;     endif;     ?>


Displaying my custom taxonomies in a <ul> using the_term_list()

I need help with displaying my custom taxonomies in a ul using the_term_list(). I can get it to list all the terms I want, but I need them in an unordered list, rather than just a list of links separated by comments. Here's what I've got to work with:               <?php echo get_the_term_list($post->ID, 'skills', '
Project Role
 ', ', ', '', ); ?>      Here's the WordPress function reference, if you need it: http://codex.wordpress.org/Function_Reference/get_the_term_list


Getting thubnails for previous posts

Been trying to find the right plugin or code to do the following: When a user clicks on any of my listed catagories on the right-side column, a new page opens up with a list of the posts related to that category. I would like to get thumbnails to also appear next to the post titles. Is there any easy way to do this? Thanks.... who ever can help!


Highlight Ads for few seconds

I got a list of ads in my WordPress website on a sidebar. Is it possible to highlight an ad, that is, make it bigger in size for few seconds? I want to make each ad highlighted one after the other. Right now I am using max ad banner to get the rotating ads, but I do not want to have the rotation anymore. Thanks


Styling Admin comments in WP 3.1.3

There's a lot of documentation on how to style 'autor' or 'admin' comments in WP, but most of it seems wildly outdated. I have a client for whom I am developing a Q&A site. I always figure it's best to use whatever tools Wordpress has already provided me with. That's why I decided to set up a form which pushes all "questions" to a custom post type. Which my client can then read and comment on with his answer. The only problem I've run into is that I need to style his comments in a couple ways. They need to stand out. This is easy enough to achieve really, as WP now dynamically generates a class for each authors comments. So I just wrote a little CSS for that:               .comment-author-myClient {     background-color: #bcd1f7;     padding: 10px;     border: 1px dotted black;     }      That did the job of making his comments look different. But it's still not quite enough. I really want to edit his specific comment template. Instead of it saying something like 'user says:" I want it to say "myClient's Answer:" I would also like for his comments to -always- remain at the top. Now, that shouldn't ever really become an issue, as standard WP comments are displayed in ASC format, so as long as is the first to comment (which he should always be) his comment should always be at the top. But, I just want to be safe. Additionally, I would like for his comment to appear before: X responses to "post-title": Just to make it easy for everyone who is going to try and help me.. Here is the twentyten comments.php file:               <?php     /**      * The template for displaying Comments.      *      * The area of the page that contains both current comments      * and the comment form.  The actual display of comments is      * handled by a callback to twentyten_comment which is      * located in the functions.php file.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */     ?>
     <?php if ( post_password_required() ) : ?>
<?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?>

     <?php             /* Stop the rest of comments.php from being processed,              * but don't kill the script entirely -- we still have              * to fully load the template.              */             return;         endif;     ?>          <?php         // You can start editing here -- including this comment!     ?>          <?php if ( have_comments() ) : ?>
<?php                 printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),                 number_format_i18n( get_comments_number() ), '' . get_the_title() . '' );                 ?>
          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyten' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyten' ) ); ?>

      <?php endif; // check for comment navigation ?>
                     <?php                         /* Loop through and list the comments. Tell wp_list_comments()                          * to use twentyten_comment() to format the comments.                          * If you want to overload this in a child theme then you can                          * define twentyten_comment() and that will be used instead.                          * See twentyten_comment() in twentyten/functions.php for more.                          */                         wp_list_comments( array( 'callback' => 'twentyten_comment' ) );                     ?>
          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyten' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyten' ) ); ?>

     <?php endif; // check for comment navigation ?>          <?php else : // or, if we don't have comments:              /* If there are no comments and comments are closed,          * let's leave a little note, shall we?          */         if ( ! comments_open() ) :     ?>
<?php _e( 'Comments are closed.', 'twentyten' ); ?>
     <?php endif; // end ! comments_open() ?>          <?php endif; // end have_comments() ?>          <?php comment_form(); ?>
      And here is the part of functions.php that it refers to:               if ( ! function_exists( 'twentyten_comment' ) ) :     /**      * Template for comments and pingbacks.      *      * To override this walker in a child theme without modifying the comments template      * simply create your own twentyten_comment(), and that function will be used instead.      *      * Used as a callback by wp_list_comments() for displaying the comments.      *      * @since Twenty Ten 1.0      */     function twentyten_comment( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;         switch ( $comment->comment_type ) :             case '' :         ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             <div id="comment-<?php comment_ID(); ?>">
                 <?php echo get_avatar( $comment, 40 ); ?>                 <?php printf( __( '%s says:', 'twentyten' ), sprintf( '%s', get_comment_author_link() ) ); ?>
             <?php if ( $comment->comment_approved == '0' ) : ?>                 <?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?>
             <?php endif; ?>
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">                 <?php                     /* translators: 1: date, 2: time */                     printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );                 ?>

<?php comment_text(); ?>

                 <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

              <?php                 break;             case 'pingback'  :             case 'trackback' :         ?>

<?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?>
         <?php                 break;         endswitch;     }     endif;      All the documentation I have found thus far on modifying admin comments has been from a previous version of WP and Twentyten, where the comments loop is all stored in comments.php, and has a much different format. So any help with the goals I am trying to achieve here would be very, very appreciated. TIA


Toolbar Hidden in a Virtual Page

I am trying to create a virtual page, but my admin toolbar is not showing up. This is how I am creating the virtual page: ### functions.php               add_action('init', function()     {         add_rewrite_rule('register$', 'index.php?virtualpage=1', 'top');     });          add_filter('query_vars', function($query_vars)     {         $query_vars[] = 'virtualpage';         return $query_vars;     });          add_action( 'parse_request', function(&$wp)     {         if (array_key_exists('virtualpage', $wp->query_vars))         {             switch ($wp->query_vars['virtualpage'])             {                 case '1': include 'page-register.php';             }             exit();         }         return;     });      ### page-register.php               <?php     add_filter('wp_title', function($title, $sep, $seplocation) { return 'Register'; }, 10, 2);          get_header();     get_template_part('includes/breadcrumbs');     get_template_part('includes/top_info');     ?>

                  <?php             $form = new Zebra_Form('form');             $form->add('label', 'label_email', 'email', 'Email');             $form->add('text', 'email', '', array('autocomplete' => 'off'));             $form->add('submit', 'btnsubmit', 'Submit');             $form->render();             ?>

      <?php get_footer();      What am I doing wrong? ### Solution Based on the response, I attached a function to the 'template_redirect' action instead of the 'parse_request' action as follows:               add_action('template_redirect', function()     {         global $wp;              if (array_key_exists('virtualpage', $wp->query_vars))         {             switch ($wp->query_vars['virtualpage'])             {                 case '1': include 'page-register.php';             }             exit();         }         return;     });


What action is called when drafts are saved?

I would like to add a metadata field to the current post based on a checkbox in a custom meta box to be able to toggle my custom plugin on a post by post basis. For this I coded the following things   1. generate a meta box on the new post and new page page   2. handle the value of the checkbox in the meta box and set the metadata of the post or page accordingly I succeded in 1. but I have problems with number 2. I have the following code to handle the setting of the metadata: ### Update metadata depending on value of checkbox in meta box               // register action     add_action( 'save_post', 'cl_save_postdata');     /* When the post is saved, saves our custom data */          function cl_save_postdata( $post_id ) {       // check if $post_id is just a revision id and if so get the parent id       if($parent_id = wp_is_post_revision($post_id)){         $post_id = $parent_id;       }         // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( EMU2_I18N_DOMAIN, plugin_basename(__FILE__) ) )           return $post_id;       // verify if this is an auto save routine.        // If it is our form has not been submitted, so we dont want to do anything       if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )            return $post_id;            // Check permissions       if ( 'page' == $_POST['post_type'] ) {         if ( !current_user_can( 'edit_page', $post_id ) )             return $post_id;       } else {         if ( !current_user_can( 'edit_post', $post_id ) )             return $post_id;       }            // OK, we're authenticated: we need to find and save the data            if ($_POST['cl-activated']) {          add_post_meta( $post_id, 'cl-activated', true, true) or update_post_meta( $post_id, 'cl-activated', true);       } elseif (get_post_meta ($post_id, 'cl-activated', true)) {         delete_post_meta( $post_id, 'cl-activated');       }       return $cl_is_activated;     }      The idea of this code is to set or unset the 'cl-activated' metadata depending on the checkbox value. The form of the meta box is the following: ### Generate inner meta box HTML               function cl_generate_inner_box($post, $metabox) {           // Use nonce for verification       wp_nonce_field( plugin_basename(__FILE__), EMU2_I18N_DOMAIN );            // The actual fields for data entry       echo '<label for="cl-activated">';            _e("Activate collect links", EMU2_I18N_DOMAIN );       echo '</label> ';       echo '<input type="checkbox" id="cl-activated" name="cl-activated" value='.$metabox['args']['cl-parameter-name'];       if (get_post_meta($post_id, 'cl-activated', true)==true) {         echo ' checked="checked"';       }       echo ' />';     }      ### My problems   1. the metadata of the post is not set. I tried looking up the metadata in the wp-postmeta table in the database and it is not there, no matter what I do.   2. Is there a way to save the metadata even if the post or page is still a draft and the user only hits save draft? If I use the action `save_post` like I am doing now, I have the impression that it is called only when the post is already published. ### Edit **The first problem is solved.** I have double-checked the transition hooks that are provided by Wordpress. It seemed to me that the `save_post` hook should be fired when I edit a post. However what happens is that it is called when I click on the _new post_ button but not when I then save the post as a draft. To clearify I need a hook that allows me to get a function executed when the user has changed anything on the post to see if my custom checkbox has been changed so I can update the post's metadata accordingly.


I want to add one extra field to my URLs, I'm using Rewrite functions but it doesn't work

I think my question isn't in the right way, I just ask it. I want this routings for my wordpress site (for example in Custom PostType Archive page):               example.com/VALUE          =>  example.com/?mykey=VALUE     example.com/a/VALUE        =>  example.com/a/?mykey=VALUE     example.com/a/b/VALUE      =>  example.com/a/b/?mykey=VALUE     example.com/a/b/.../VALUE  =>  example.com/a/b/.../?mykey=VALUE      I searched for it, I read many articles and answers but they didn't work, or maybe I couldn't make them work! Most of the answers were how to use Rewrite API, add_rewrite_rule(), add_rewrite_endpoint() and so on... I really need this, I really need a working example please, thank you.


Javascript in wordpress

I have featured images shown for different posts of same category in a page in a specific div. I need to show the whole post related to this image in the same page in another div. I know i must use JavaScript in this. But i need some reference which i can use for this. Can anyone help me with this? I am using the following code to show the images               <?php     /*     Template Name: Meet The Team Template     */     ?>     <?php get_header(); ?>
     <?php          $recent = new WP_Query("cat=6&orderby=title&order=ASC");          while($recent->have_posts()):$recent->the_post();         $desc_values = get_post_custom_values("description");          ?>
         <a href="<?php the_permalink() ?>" rel="title">             <?php                 if ( has_post_thumbnail() )                  {                      the_post_thumbnail();                 }             ?>
     <?php endwhile ?>
          <?php get_footer(); ?>      Thanks in advance


How to know which page/file WordPress is expecting?

I'd like to know if there's a way to know which page or file (`index.php`, `page.php`, `category.php`) WordPress is expecting when displaying a page. I get a 404 error on a `www.myblog.com/page/2`, meaning WP can't find the page. Just don't know which it's expecting.


Recommended Use of Bootstrap, or JQuery-UI in WP/plugin development?

It seems Bootstrap is becoming more and more popular lately, giving a consistent feel for responsive dialogs and forms. Is it generally best practice, for now and the future, to use Bootstrap, or jQuery-UI for things like dialogs, tabs, forms, etc.? From what I've seen they both may have advantages: For Bootstrap:   * It's a newer library, not as likely to interfere with some plugin's included jQuery-ui-css from 5 versions ago of jQuery-ui that is no longer supported. (Unfortunately it can conflict with jQuery-ui, requiring workarounds).   * The nature of Bootstrap makes Javascript code less necessary for simple stuff. (Dialogs can be opened from a button with an attribute target for example). For jQuery-UI:   * Has been standard part of WP for some time. (Unfortunately, changes its version from version to version in Wordpress.)   * Easy positioning and JS-centric api (position my top right at top + 100px is easy), modal y/n is a setting in initialization, along with many others.   * Resizable dialogs, jQuery-ui draggable, etc. Obviously both of these libraries are widely used, but which is generally considered best-practice in WP? Any thoughts?


Using wp_register_style to load CSS in footer?

I realise you can enqueue JS in the footer using `wp_register_script` as there is a `$in_footer` parameter for doing so. However, there isn't one for `wp_register_style` it seems. Is there a way to enqueue CSS in the footer in the same way, or do I have to manually hardcode the file path in my footer.php file?


Woocommerce Product Category Hide Out of Stock

I have `hide out of stock` applied in my woocommerce settings. The following short code               [product_category category="cat" per_page="8" columns="4" orderby="date" order="desc"]      Seems to be returning all 8 products and then hiding 2 out of stock items. This creates 2 "empty white spaces" on the frontend since only 6 products are in stock. How can I return and display 8 products that are in stock?


Adding a meta box to determine the sidebar

I was trying to customize my WordPress, and I have added some custom meta boxes (it adds custom field) to add values in it, but I don't know how to do this one... I want to a Meta Box, which will be a drop down menu. The value of this metabox will determine which sidebar to use in the post. Here's the picture: ![enter image description here](http://i.stack.imgur.com/4c5mX.png)


How can I change the label "Comments" to "Review" everywhere in the WP installation without translation

Got the way to change the labels everywhere for the post_type "Post". For a customer site, I need to use the WordPress comments. Just need to change the label from "Comments/Comment" to "Review" everywhere. But where for post_type "Post" we can use `$wp_post_types;`, what can we use for comments? I tried with `$wp_comments`, `$wp_comment` etc. but failed. How can I do it? PS: I don't want a way to translate all the strings etc. Just need a way like the link pasted above. And not just the menu labels, I need to change them everywhere, so that under the post writing page, in the checkbox saying "All comments" would also change.


SSL Certificate and Dedicated IP address with Woocommerce WordPress site

I have **wooCommerce WordPress** site (in develop phase), when i searched to have a good hosting company they advice me to **go with VPS solution not shard solution** because in VPS i can have multiple ( SSL certificate and dedicated IP), but is it actually important to have with the e-Commerce site ( what the benefit from having SSL certificate and dedicated IP) for the site. My question is did i need to have (SSL certificate and dedicated IP) for my wooCommerce ?


Where can i design and modify a new mail template for sending emails to users when commenting?

the mail sent by Wordpress is ok but its template is very simple and has no style or even a header or footer! its message has no information about my blog or logo. where can i edit its message body and/or where can i style this template?


the_content() not working in my Android mobile

I have got a little problem. I am working in a theme developed by someone I don´t know. I was testing the site in my cellphone and saw the_content() function does not show anything. I checked in one Ipad and it's working. I also checked my functions.php and I did not see anything weird. This is the link (sorry because it is Spanish site): http://decopeques.com/local-infantil/thanks-mum/ Any help would be greatly appreciated! Thanks! Frede


Filter WP_Query output before it is accessed (pre_get_posts)?

I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it. I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is I have multiple instances of recent posts according to category and if I want an offset of 4 it offsets posts in the category rather than simply the latest 4 posts irrespective of category (I guess as part of `$args` see code). It feels like I need to filter the latest 4 posts from WP_Query before it is passed to recent posts but I'm not sure this is possible? I've played with various snippets but haven't got anywhere. So far I am left with...               add_action('pre_get_posts', 'skips_front_page_filter');     $flexible_posts = new WP_Query( $args );     remove_action('pre_get_posts', 'skips_front_page_filter');      All I've done is surround `$flexible_posts = new WP_Query( $args );` with an action. Am I going about this the right way and can anyone assist me to strip the first 4 posts irrespective of category before it hits `$flexible_posts`? There is a second part to this. I only want this filter to apply when my static front page is visible. I tried `if( is_front_page() )` but that hasn't helped although until I can get the filter working that's a secondary issue to worry about. Would appreciate any help.


Load and execute javascript from body

I am trying to have the following code posted in the body (from the admin interface)                   <div class="zx_ABCD zx_mediaslot">             <script type="text/javascript">                 window._zx = window._zx || [];                 window._zx.push({"id":"ABCD"});                 (function(d) {                      var s = d.createElement("script"); s.async = true;                     s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//static.zanox.com/scripts/zanox.js";                     var a = d.getElementsByTagName("script")[0]; a.parentNode.insertBefore(s, a);                 }(document));             </script>         </div>      I wonder why the code gets loaded correctly(can see it from the source) but it's not executed ? Do you have any suggestions on workarounds for this? (Is it a feasible solution to put the script inside an js file? can that be loaded from the body?) I would like to be able to do this without having to touch the wordpress configuration/php. Just from the admin interface Cheers


How to add more than 1 user role to sub-menu pages

I create a plugin with 6 submenu pages. I need 4 of them to be accessible by administrator and a custom user role i created say 'coach' user. Then the 2 of them to be accessible by administrator and another custom user role 'player'. How would i do that to add 2 user role?


I need to add a custom "cover" to every new post — plugin or custom setup?

I'm creating a site that's basically like an online book, and every post is a chapter. Each chapter gets a customized, specially designed "cover" page that can't really be designed in the Wordpress WYSIWYG. There are certain aspects of each cover that can be templatized (like an h1, h2, and single paragraph — every chapter will have that) but everything else is going to be special to each chapter. This "cover" will also have specific CSS only relevant to this chapter. Ideally I'll be able to design and code these covers outside of Wordpress and somehow be able to inform each post which cover to use. Whether that means Wordpress actually imports that code or simply includes it with a php include doesn't much matter to me. I'd just like this to be as streamlined as possible. Suggestions?


Remove 'Publish to Facebook' checkbox for Facebook page publish plugin

I am using Facebook Page Publish plugin and it adds a checkbox within the metabox submitdiv. I would like to remove that checkbox for my custom post type. Is there any way to do that using a function? This is the function from Facebook Page Publish that is printing the checkbox:               /**      * Renders a 'publish to facebook' checkbox. Renders the box only if       * the current post is a real post, not a page or something else.      */      function fpp_render_post_button() {         global $post;              $object_access_token = get_option('fpp_object_access_token');              if (!array_pop(get_post_meta($post->ID, '_fpp_is_published'))) {                 echo ' '.__('Publish to Facebook', FPP_TEXT_DOMAIN).' <input '.(((FPP_DEFAULT_POST_TO_FACEBOOK or fpp_get_default_publishing($post)) and !empty($object_access_token)) ? 'checked="checked"' : '').' type="checkbox" value="1" id="fpp_post_to_facebook" name="fpp_post_to_facebook" '.(empty($object_access_token) ? 'disabled="disabled"' : '').' />';         } else {                 echo ' '.__('Post again to Facebook', FPP_TEXT_DOMAIN).' <input type="checkbox" value="1" id="fpp_post_to_facebook" name="fpp_post_to_facebook" '.(empty($object_access_token) ? 'disabled="disabled"' : '').' />';         }         if (empty($object_access_token)) {                 echo '
'.sprintf(__('Facebook Page Publish is not set up.
Please check your plugin settings.', FPP_TEXT_DOMAIN), 'options-general.php?page='.plugin_basename(__FILE__)).'
';         }         if ($post->post_status == "private") {                 echo '
'.__('Private posts are not published', FPP_TEXT_DOMAIN).'
';         }         echo '<input type="hidden" name="fpp_send_from_admin" value="1" />';              $error = get_option('fpp_error');         if (!empty($error)) {                 echo '
'.sprintf(__('Your Facebook Page Publish plugin reports an error. Please check your plugin settings.', FPP_TEXT_DOMAIN), 'options-general.php?page='.plugin_basename(__FILE__)).'
';         }      }


Two different registraton forms for buddypress

I have to different user types on my buddypress site, athletes and coaches. Is their any way to have two different registration forms on buddypress? The ultimate solution would be to have a dropdown menu and when the user chooses their selection relevant to them (for example athlete) the xprofile field group specefic for them would show up below. Any help or advice would be greatly appreciated. Thanks, Tom


Woocommerce query all products and categories

I need to generate xml file from all my products. My current query shows all product names, but how to access categories for each products? All the products have categories and subcategories. My current query:               $args = array(                      'post_type' => 'product',                      'orderby' => 'post_excerpt',                      'order' => 'ASC',                     //'product_cat' => 'My Product Category',                     'post_status' => 'publish'                 );                 $loop = new WP_Query( $args );                      while ( $loop->have_posts() ) {                     $loop->the_post();                     echo '' . get_the_title() . '

';                 }


How to Post to Specific Pages?

I'm working on this WP blog: http://millerat.com/blog/ I want to post newer articles on the blog's home page and older archived articles from PDFs to the "Articles"page. The "How's your posture?" article is one of the articles I don't want to show up on the blog's home page, only on the Articles page. How can I do this?


Formatting WordPress Menus (without bullets, inline with text)

I'm trying to add a copyright statement and footer menu to the footer area of my Twenty Ten child theme. So far I've created the child theme and added the copyright statement and footer menu to the footer.php file. My code for the child footer.php file is:               <?php     /**      * The template for displaying the footer.      *      * Contains the closing of the id=main div and all content      * after. Calls sidebar-footer.php for bottom widgets.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */     ?>

          <?php         /* A sidebar in the footer? Yep. You can can customize          * your footer with four columns of widgets.          */         get_sidebar( 'footer' );     ?>
                                          Copyright (c) 2013 Acme Inc. All rights reserved.                     <?php wp_nav_menu( array( 'theme_location' => 'footer-menu' ) ); ?>

          <?php         /* Always have wp_footer() just before the closing           * tag of your theme, or you will break many plugins, which          * generally use this hook to reference JavaScript files.          */              wp_footer();     ?>                The problem is the formatting. **Everything should be on one line without any bullets. Like:**               Copyright (c) 2013 Acme Inc. All rights reserved. Privacy Policy Terms & Conditions      Instead the copyright statement is on its own line followed by the links (each on a separate line with bullets). I tried float: left; AND list-style: none;. This works somewhat but the links are still on a separate line. Maybe it's my div structure?


WordPress plugin options and jQuery

I'm creating a plugin that uses jQuery to modify some css, but what I can't figure out is how you can control the execution of the jQuery with WordPress plugin options (like checkboxes true/false). Can WordPress options be used as "variables" in jQuery? Or would every case require a unique .js file?


Link to Particular Page Within Template PHP Code

I want to simply create a link to a page that I know the title (or ID), but I want to make sure it works on any Wordpress install. What is the best way to do this?


How to add a class to the attachment images

When I'm in the Wordpress editor and I add an external image with the 'img' button, my html result wil be like this:                     How can automatically have a class being added to the img tag? Like this:                     I would like to apply the same principle to the 'Add Media' option. This output is like this:                     And I want the output to be like this:                     I'm new with PHP, so I'm not sure how to this via a filter. I'm started like this, but I don't know what to do next:               function image_tag_class($class, $id, $align, $size) {         return $align;     }     add_filter('get_image_tag_class', 'image_tag_class', 0, 4);


Get post object in shortcode function

I have to display a post from another page (index.php), so my code is               $section_id = 16;     $section_home = get_post($section_id);          setup_postdata( $section_home );      the_content();      This post (with ID 16) has a few shortcodes inside. I can't access the $post object inside of the shortcode functions, for example I tried               function tp_sc_flipcoin($atts,$content = null){         global $post;         var_dump($post);         return "";     }          add_shortcode( 'tp_flipcoin', 'tp_sc_flipcoin' );      and it displays the post with ID=1, I also tried:               function tp_sc_flipcoin($atts,$content = null){         var_dump($post);         return "";     }          add_shortcode( 'tp_flipcoin', 'tp_sc_flipcoin' );      and in this case it displays NULL. What am I doing wrong?


Display image from an external rss feed on wordpress without plugins

I am trying to add an external RSS Feed to my wordpress theme. Displaying the feed content and title was a success. But I don't see any option to display the image from the external feed. I tried reading about it, but most of the answers I found suggests using a plug-in like SimplePie. I'm wondering if there's another way to do it without plug-ins.


Multiple tag cloud filtering

I am writing a plugin which creates a custom post type and two associated custom taxonomies. The custom post type list/archive page should be filterable by terms in one or both taxonomies i.e not just a filter by one taxonomy term. The filters should be displayed as two separate tag clouds. Does anyone have experience of implementing this functionality and can recommend any suitable plugins?


Display Custom Taxonomy of custom post type

I am stuck on trying to create a template page that displays a list of the names in a specific custom taxonomy of a custom post type I created. The custom taxonomy is `locations` and clicking on a location like _New York_ , should take you to a list of all the post types that are connected to that location. I have looked at `get_the_terms_list` but I have not been able to produce the list. Don't really know what steps and pages I have to create to do all this so any help would be appreciated.


How to debug WordPress "Cron" wp_schedule_event

How can I debug problems with WordPress Cron? I think it will trigger when users go to your site but any errors wont be shown to them, as the jobs are run "asynchronously". So how might I debug errors? I use `wp schedule event`


Sort admin menu items

On a related note to "Changing the Order of Admin Menu Sections?", I'm looking for a way to alphabetically sort the entries in each sub-section of WordPress's admin area. Currently, whenever a new plugin is added, its entry will appear in a seemingly random location under Settings / Tools / Plugins, and it's often hard to locate the new menu item. (I have a lot of plugins already, so my menus are pretty full.) Being that I add and remove plugins fairly regularly, I would rather not need to continually go into the settings page for a menu-ordering plugin and adjust the order. Sorry for the long question; I just want to make it clear what I'm looking for. ### Example Instead of:                   Settings         - General         - Writing         - Reading         - Discussion         - (rest of core items)         - Plugin 4         - WP something         - A plugin to help with stuff         - Google-related plugin         - RSS plugin         - FeedBurner plugin         - etc.      Can I have the menu sorted alphabetically (or by another logical method), e.g.:                   Settings         - A plugin to help with stuff         - Discussion         - FeedBurner plugin         - General         - Google-related plugin         - Plugin 4         - Reading         - (rest of core items)         - RSS plugin         - WP something         - Writing         - etc.      Even better would be a sort method that keeps the core entries where they are by default and only sorts items added by plugins:                   Settings         - General         - Writing         - Reading         - Discussion         - (rest of core items)         - A plugin to help with stuff         - FeedBurner plugin         - Google-related plugin         - Plugin 4         - RSS plugin         - WP something         - etc.