title: Template file for static posts page does not get loaded?

text:
I have this inside my posts page (set in the admin panel: Posts Page: Blog): ![Screenshot homepage setting](http://i.stack.imgur.com/waZpC.png) **blog.php**                  <?php         /**          * Template Name: Blog          * @package WordPress          * @subpackage Prominent          * @since Prominent 1.0          */         get_header(); ?>

                     <?php                     /* Run the loop to output the posts.                      * If you want to overload this in a child theme then include a file                      * called loop-index.php and that will be used instead.                      */                     get_template_part( 'loop', 'index' );                     ?>                 <?php get_sidebar(); ?>

         <?php get_footer(); ?>      **index.php**               <?php     /**      * The main template file.      *      * This is the most generic template file in a WordPress theme      * and one of the two required files for a theme (the other being style.css).      * It is used to display a page when nothing more specific matches a query.      * E.g., it puts together the home page when no home.php file exists.      * Learn more: http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Starkers      * @since Starkers 3.0      */          get_header(); ?>                      <?php                 /* Run the loop to output the posts.                  * If you want to overload this in a child theme then include a file                  * called loop-index.php and that will be used instead.                  */                 get_template_part( 'loop', 'index' );                 ?>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      **loop.php**               <?php     /**      * The loop that displays posts.      *      * The loop displays the posts and the post content.  See      * http://codex.wordpress.org/The_Loop to understand it and      * http://codex.wordpress.org/Template_Tags to understand      * the tags used in it.      *      * This can be overridden in child themes with loop.php or      * loop-template.php, where 'template' is the loop context      * requested by a template. For example, loop-index.php would      * be used if it exists and we ask for the loop with:      * get_template_part( 'loop', 'index' );      *      * @package WordPress      * @subpackage Starkers      * @since Starkers 3.0      */     ?>          <?php /* Display navigation to next/previous pages when applicable */ ?>     <?php if ( $wp_query->max_num_pages > 1 ) : ?>             <?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>             <?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>     <?php endif; ?>          <?php /* If there are no posts to display, such as an empty archive page */ ?>     <?php if ( ! have_posts() ) : ?>
<?php _e( 'Not Found', 'twentyten' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?>
             <?php get_search_form(); ?>          <?php endif; ?>          <?php /* Display the contents of static page Posts page */ ?>     <?php     if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') && is_home() ) : the_post();         $page_for_posts_id = get_option('page_for_posts');         setup_postdata(get_page($page_for_posts_id));     ?>         <div id="post-<?php the_ID(); ?>" class="page">
                 <?php the_content(); ?>                 <?php edit_post_link('Edit', '', '', $page_for_posts_id); ?>

     <?php         rewind_posts();     endif;     ?>          <?php         /* Start the Loop.          *          * In Twenty Ten we use the same loop in multiple contexts.          * It is broken into three main parts: when we're displaying          * posts that are in the gallery category, when we're displaying          * posts in the asides category, and finally all other posts.          *          * Additionally, we sometimes check for whether we are on an          * archive page, a search page, etc., allowing for small differences          * in the loop on each template without actually duplicating          * the rest of the loop that is shared.          *          * Without further ado, the loop:          */ ?>     <?php while ( have_posts() ) : the_post(); ?>          <?php /* How to display posts in the Gallery category. */ ?>              <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                 <?php twentyten_posted_on(); ?>          <?php if ( post_password_required() ) : ?>                     <?php the_content(); ?>     <?php else : ?>     <?php         $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );         $total_images = count( $images );         $image = array_shift( $images );         $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );     ?>                         <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?>
<?php printf( __( 'This gallery contains %2$s photos.', 'twentyten' ),                             'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',                             $total_images                         ); ?>
                          <?php the_excerpt(); ?>     <?php endif; ?>                          <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?>                     |                     <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>                     <?php edit_post_link( __( 'Edit', 'twentyten' ), '|', '' ); ?>          <?php /* How to display posts in the asides category */ ?>              <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>                  <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>                 <?php the_excerpt(); ?>             <?php else : ?>                 <?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>             <?php endif; ?>                          <?php twentyten_posted_on(); ?>                     |                     <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>                     <?php edit_post_link( __( 'Edit', 'twentyten' ), '| ', '' ); ?>          <?php /* How to display all other posts. */ ?>              <?php else : ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                 <?php twentyten_posted_on(); ?>              <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>                 <?php the_excerpt(); ?>         <?php else : ?>                 <?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>                 <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>         <?php endif; ?>                          <?php if ( count( get_the_category() ) ) : ?>                         <?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>                         |                     <?php endif; ?>                     <?php                         $tags_list = get_the_tag_list( '', ', ' );                         if ( $tags_list ):                     ?>                         <?php printf( __( 'Tagged %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>                         |                     <?php endif; ?>                     <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>                     <?php edit_post_link( __( 'Edit', 'twentyten' ), '| ', '' ); ?>                  <?php comments_template( '', true ); ?>              <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>          <?php endwhile; // End the loop. Whew. ?>          <?php /* Display navigation to next/previous pages when applicable */ ?>     <?php if (  $wp_query->max_num_pages > 1 ) : ?>                     <?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>                     <?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>     <?php endif; ?>      Now it doesn't matter how much I modify the code inside **blog.php** nothing changes (Even deleting everything changes nothing). Am I misunderstanding Wordpress' loop?


title: In jquery use php variable to execute an enqueued jquery file

text:
I am loading some jquery on a specific Wordpress admin page, the jquery loads and works fine but I need have this jquery only trigger if a php variable exists. In php I would just write a function and hook it into the admin page: I am enqueuing the jquery file, i.e., foo.js that contains this following jquery:               jQuery(document).ready(function($){         $('#someID.some-class > a').append('

');         $(".caption").text("Add this text");     });      So the file foo.js file loads whenever the themes.php file is loaded but I do not want the jquery to run unless a variable is set by the themes.php page. I am confused as to where and how I do check the variable and trigger the jquery. Do I just add the jquery by echoing out the the jquery from within a function? Do I somehow add the php variable check into the foo.js file?


title: Custom Loop in Page Admin Causing Other Fields to Fail

text: I created a custom loop in the page admin section to manage a custom post type called "widgets" for that page.               $ps_widget_list = get_post_meta( $post_id, 'ps_widget_list', true ); //first get the list of current widgets          $active_widget_array = explode( ', ', $ps_widget_list ); //then separate those widgets into an array of active widgets          // this array is for the UI. It will build a list of all the widgets     // then based on the array of active widgets, will separate them into     // two different arrays to be used later     $widgets_array = array(               'active' => array(),         'inactive' => array()          );          //get all the widgets     $args = array(              'post_type' => 'ps_widgets',         'posts_per_page' => '-1'          );          $the_query = new WP_Query( $args );          while ( $the_query->have_posts() ) : $the_query->the_post(); // loop through the widgets              $widget_id = get_the_ID();              // if the widget's id is in the array of active widgets         // mark it as active, if not mark as inactive and store to the array         $key = ( in_array( $widget_id, $active_widget_array) ) ? 'active' : 'inactive';              $widgets_array[ $key ][ $widget_id ] = array(                  'id' => $widget_id,             'title' => get_the_title( $widget_id )              );          endwhile;     wp_reset_postdata();      The issue arises when I try to add an SEO title, description, or keywords in an an SEO plugin. I tried this on both Yoast and All in One. After disabling different sections of code, I narrowed the issue to this loop. I also tried namespacing the variables too, but no luck. I assume its an issue with the loop being called, any suggestions?


title: WP Site in subdirectory Joomla! Site - Permalinks not working

text: I have WordPress in a test folder inside the root directory where I Joomla! 3.x site is running. Somehow the Joomla! rewrite rules are interfering with the WordPress permalinks rules. I keep on getting Joomla! 404 messages and some odd:               file_get_contents(url) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /path/to/file.php on line 16      errors. I try to resolve these specific errors here on StackOverflow. Is there a way I can make Joomla! only worry about Joomla! pages and make WordPress have its permalinks work again? I have not been able to come up with a rewrite rule or condition that works thus far. I tried the one mentioned here as well. I used               RewriteCond %{REQUEST_URI} !^foldername      which I added to the Joomla! .htaccess file just below the line where it says `RewriteEngine On` No luck so far.. **Update** See answer below. It was a faulty WP .htacces after all. Once it was correct is started working and ignoring the Joomla! .htaccess.


title: Archive template for custom post type only lists first 10

text:
Here is my template for archive-people.com: It currently only shows the first 10 people. I'd like it to show everyone, not just the first 10 people.               <?php get_header(); ?>

         <?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?>
                 <?php the_title(); ?>

         <?php              endwhile;              endif;         ?>

     <?php get_footer(); ?>      If I want it to display everyone, is that something I change in the template? Or is that something that I add to the functions.php file?


title: page slug and taxonomy slug in custom post type url

text: I have a strange situation here. I want the taxonomy of a custom post type to be after a page slug, for example I have a taxonomy term "shareholders", i want the url to be /page-name/another-page/shareholders/ Now if there is a post within shareholders taxonomy term, I want it to be /page-name/another-page/shareholders/post-name/ Everything is working fine, except the custom post type single post url, which is giving a 404 error Here is the code I am using.. Code for registering post type and taxonomy...               function team_members_post() {     $labels = array(         'name'               => _x( 'Team Members', 'post type general name' ),         'singular_name'      => _x( 'Team Member', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'member' ),         'add_new_item'       => __( 'Add New Member' ),         'edit_item'          => __( 'Edit Member' ),         'new_item'           => __( 'New Member' ),         'all_items'          => __( 'All Members' ),         'view_item'          => __( 'View Member' ),         'search_items'       => __( 'Search Members' ),         'not_found'          => __( 'No Members found' ),         'not_found_in_trash' => __( 'No Members found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Team Members'     );     $args = array(         'labels'        => $labels,         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title', 'editor', 'excerpt', 'thumbnail' ),         'has_archive'   => true,         'rewrite' => array(             'slug' => 'hlb-about-us/our-team/%member_cats%',             'with_front' => false         ),     );     register_post_type( 'team_members', $args );         }     add_action( 'init', 'team_members_post' );          function add_custom_taxonomies() {     register_taxonomy('member_cats', 'team_members', array(         'hierarchical' => true,         'labels' => array(             'name' => _x( 'Member Categories', 'taxonomy general name' ),             'singular_name' => _x( 'Member Category', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Categories' ),             'all_items' => __( 'All Categories' ),             'parent_item' => __( 'Parent Category' ),             'parent_item_colon' => __( 'Parent Category:' ),             'edit_item' => __( 'Edit Category' ),             'update_item' => __( 'Update Category' ),             'add_new_item' => __( 'Add New Category' ),             'new_item_name' => __( 'New Category Name' ),             'menu_name' => __( 'Member Categories' ),         ),         'rewrite' => array(             'slug' => 'hlb-about-us/our-team',             'with_front' => false,             'hierarchical' => true         ),     ));     }     add_action( 'init', 'add_custom_taxonomies', 0 );      Code for rewriting the custom post type               function filter_post_type_permalink($link, $post){         if ($post->post_type != 'team_members')             return $link;              if ($cats = get_the_terms($post->ID, 'member_cats'))             $link = str_replace('%member_cats%', array_pop($cats)->slug, $link);         return $link;     }          add_filter('post_type_link', 'filter_post_type_permalink', 10, 2);      If I make the rewrite slug of custom post type as only '%member_cats% then the pages are opening, however when I add the page slug base, then it doesn't.


title: How to show custom post type count in the users admin page

text: There's a post count in the user page of the WordPress admin area. I have a custom post type events. Is there some hook I can use to add my event count to the post count, or else to add a column for the event count?


title: Internationalization and the plugin description

text: SO I am trying to do some i18n on a plugin I am working on and having some troubles. I wanted to see if anyone else has encountered these or possibly has a solution. Basically, I have received the plugin translation and it all looks great except for one thing: the plugin description. I tried adding into the plugin header Text Domain and Domain Path, but I cannot figure out how to get this into the .pot file for translation. I examined a couple of plugins ( WooCommerce and Easy Digital Downloads) and I noticed that both have the string in their .pot files and it doesn't seem like they are doing anything special to get them there. I was trying this with Poedit and could not figure it out. The one thing I have not tried and maybe this will solve it is using the make .pot from WordPress, will that add in the description? On another note with the Text Domain in the header (even for WooCommerce) I noticed that the plugin description does NOT get translated unless the plugin is actually active. Is that an issue with WordPress or is it just being done wrong? Sorry for the long post and thank you to anyone who can contribute!o


title: add_rewrite_rule not working for me

text: I have the following rewrite tags defined:               // ADD REWRITE TAG FOR 'VEHICLE MAKES'     add_rewrite_tag('%make%','([^&]+)');          // ADD REWRITE TAG FOR 'BODY STYLES'     add_rewrite_tag('%body-style%','([^&]+)');          // ADD REWRITE TAG FOR 'OTHER TOPICS'     add_rewrite_tag('%topic%','([^&]+)');      I'm trying to create a custom rewrite for each one of these that can apply to any page the variables exist. I've been reworking the WP example in the documentation with no luck.. This rewrite is for 'Vehicle Makes'. I'm aiming for WP to interpret the following:               http://example.com/make/abc      as               http://example.com?make=abc      and the same pattern for `http://example.com?body-style=abc` & `http://example.com?topic=abc` I can't seem to get the following to work no matter how much I try               add_rewrite_rule('^nutrition/([^/]*)/([^/]*)/?','index.php?page_id=12&food=$matches[1]&variety=$matches[2]','top');      Any and All help is appreciated!


title: How to display Wordpress comments and comment form in lightbox?

text: I would like to display the "Leave a reply" link page content a popup or lightbox.   I have Lightview, but dosen't help realy,becouse lightview get pages in Iframe, which disabled in this case for security reasons.   I have Ifeature free theme.   For clearly:   I whant get comments and the comment form, but I don't whant get page background, or slidebar, just the comments and the comment form, where you can reply.


title: Wpdb->insert() doesn't insert new row after the last one

text: In JavaScript, I'm using an Ajax call and I'm sending an array of shops.   Except for the last element in the array all the shops already exist in the DB.   The last element is a new shop.   The PHP code should get the array and update all the shops that are already in the DB and insert the new one after the last row of the table.   The PHP code uses $wpdb->insert() to insert the last shop but for some reason it doesn't always insert it after the table's last row.   The insert parameters include values for all the fields except for the index. This field is marked as auto_increment in the DB and indeed the inserted row get the expected index number.   But it's not inserted after the last row as expected.   What can be the cause? Here's the php code:               function updateshops($shopsArray){         global $wpdb;              $sArray = $_POST["shopsArray"];         $aSize = sizeof($sArray);              for ($i=0; $i<$aSize; $i++)         {             if ($sArray[$i]['shopId']!=-1)  // update existing records                 $wpdb->update( 'wp_shops', array( 'shopName'=>$sArray[$i]['shopName'], 'shopAddress'=>$sArray[$i]['shopAddress'] ), array('shopId'=>$sArray[$i]['shopId']));                  else    // add new records                 $wpdb->insert( 'wp_shops', array( 'userId'=>$sArray[0]['userId'], 'shopName'=>$sArray[$i]['shopName'], 'shopAddress'=>$sArray[$i]['shopAddress'], 'shopLat'=>45, 'shopLng'=>20 ));         }     }


title: WordPress Auto-Closing tags on Pages

text: I have a page, pretty much all of them, that has markup on it. Basically, some opening div tags followed by some content... the closing div tags occur in the widget area that is called into the page. The problem I'm having is that when I edit the page in Visual Mode and click Update, WordPress is closing those div tags prematurely. Is there a way to stop this? The Raw HTML plugin didn't work, neither did unchecking the "WordPress should correct invalidly nested XHTML automatically" box (although I think that just applies to posts). Any ideas on how to stop WordPress from unnecessarily closing tags?


title: Add "Last Edited by" column to custom post type list table

text: Currently I use the "Admin Columns Pro" plugin for Wordpress to modify some of the columns in the backend. The plugin contains functionality to display the post (or in my case, product) author as a column. However, I'm in a position where I need to see who the most recent editor of the product is. Basically what we've got now is one individual creates a product draft, then someone finishes it, and I need to see both of those names (one creator, and one the_modified_author). The plugin contains documentation to create custom columns, and I've tried to follow it, but I can't seem to get "the_modified_author" to pass through. Any thoughts?


title: Disable Debug Log Programmatically

text: I'm trying to disable `WP_DEBUG_LOG` if and only if `debug.log` exists. I'd like to hook into `wp_footer` and test if the file exists and if so disable my debug log. All I've found though is that `WP_DEBUG_LOG` is a constant and can only be changed from the `wp-config.php` file which is too early for my case. Is there a way to change it from a constant on install and keep it working as normal? My only other thought is to create an option on install in the options table and just check it every time `wp-config` loaded to see if the value has changed but I was wanting to avoid that. Granted I could check if the file exists before I define `WP_DEBUG_LOG` but somebody would have to view a page twice before debug log actually exists and is detected by the `file_exists()` (since it's run very early) which is not optimal. Does anybody know of a workaround to programmatically turn off `WP_DEBUG_LOG`?


title: Using Heroku, need to have non-gravatar avatars, but not stored locally

text: So, I am new to PHP, so I'm hoping to do this with a plugin, if possible. We are hosting on Heroku, this means uploading a local image to /uploads isn't going to work for this. We need to be able to reference the individual user's avatar from our hosting at Amazon s3 (they don't need to be able to upload it themselves, we have a limited number of authors). We need a way to set the avatar to look to our s3 URL. Is there a plugin that asks for a URL for an avatar instead of a local file? Thank you.


title: Settings API - how to update options manually?

text: I'm storing all my options using Settings API:               function registerSettings() {          register_setting('XX_theme_settings', 'XX_theme_settings', 'setting_validate' );          add_settings_section('theme_options', 'Theme Options', 'theme_options_generate', 'page1' );      add_settings_field( 'XX_Option1', 'Option 1', 'text_input', 'page1', 'theme_options', 'XX_Option1' );     add_settings_field( 'XX_Option2', 'Option 2', 'text_input', 'page1', 'theme_options', 'XX_Option2' );           };          add_action('admin_init', 'registerSettings');      Let's say I want to update XX_Option2 manually (not using forms, but via PHP), how should I do that? I was thinking about `update_option('XX_theme_settings[XX_Option2]', value)`, but that doesn't work (?).


title: How to add a custom font in a theme

text: I want to add a custom font into my theme. Please let me know if this is just as simple as uploading the font to a new folder named "fonts" and then changing the css and renaming the font-family property there or it's somewhat different procedure. I am not sure about it. Please help me.


title: Why I am having error Call to undefined function get_header()?

text: I am using twenty eleven for my theme and I create a PHP page under it named results.php in the results.php here's my code:               <?php     get_header(); ?>     <?php get_footer(); ?>      From my index.php:               get_header(); ?>     Main     <?php get_footer(); ?>


title: Highlight current category in wp_list_categories

text: I am using `wp_list_categories` to display all terms of my custom taxonomy `'categories'.` The function is outputting all my terms successfully but the current category is not being highlighted, even though `'current_category'` is set to `1` in my arguments. The function is being outputted on `taxonomy-categories.php`, following the naming convention of my taxonomy `categories`. It is not inside a loop, could that be why? UPDATE, here is my function:               $args = array(         'orderby'               => 'term_group',         'title_li'              =>  NULL,         'order'                 => 'ASC',         'hide_empty'            => 1,         'use_desc_for_title'    => 0,         'feed'                  => '',         'hierarchical'          => 1,         'echo'                  => 1,         'current_category'      => 1,         'taxonomy'              => 'categories'     );     echo wp_list_categories($args);      Note: this works on my `single-{post-type}.php` template, but does not function on my `taxonomy-{taxonomy}.php` template.


title: How to wrap admin menus and menu headers in additional divs without modifying the WordPress core?

text: I need to do this to enable advanced styling options via css, the one a class the headers are wrapped in isn't adequate to do the type of styling needed. Thanks!


title: Updated Files Dont Show on Site. I had a cache program installed

text: Could that be the reason? I deleted the plugin files but the pages still won't update. When I edit them from the server I see the updated files, but they don't show on the browser. Tried deleting cache on browser, still no changes. Removed cache code from .htaccess, still no changes. Not sure what else to try. Thanks.


title: Warning! PHP safe mode enabled!

text: I just installed WP Super Cache plugin and enabled all settings which were suggested by this plugin. After doing it I am seeing a warning. Warning! PHP safe mode enabled! What is this? What should I do? How will it effect my blog?


title: Determining what post is displayed out of total posts found

text:
On my page I've got a query that retrieves posts with specific parameters and I'm displaying one post per page with pagination. I've figured out how to get the total count of posts found by the query. I want to add some navigation that essentially says "You're looking at 'n' of 25 posts" and have 'n' increase or decrease as the user clicks through the 'Next Post/Previous Post' links. Is there a function already in place for this? Here's my query and how I'm outputting it to the page:               <?php             $display_count = 1;             $page = get_query_var('paged') ? get_query_var('paged') : 1;             $offset = ($page -1)*$display_count;             $query_args = array(                 'post_type' => 'post',                 'orderBy' => 'date',                 'order' => 'desc',                 'number' => $display_count,                 'posts_per_page' => 1,                 'page' => $page,                 'offset' => $offset                 );             ?>
           <?php $portfolio = new WP_Query($query_args); ?>
 <?php echo "There are ".$portfolio->found_posts." Planning Projects"; ?>

                      <?php previous_posts_link( '<< Previous Posts | ', $portfolio->max_num_pages ); ?>                     <?php next_posts_link( 'Next Posts >>', $portfolio->max_num_pages ); ?>
             <?php if( $portfolio->have_posts() ) : while( $portfolio->have_posts()) : $portfolio->the_post(); ?>
<?php the_title() ?> <?php echo get_post_meta($post->ID, 'project_location', true) ?> { <?php echo get_post_meta($post->ID, 'project_services', true) ?> }
             <?php the_content() ?>             <?php endwhile; endif; ?>             <?php wp_reset_query(); ?>


title: How to retrieve image from URL and set as featured image/post thumbnail

text: Given a Vimeo ID, I can retrieve a thumbnail from the video via Vimeo Simple API. Rather than call the API every time my page loads I want to set the image as the post thumbnail using the `save_post` hook (similar to this question). My problem is that I am not familiar with URL calls in php. I would like to know:   1. the benefits/drawbacks of using a method like curl compared to `WP_Http`. Is one "better" than the other?   2. the order in which I should call functions to successfully set the post thumbnail. Any help would be greatly appreciated.


title: anything like add_meta_box for categories?

text: I want to add few custom fields to categories. So I am looking for something like `add_meta_box` but for categories. Is there any **WP function** like that for **categories**?


title: Can't sort Posts in wordpress Dashbaord

text: I'm using WordPress 3.1., and I can't sort the posts in the Dashboard/admin area by date or post title. Edit: i just noticed it only happens with this theme im using, how could this be fixed?


title: Why can't I exclude private posts from this query?

text: My WP query to fetch some custom posts should exclude private posts, but this query is returning all posts, not just public ones: `$wp_query = new WP_Query( 'post_type=listing&post_status!=private&posts_per_page=9&meta_key=location_level1_value&orderby=location_level1_value&order=ASC&paged='.$paged);` I've also tried using post_status=-private, but that didn't work either... What have I done wrong?


title: How can I customize the link when an attached image is clicked?

text: I have attached several images to a post. When viewing the images in the theme, each image is linked to a larger version of itself. I would like to change this link to direct to a specific URL. However, when I change the URL under "Link URL" under attachment options, the link does not stick after clicking "Save All Changes". It always reverts to the link to the image itself. Is there another way to create custom links on attached images? Note: I'm not trying to alter the link TO the image, I'm trying to create a custom link href when the image is clicked.


title: Use latest jQuery in WordPress (admin interface)

text: I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created). I tried this:               // jQuery 1.x     wp_register_script('jquery1x', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, null, true);          // jQuery UI 1.8.4 PTBR     wp_register_script('jquery-ui-custom-pt_BR', THEME_URL . 'js/jquery.ui.datepicker-pt-BR.js', array('jquery1x'), null, true);     // jQuery UI 1.8.4       wp_register_script('jquery-ui-custom', THEME_URL . 'js/jquery-ui-1.8.4.custom.min.js', array('jquery1x', 'jquery-ui-custom-pt_BR'), null, true);          // jQuery UI 1.8.4 CSS      wp_register_style('jquery-ui-custom-css', THEME_URL . 'css/smoothness/jquery-ui-1.8.4.custom.css');          wp_enqueue_style('jquery-ui-custom-css');     wp_enqueue_script('jquery-ui-custom');      And it worked but on other WP admin pages I got some jQuery errors because the overrides of jQuery (since it's loaded twice). If I "deregister" the jQuery and register it again (using the latest) it won't work. That's not the first time that I ran into this problem... All I need is to use the latest version of jQuery on my WordPress admin interface to use some features like Datepicker and Colorpicker.. But until now I can't do this using `register_script`. If I register it with "jquery" name, it won't update because there's already a jQuery loaded by WordPress on this line:               <script type='text/javascript' src='http://website.com/wp-admin/load-scripts.php?c=1&load=jquery,utils,nav-menu&ver=2b05c108d9016a4caa470b8edaf40953'></script>      And I can't hack into this **load-scripts.php** file to change the filename since I don't want to change the WordPress core.


title: Entities in URL... why?

text: A user creates a post with the following url:               http://mysite.com/entry/we’re-here/      However, my text editor converts it to this automatically (I'm using the url somewhere else in a cut and paste):               http://mysite.com/entry/we're-here/      And this url fails. It's because of the different apostrophe in `we're` I think the first one is from MS Word (maybe?) and that is what the user is working from when entering text. **My question is, should there be a way to automatically convert such entities so they are not potentially misinterpreted? Or should I just tell my text editor to not convert stuff?** It seems like relying on the specific entity that that apostrophe is for a working URL is just asking for trouble at some point. Is this not UTF-8? Ugh... always getting confused about entities.


title: Sub-category and category in permalink structure

text: Is there any way (plugin or function), to include the sub-category and the category automatically in the permalink structure? I want an URL structure like this: `category/subcategory/posttitle/`


title: Content too large to display?

text: I have made a post and it does not show the content of the post when the content is too large.If I insert a smaller content it shows normally. Any idea what is wrong? I have turned on the debug but it does not show anything.


title: Excluding a category from wp_query breaks recent post widget

text: Good Afternoon, In my theme I have two separate pages for blogs. The main blog page, "news.php", holds our standard news, thoughts, events type of posts. The second blog, "questions.php", holds blog postings of only the "Ask a Question" category. In my sidebar I've included the default "Recent Posts" widget. On the main blog page, the query is set up like so to exclude the "Ask a Question" category:               $args = array (         'posts_per_page' => 7,         'cat' => -16,         'paged' => $paged,     );          $wp_query = new WP_Query( $args );      On the Ask a Question blog page, the query is set up like so, to only display the "Ask a Question" category:               $args = array (         'posts_per_page' => 7,         'cat' => 16,         'paged' => $paged,     );          $wp_query = new WP_Query( $args );      Everything seems to work nicely until you get to the "Recent Posts" widget. In the standard news page, the widget displays just fine, showing the proper listing of blog posts. However, on the Ask a Question page, the widget is showing pages, as well as postings, some of which do not exist. For example this is on the list: >   1. 738 >   2. Resources >   3. Another test post? I THINK SO! >   4. TEEEEESSSSSSTTTTT POST!!! >   5. pump up the jam, pump it up! > If I comment out the category listing from questions.php in the query, everything works fine. So the line that causes a problem is:               'cat' => 16,      I was hoping that someone may be able to help me understand why this is occurring, or possibly how to fix it. Thank you for your time and attention, it is greatly appreciated. Matt


title: Taxonomy/category hierarchy lost when editing posts

text: When editing a post the tree structure of the taxonomy seems to be lost, ie; if I set the following when adding a post: [x] Top tier category 1   - [x] Cat 1 sub-category 1   - [ ] Cat 1 sub-category 2   - [ ] Cat 1 sub-category 3   [ ] Top tier category 2   - [ ] Cat 2 sub-category   [ ] Top tier category 3   - [ ] Cat 3 sub-category   Then go back into edit the post it displays the categories as follows, only keeping the tree structure for the categories selected: [x] Top tier category 1   - [x] Cat 1 sub-category 1   [ ] Top tier category 2   [ ] Cat 2 sub-category   [ ] Top tier category 3   [ ] Cat 3 sub-category   [ ] Cat 1 sub-category 2   [ ] Cat 1 sub-category 3   As you can see it just displays them all of the non-selected categories as a flat list and to confuse things even more it seems to move any sub-categories not selected to the bottom. Needless to say when dealing with large taxonomies keeping the tree structure is important otherwise obviously its not possible to see which is a parent of which. Does anyone have any ideas how to overcome this? Am running the latest version of WordPress 3.2.1, is this a known bug?


title: Including all post id's of a custom post type into an array

text: For my single.php (products.php), I try to build a navigation via which the user can switch between products based on the meta key "price". I want to put all id's of the products post type into an array and then identify the previous and next product for the navigation, based on the price meta key. Somehow I don't manage to get the code work: **SINGLE.PHP**               <?php     // Setting up the loop     $args = array(     'post_type' => 'products',      'post_status' => 'publish',     'meta_key' => 'price',     'orderby' => 'meta_value_num',     'order' => 'ASC',     'posts_per_page' => -1     );     $posts_query = new WP_Query($args);          // Setting up the array in which ALL IDs of all product posts will be stored     $posts = array();          // Starting the loop     while ($posts_query->have_posts()) {         // Including the post IDs one by one             $posts[] += $post->ID;     }          $current = array_search(get_the_ID(), $posts);     $prevID = $posts[$current-1];     $nextID = $posts[$current+1];          if (!empty($prevID)) { ?>     <a href="www.example.com/post_type=products&post_id=<?php      echo $prevID; ?>">previous product     <?php }     if (!empty($nextID)) { ?>     <a href="www.example.com/post_type=products&post_id=<?php      echo $nextID; ?>">next product     <?php } ?>      Does anyone see the error(s)?


title: Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin

text: I'm trying to write to an XML file in a WordPress Plugin. I'm on my local machine, a Mac running MAMP. I have PHP 5.2.13 My code is:               $file_handle = fopen('markers.xml', 'w');     $stringdata = "Test Info";     fwrite($file_handle, $stringdata);     fclose($file_handle);      I get the following error: > Warning: fopen(markers.xml) [function.fopen]: failed to open stream: > Permission denied in /Users/my_name/Sites/my_site/wp- > content/plugins/my_plugin_folder/my_plugin_main_file.php on line 73 > > Warning: fwrite(): supplied argument is not a valid stream resource in > /Users/my_name/Sites/my_site/wp- > content/plugins/my_plugin_folder/my_plugin_main_file.php on line 75 > > Warning: fclose(): supplied argument is not a valid stream resource in > /Users/my_name/Sites/my_site/wp- > content/plugins/my_plugin_folder/my_plugin_main_file.php on line 76 markers.xml has permissions set to 777. Any suggestions on how to solve this problem? Thank you.


title: Wordpress 3.2 Admin UI Guide

text: Is there such a guide somewhere so that I could use standard UI elements (especially since the 3.2 rewrite) instead of marking up my own? Like the Categories metabox tabs for example.


title: Lost administrator privileges and can't find a fix

text: * WordPress 3.5.1    * Web Host: Windows Azure Cloud    * Database Host: Cleardb   * Web Server: IIS 7.5 I've built a custom child theme that runs on the Genesis Framework and it has multiple custom post types and metaboxes. Multiple plugins installed on the site as well. Since yesterday my admin user **can no longer perform** the following tasks:   * Add new posts or pages (I can update existing ones). When I add a new page, I get a "Publish for Review" option only.   * Update posts.   * Enable / disable plugins (I get all the success messages like "Plugin activated successfully", but nothing seems to register on the db).   * Activate / deactivate themes. I read that one cause for this is the database being full, which results in losing admin privileges, but have checked and the database is not full. I have access to the source code and have tried to manually install plugins like 'wp-optimize', or manually add another admin user but no luck. Nothing gets written to the database. Does anyone have any other tips or suggestions on other things I can try? Many thanks!


title: How to detect single.php (but not single-portfolio.php)?

text: When I'm using `is_single();` in my `<head>` section to add some style to website navigation it executes correctly on blog posts but it also executes on single "portfolio" post type posts (so single-portfolio.php and single.php). How do I make it execute only on single.php?


title: wordpress query_posts featured page always on top

text: I'm using the query_posts for "Page" item rather than "Post". I want to have the ability to make the "featured" page always on the top, we could add a custom field called "featured_product", if it's eq "1" then display the post as the very first one. Here is the basic code for the query. Someone help please!?               <?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC')); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     ...                                  <?php endwhile; else: ?>     ...     <?php endif; ?>


title: Query posts by category AND custom field, then ORDERBY another custom field - help!

text: OK I need to query posts using the following criteria: category_name=office, meta_key=featured_post, meta_value=Yes and order these results using a second custom field which has a numerical value meta_key=prop_order I have the following query which pulls the correct posts, but doesn't order them by the second custom field.               <?php $recent = new WP_Query("category_name=office&meta_key=featured_post&meta_value=Yes&posts_per_page=3&orderby=date&order=ASC"); while($recent->have_posts()) : $recent->the_post(); ?>      However since I'm already using a custom field in the query I can't use orderby=meta_value. I found the following SQL query on the forums but can't get it working.                   <?php      global $wpdb;      global $post;      $querystr = "     SELECT * FROM $wpdb->posts     LEFT JOIN $wpdb->postmeta AS proporder ON(     $wpdb->posts.ID = proporder.post_id     AND proporder.meta_key = 'prop_order'     )     LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)     LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)     WHERE $wpdb->term_taxonomy.term_id = 3     AND $wpdb->term_taxonomy.taxonomy = 'category'     AND $wpdb->posts.post_status = 'publish'     AND $wpdb->wpostmeta.meta_key = 'featured_post'      AND $wpdb->wpostmeta.meta_value = 'Yes'      ORDER BY proporder.meta_value ASC      ";           $pageposts = $wpdb->get_results($querystr, OBJECT);          ?>      Any help would be greatly appreciated! Thanks Dave


title: How to remove header image on subpages in Twenty Eleven (default theme)?

text: I'd like to remove the header image on all the pages except my "home"-page. Any ideas? Thks


title: Search in Wordpress - Difference of searchpage.php, searchform.php and search.php?

text: I'm sorry for this scholar question, but I'm totaly confused with search in Wordpress. What is the difference beetwen `searchpage.php`, `searchform.php` and `search.php`? Could anybody tell me how it all works? Thanks.


title: allow editors to edit menus?

text: I would like to be able to grant my editors the power to change the menu, can this be done? The appearance tab doesn't appear to be an option at all, can I make it so?


title: Authentication over CURL

text: I am working on an API for a WordPress site. Basically, an external application (not made using WP) is able to send JSON to a file I made (`api.php`) and inside that file I load WP (using `wp-load.php`), and create a post (custom post type) based on the received JSON. When I reach this block of code...               $formation_fr = wp_insert_post( array(         'post_type' => 'formation',         'post_title' => 'example post',         'post_status' => 'publish',         'post_author' => 2 // This is an admin account associated with this ID     ) );      ... the post gets created, and everything works except for the `post_author` (instead, there is no author for the post). But, my external application that sent the CURL request will receive this:               Error: call to URL http://domain.com/api/api.php failed with status 500, response          Alors, on triche ?     , curl_error , curl_errno 0`      The "Alors, on triche?" error is the "Cheatin' uh?" error in French. WordPress for some reason thinks that I'm trying to circumvent capabilities. If I try to log in the user (ID: 2) programmatically with this block of code...               private function login( $id )     {         $wp_account = get_user_by( 'id', $id );         $username = $wp_account->data->user_login;         wp_set_current_user( $wp_account->ID );         wp_set_auth_cookie( $wp_account->ID );         do_action('wp_login', $username );     }      ... then I get this:               Error: call to URL http://domain.com/api/api.php failed with status 500, response , curl_error , curl_errno 0      Which is basically the same error as above but without the "Cheatin' uh?". I didn't expect that to work though, because AFAIK a cookie won't affect a CURL connection. So, how can I avoid running into capability errors when working over CURL? I've used `wp_insert_post()` many times before and never had this issue. My temporary hacky solution is to erase the `wp_die()` function, which fixes the issue obviously. WordPress version is 3.9.1


title: Blog search doesn't fine results for exact title?

text: The search works fine for the website if you limit your matching keywords. However if you search the exact title it returns no results. Here is the site I found this in the functions.php               function wpse18703_posts_where( $where, &$wp_query )          {             global $wpdb;             if ( $wpse18703_title = $wp_query->get( 'wpse18703_title' ) ) {         $where .= ' AND (' . $wpdb->posts . '.post_title LIKE \'%' . esc_sql( like_escape( $wpse18703_title ) ) . '%\' or ' . $wpdb->posts . '.post_content LIKE \'%' . esc_sql( like_escape( $wpse18703_title ) ) . '%\') ';         //$wpdb->prepare( ' AND ({$wpdb->posts}.post_title LIKE %s ', esc_sql( '%'.like_escape( trim( $term ) ).'%' ) );     }     return $where;          }          add_filter( 'posts_where', 'wpse18703_posts_where', 10, 2 );      Thanks


title: Display the number of published posts for each custom taxonomy term?

text: I do have a custom taxonomy called "countries". How do I get each term (country) with the number of its published posts in brackets, like the following:   * Uruguay (3)   * Chile (5)   * Thailand (2)   * etc. With following code the number of all terms in the "countries" taxonomy is displayed:               $countries_count = wp_count_terms( 'countries' );     echo $countries_count;       But I just know that this is just a starting point of my problem. Any suggestions?


title: How to change prices per number ordered in WooCommerce

text: Does anyone know a way to make the price of a second item different from the first in WooCommerce? I tried setting up the product so the first item was $245, second is an additional $150. I used variations and added $150 to each additional variation option. This works fine if users snag their item from the drop-down menu. However, if they up the number manually below the drop down or in the cart (using the arrows), it makes every item $245. Is there a clever way to fix this? This is visible on: http://cope24.com/shop/cope24-parenting- skill-program/ Thanks!


title: jQuery breaking my wordpress site

text: I am including jQuery in my `header.php` file like this:               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>      But when doing this, it breaks my home page slider, it breaks my google maps ultimate plugins and some other things. When I exclude it, no custom jQuery runs on my page...only the slider works which must be using jQuery... So if jQuery is already running on my site (since I have jQuery easing in the theme etc..), why is custom jQuery code I add to my files in tags not working? However, when I include jQuery like I said above, my custom code runs, but it breaks other plugins... Why is that?


title: Split submenu displaying the description underneath

text:
By using the below class, I was able to extend the Walker_Nav_Menu and display the description under the link. I'm working with an UI that requires to have submenu split that also display the description undeneath. Can somebody help with this?               class deMaster_Walker extends Walker_Nav_Menu     {       function start_el(&$output, $item, $depth, $args)       {            global $wp_query;            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                 $class_names = $value = '';                 $classes = empty( $item->classes ) ? array() : (array) $item->classes;                 $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );            $class_names = ' class="'. esc_attr( $class_names ) . '"';                 $output .= $indent . '
ID . '"' . $value . $class_names .'>';                 $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';            $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';            $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';            $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                 $description  = ! empty( $item->description ) ? ''.esc_attr( $item->description ).'' : '';                 if($depth != 0)            {                      $description = $append = $prepend = "";            }                  $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;             $item_output .= $description.$args->link_after;             $item_output .= '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );             }     }


title: Add site options UI in Multisite Sites > Infos page

text: I want to add meta fields for the sites in my network (such as a thumbnail and a category). I know how to do this using `get`/`add`/`update_site_option`, but I'm wondering where I could put the UI to manage those meta fields. The best place would be in the Sites > Infos page, just after the site attributes, but I can't find any hook to hang on. I can add those fields in the "Settings" tab of the same screen, but one has to scroll down a lot to find it, and it gets mixed with advanced settings. Any suggestion ?


title: How about many "require_once" will affect the page load speed?

text: In the `functions.php` I pretty much use the function `require_once` to call about 30 files in my wordpress theme. (30 times use `require_once`) How about that will affect the page load speed? Have there any way to more optimally?


title: Get selected value with PHP and jQuery

text: I have form that i'm using to update user profile from front end and i have country select.               <form method="post" id="adduser" action="<?php the_permalink(); ?>">          <select id="te" name="usercountry_id">     <option value="1">Country 1</option>     <option value="2">Country 2</option>     </select>          <p class="form-submit">     <?php echo $referer; ?>      <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />     <?php wp_nonce_field( 'update-user' ) ?>     <input name="action" type="hidden" id="action" value="update-user" />     </p><!-- .form-submit -->     </form><!-- #adduser -->      When i try to update               $usercountry= $_POST['usercountry_id'];     update_user_meta($id, 'usercountry_id', $usercountry);      my `$_POST['usercountry_id']` is empty. Also i tried using jQuery to pass variable to php but with no success:                jQuery("#te").click(function() {         var b =jQuery('#te :selected').text();                var ajaxurl ='<?php echo get_bloginfo("url"); ?>/wp-admin/admin-ajax.php';            jQuery.ajax({             type: 'POST',             url: ajaxurl,             data: {"variable": b },              });});      `$_POST['variable']` is again empty.


title: What is the php function for "user's public profile"

text: My header looks like this. ![enter image description here](http://i.stack.imgur.com/5yjzv.png) I chnaged my author base from "author" to "user" So the user profile url looks like this. http://example.com/user/username What is the php function to get this url. I'm using like this               <a href="<?php echo esc_url( home_url( '/' ) ); ?>user/<?php echo $current_user->user_login ?>"><?php echo $current_user->user_login ?>      Its working. But its hard coded. Is there any other php function to get the url?


title: Frontend Form for Custom Post Type

text: I want to add frontend post to custom post types. Till now I have figured out how to do it but only to the regular post type(not custom post). I am using this code. ( _Couldn't paste it here hence please find it atPastebin_) Need to know what code can be added to make the code applicable to custom post type(such as "books" or "places")


title: Contributor post to be reviewed and published by only one editor

text: I am trying to find a way/plugin where the posts of a contributor can only be edited or published by a specific user editor. Like for example, if I have a contributor named Steve and an editor named Bob, Steve's posts/draft should only be reviewed and published by Bob who is assigned to the contributor. No other editors (except admin of course) can "touch" the work of Steve, only Bob can. Is this possible? I tried the plug-in Members but I can only restrict the review and publishing of a contributor's post to a user role and not to a specific user.


title: Moving a Wordpress Multisite site to a new install

text: Is it possible to move a WP site from one network to another? I have a Wordpress multisite and I'd like to take one of the sites and move it into a new multisite installation.


title: One-time bulk MySQL copy post_date values to Advanced Custom Field (date field)

text: ## Disclaimer First of all let me say this is probably mostly MySQL related and unfortunately I'm nearly a total newbie on database language and commands. ## The problem Situation is a site running Wordpress where, until now, a **Custom Post Type** was used to publish elements that needed to be displayed ordered **by date** (using the "standard Wordpress date picker"). From now on I want to order these elements using an **Advanced Custom Field** (thanks to the so-called plugin). ## Solution needed Before going on with that change, I need to find a quick one-time solution, for all the current Custom Posts (> 120), to copy their **post_date** values (in the **wp_posts** table) to the new Advanced Custom Field (of course it's gonna be a date field). Next I'll take care of the front-end changes (and I should be able to do that on my own). ## Is this feasible? From what I've seen until now, Advanced Custom Field data is stored into the **wp_postmeta** table. For every "meta_value" I see two rows in that table, both "linked" to the **post_id** , the first contains the value itself, the second something that looks like the field ID (I hope I'm not completely out of track...) An example:               meta_id   post_id   meta_key            meta_value        985       34        _publication_date   field_521de803e3c7c     984       34        publication_date    20120112      Any advice on how to make this one-shot copy of these data? I suppose this can be done with a pretty easy MySQL command. PS: as you may already know, Advanced Custom Field let me decide the date format: is there a preferred format to make the goal easier?


title: Get last 5 days with posts

text: I am trying to get a solution to this question of mine   http://stackoverflow.com/questions/18487639/date-base-archive-on-wordpress- homepage I am trying with multiple loops, if thats possible. But I need to know whether a day has posts or not. Is there any way I can get last 5 days that has posts and create loops for them? Something like this               <?php     $last5days = $wpdb->get_var("SELECT DATE(MAX(post_date)) FROM {$wpdb->posts} LIMIT 5");          $day1 = $last5days[0];     $day2 = $last5days[1];     $day3 = $last5days[2];     $day4 = $last5days[3];     $day5 = $last5days[4];          // The Query     $query1 = new WP_Query( array('post_type' => 'products', 'posts_per_page' => 3, 'day'=> $day1) );          // The Loop     while ( $query1->have_posts() ) {         $query1->the_post(); ?>         <!-- My Loop Codes Goes Here -->     <?php     }     wp_reset_postdata();          /*      * The Rest Loops Goes Here     */          $query5 = new WP_Query( array('post_type' => 'products', 'posts_per_page' => 3, 'day'=> $day1) );          // The Final (5th) Loop     while( $query5->have_posts() ) {         $query5->the_post();?>         <!-- My Loop Codes Goes Here -->     <?php     }     wp_reset_postdata();     ?>


title: Snippets: is it better to add them in functions.php or make site-specific plugins?

text: Should "snippets" (short code or functions) be added to:   1. the theme's functions.php? OR   2. make site-specific plugins? Which is better from technical, security, performance, etc., standpoint? Besides the reason that during an upgrade the theme's functions.php may get overwritten, what would be the other reasons to make create site-specific plugins out of the "snippets?


title: add/apend templates 'transparently' via plugin to currently active theme or child theme?

text: Cross posting my trac question here in the slim hopes that someone here has run into the same issue and has already come up with some proof of concept code I can try: In building a custom 'theme plugin' for bbpress I was just made aware that it is impossible for a plugin to 'transparently' add/append template files to the currently active theme or child theme. I'd like to request the enhancement where when a theme is looking for a custom template such as single-forum.php to search a plugin folder if it is not found in the child theme or parent theme. I'm thinking of some type of action where my plugin can say 'add me' to the list of places you are looking for templates. If my understanding is correct, when WordPress is looking for a template it starts in the child, then the parent theme but ends there. Why? If I have a user manually add all of the custom templates needed to their current theme, and they update their theme, they will loose all the templates they manually added. This means I have no way of giving a user custom theme templates that won't be lost when upgrading, thus requiring them to manually add the templates back in every time they upgrade their theme. What it really means for me is that there is no real path for me to create custom bbpress templates for users where I don't have to worry about them loosing them. I can go the route that bbpress currently uses in this situation which is that bbpress uses the themes page.php template and replaces the_content(). The problem is I am stuck with whatever is included in the active themes page.php file. *for instance twentyten has the title hardcoded in and the call to the sidebar, which I can't remove I can't go the child theme route, because I have to assume that they are already using a child theme. Another dev told me today that this issue came up about 2 years ago. I am praying that there was proof of concept code somewhere that I can try to utilize. Does anyone happen to know if concept code exists anywhere? **strong text**


title: If statement with two custom post type's but showing only one

text: I'm trying to think of a way to create an if statement in which it checks if two fields from two different cpt's are the same. Is there a way to do that without showing one of the two cpt's on the front page(Since when showing one of the two and having an array at post type you're forced to show both unless one is draft). ACF structure: Company type(Field group)>categoryid(Field)/filter_id(Field) Filter type(Field group)>filterid(Field) Example code:                       $args = array(                 'post_type'      => array('company','filter'),                 'posts_per_page' => -1,                 'orderby'        => 'title',                 'order'          => 'ASC'             );                  //Say there are two fields(ACF fields) assuming $catid and $filterid are from company and $filter_id from filter                 $catid     = get_field('categoryid');                 $id        = get_field("id");                 $filter_id = get_field('filter_id');                  $query = new WP_Query( $args );               if ( $query->have_posts()) {                 while ( $query->have_posts()) {  $query->the_post();                   if($catid == $id){                      echo $filter_id;                   }                 }               }      Now the problems would be:   1. Both post type's show while the only post type I want to see is company.   2. If changing filter to draft it would for starters hide it but also make it unable to use the field of the post type. Now my question is, how can I effectively create an if statement using both fields to show another field from two different CPT's? The reason for this is because i'm creating a filter, by using JS and essentially i'll try to just show the field values in the output and use those values with my JS filter.


title: How to create and work with custom data / tables (i.e., for arbitrary data)?

text: Getting started on Wordpress just today. I noticed that Wordpress created tables in a mySql database (with name *.wrdp1) when I first set it up. These tables cover comments, posts, users, and some link-relationships. Now, let's say I would like to work with a new set of data. Suppose I were to create a page with two things:   * a _textfield_ , where my users can enter a number between 1 and 10   * a _chart_ , which displays the frequency of numbers historically entered by my users My guess: For something like the above, I suppose I will have to set up **a custom table/data-set in the database** , such that this number data can be written and then read. (I am also guessing that I will have to use some PHP, in order to store the number from the textfield to the database, and later to read the numbers back.) **Can someone outline what a recommended approach in this case would be, roughly?** (I can thereafter research the exact details myself.)


title: Display posts with custom post type and custom taxonomy

text: I have several different post types, and those post types have the same taxonomies linked to them. When I click one taxonomy, all of the different post types in that taxonomy is displayed. I ONLY want the custom post type page that I am currently in AND the taxonomy I clicked to display. I don't even know what to google for or how you should solve this question.


title: Resetting Themes Folder to Default

text: I recently unzipped a folder into my themes directory. However unlike other themes this one was not contained in a top-level folder. So it just dumped about 50 files directly into the themes folder. Is there a way I can effectively reset the themes folder so I don't have all these excess files? Otherwise I'm considering a fresh install.


title: How can I change the term "Published" next to # of posts published on WordPress dashboard All Posts page?

text: On the posts page, there are a few columns listing types of posts with their corresponding number: All (#) Published (#) Trash (#) How can I changed "Published" to "Saved"?


title: Why am I getting a white screen without a slash at the end of the address?

text: I am currently building a custom Wordpress theme for my rugby team. I just noticed something and I can't work out whether this has been happening for a while and I have only just noticed it or it is a new thing. It would appear that any page address without a slash at the end of the address renders a white screen of death. For example               (url)/fixtures/      works fine but               (url)/fixtures      Gives me a WSOD


title: Gravity Forms ExactTarget Add-on Plugin: Nothing happens after step 2 when creating a new feed

text:
This looks like a great plugin. When creating a new feed, I check the appropriate ExactTarget list(s) in Step 1. Step 2 appears prompting me to select a Gravity Form, but when I choose a form nothing else happens. My browser inspector was showing the AJAX request to .../wp-admin/admin- ajax.php with a status of 200, but its response content was this:
     Fatal error:  Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in /.../wp-includes/functions.php:1038     Stack trace:     #0 /.../wp-includes/functions.php(1038): serialize(Array)     #1 /.../wp-includes/functions.php(615): maybe_serialize(Array)      #2 /.../wp-includes/functions.php(805): add_option('_transient_extr...', Array, '', 'no')     #3 /.../wp-content/plugins/gravity-forms-exacttarget/api/ExactTarget.class.php(237): set_transient('extr_attributes', Array, 86400)     #4 /.../wp-content/plugins/gravity-forms-exacttarget/exacttarget.php(1018): ExactTarget->Attributes()     #5 [internal function]: GFExactTarget::select_exacttarget_form('')     #6 /.../wp-includes/plugin.php(405): call_user_func_array(Array, Array)     #7 /.../http in /.../wp-includes/functions.php on line 0
      Any ideas? Thanks.


title: query_posts not reading correct categories

text: I'm using this code (below) to display posts from a category on two separate pages. The first page lists category 32 and the other lists category 31. However, on the second page it displays posts from both categories and the first page doesn't display all the posts from its category. The first page has 13 but there are only 10. The second page displays 14 but there are 19. I have no code to tell the page to only display a certain number of posts. Any idea why this is happening?               <?php     query_posts('cat=32');     while (have_posts()) : the_post();     the_content();     endwhile;     ?>      I was previously using list_category_posts plug-in but I thought this was an easier solution.


title: Change post_date to post_modified date on post template?

text: I'm looking to change the post created date to a modified date on my post template (single.php). Moreso, I'm looking to control when I update that date based on whether I make significant changes to the post. I'm thinking I might have to create a custom field as well as an option box in the edit post screen to set the custom field. Maybe there's a simpler way?


title: if not empty bloginfo('description')

text: Can someone tell, how to check whether it's empty?               <?php bloginfo('description'); ?>      Something like:               <?php if (!empty bloginfo('description');) ?>      Thanks a lot.


title: Change the order of columns for a custom post type on the admin list page

text: I have created a custom post type (screen shot below), and would like to change the order of columns. Is it possible to move the "tags" column before the "date" column? Screen shot: ![Screen shot](http://i.stack.imgur.com/eGJls.png)


title: What is the best way to associate multiple images to one page?

text: WP has one major problem and that's image handling. Each image is treated as a post and if you "attach" an image to a page, you cannot un-attach it. Without installing a gallery plugin and without inserting them directly in the post, what is the best way to associate multiple images to a page / post? Currently I create 5 custom fields if I want to attach max 5 images. It works, but it's not the best way. Open to suggestions :)


title: Show 10 latest posts only from users with contributors role

text: How to achive this in sidebar.List of 10 latest permalinks(post titles) from contributors ?


title: How to show post(excerpt) from specific category on wp page?

text: I need this on 3 pages, all 3 from different categories, and then to show several post excerpts from all 3 categories in sidebar of home page.


title: Social sharing post's shortlink instead of permalink

text: Is there a way to force a social sharing plugin to use the shortlink each of my WP posts automatically gets (YOURLS service in my case) to pass to the social service the visitor clicked, instead of permalink? If not, it has to be built with that functionality? (not that I have found any that does that)


title: Custom post type - columns order

text: So I have created a custom post type with custom values and customize my custom post type admin columns. **You can seehere how my custom post type is looking in admin panel.** And as you can see I can order by title all posts and I was wondering if I could do same for all columns, like "info" etc. Is it possible? I am using this code, to display columns like I wanna :               //display catalog products in nice list     add_action("manage_posts_custom_column",  "catalog_custom_columns");     add_filter("manage_edit-catalog_columns", "catalog_edit_columns");          function catalog_edit_columns($columns){       $columns = array(         "cb" => "<input type=\"checkbox\" />",         "title" => "Product Title",         "description" => "Info",         "skills" => "Category",          "year" => "Price",            );            return $columns;     }                    function catalog_custom_columns($column){       global $post;            switch ($column) {         case "description":           the_content();           break;          case "skills":           echo get_the_term_list($post->ID, 'atrakcijas', '', ', ','');           break;         case "year":           $custom = get_post_custom();           echo $custom["product_price"][0]; ?>Ls<?php           break;            }     }


title: Make separate text boxes for separate WordPress Custom Fields

text: I am trying to make usability of WordPress custom fields admin easier in my theme. I saw it in ElegantThemes' eStore theme. Only I couldn't figure out how to do it in my custom theme because I couldn't find the code in eStore theme files. I use custom fields for my featured images and it's small thumbnail version. I have to upload both those pictures and from up above on the page, right below the title, copy the link and then choose the right custom key in custom fields below and paste it and the add it. Then repeat the process for another image. ![enter image description here](http://i.stack.imgur.com/VDDjN.png) I wanna make it simple. Make two text boxes and place the upload image button in front of them. As in the image below. ![enter image description here](http://i.stack.imgur.com/4PH9t.png) If possible I even wanna automate the copy and paste process. i.e.: The image link for the full size image automatically shows up in the text box on upload. Even elegant themes doesn't do that, but I would love to. Any ideas on how I can do this. This will make the posting just a bit faster and more importantly make explaining the process to writers much much easier. I am still looking into the code if I can find it. Any help would be greatly appreciated. Thanks in advance.


title: inner anchor scrolling with wordpress

text: i got this page: http://www.amirwebdeveloper.com/blog/common-sense- sensibility-and-accessibility-or-how-not-to-drive-the-surfer-mad-guide im trying to make a inner page anchor:               ....          content          topic 1     bla bla      for some reason it not scrolls.. anyone have a fix for it?


title: List users by last name in WP_User_Query

text: How can I list users by last name ASC when using WP_User_Query? There is an orderby parameter but looking in core it doesn't accept ordering my user meta. Anyone know how to extend WP to allow this ordering by last name?


title: Using get_posts with arguments found in meta keys

text: I am using get posts, but I need to refine the query based on posts where a certain meta_key has a certain value. Something like this               <?php $reviews = get_posts('post_type=reviews&numberposts=-1&   // eg. // location=berkshire');      Is it possible to do this and if so how? Marvellous


title: WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule

text: in `/www/` I have an `.htaccess` file containing:               <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^([^.]*\.less)$ compilers/lessphp.php?file=$1 [R,QSA,L]     </ifModule>      This code works fine, until I'm requesting .less files in `/www/blog/`, where WordPress is located, and has its own `.htaccess` file which contains the standard pretty permalinks mod_rewrite:               <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /blog/         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /blog/index.php [L]     </IfModule>      If I move WordPress's mod_rewrite code to the root, and place it before my own mod_rewrite, everything works as expected:               # BEGIN WordPress     <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /blog/         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /blog/index.php [L]     </IfModule>     # END WordPress          # BEGIN LESSPHP     <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^([^.]*\.less)$ compilers/lessphp.php?file=$1 [R,QSA,L]     </ifModule>     # END LESSPHP      The annoyance here, is any modification in WordPress to do with permalinks means I need to remember to cut the `.htaccess` code from `/www/blog/` and move it to the root. Is there any way I can improve upon my mod_rewrite so WordPress isn't overwriting it, and I can just leave everything where it is naturally placed? I would also rather not need to have two instances of my rule in both root and after WordPress's. Also, WordPress's mod_rewrite rules should be altered, since updating permalink settings will simply overwrite them.


title: post_count not working

text: I've fixed my initial problem but I'd like to know what I was doing wrong.               <?php          $args = array(              'post_type' => 'page',             'post__not_in' => array( $post->ID ),             'post_parent' => '43',             'post_count' => '3',         );         $my_related_posts = new WP_Query( $args );     ?>      Displays 4 results, where I expected 3. I fixed the problem by doing:               <?php          $args = array(              'post_type' => 'page',             'post__not_in' => array( $post->ID ),             'post_parent' => '43',             'post_count' => '3',             'posts_per_page' => '3'         );         $my_related_posts = new WP_Query( $args );     ?>      But what was I doing wrong? Changing post_count seemed to have little or no effect. Thanks


title: [class*="content"]:before css styles in TwentyThirteen

text: i found this css style in css stylesheet od TwentyThirteen theme, i search a lot in WP forum and w2schools and even w3c but i can't find any thing like that. what that means


title: Using wp_list_categories like the the_category (showing just current categories of a post)

text:
fromi'm using wp_list_categories to get an unordered list with headlines (on single.php inside the post-loop):
<?php wp_list_categories('title_li=0');?>
      the thing is: i want to use it in the same way as "the_category" which means that i want to display ONLY the current categories of the post! by now, it dsiplays ALL the categories and subcategories from the system (like it does using it in the sidebar and which makes sense there). is there a way to do it? thanks, Jochen EDIT: actual output (category list with ALL categories from the whole system:

Cat1

Subcat1

Subcat2

Cat2

Subcat1

Cat3

Subcat1

Subcat2

Cat4

Subcat1

Subcat2

      this is good so far! but the expected output i want to get is the same list as above but with just the CATEGORIES FROM THE DISPLAYED POST (not every category form the system)... i think "current" was the wrong word (sorry, i'm not a native speaker)!! for example i open a post (single.php) with the attached category "Cat1" i want to have an output like this:

Cat1

Subcat1

Subcat2

      i hope you can help! thanks...


title: How to add a new meta key and assign timestamp to posts

text: I've been trying to look for a way to create a loop in my website and show posts being read/watched but have not found anything. The only way I can accomplish this would be to create a new meta key (custom field) and assign timestamp as value, that way I can create a loop and use its value to list posts that are being watched within a time range, say 5 minutes. The issue is that I am very very new to wordpress and i dont know how to do this T_T


title: All posts are still shown when adding category argument to query

text:
I've got the following code in my team-type.php file which I'm using to create a custom taxonomy for a member information:               function create_team_taxonomies() {         $labels = array(             'name'              => _x( 'Kategooriad', 'taxonomy general name' ),             'singular_name'     => _x( 'Kategooria', 'taxonomy singular name' ),             'search_items'      => __( 'Otsi kategooriatest' ),             'all_items'         => __( 'Kõik kategooriad' ),             'parent_item'       => __( 'Vanem kategooria' ),             'parent_item_colon' => __( 'Vanem kategooria:' ),             'edit_item'         => __( 'Muuda kategooriat' ),             'update_item'       => __( 'Uuenda kategooriat' ),             'add_new_item'      => __( 'Lisa uus kategooria' ),             'new_item_name'     => __( 'Uus kategooria nimi' ),             'menu_name'         => __( 'Kategooriad' ),         );              $args = array(             'hierarchical'      => true, // Set this to 'false' for non-hierarchical taxonomy (like tags)             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'categories' ),         );              register_taxonomy( 'team_categories', array( 'team' ), $args );     }     add_action( 'init', 'create_team_taxonomies', 0 );      But when I call the query in page-team.php the following way:               <?php query_posts( 'post_type=team&cat=noukogu&showposts=15' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php $title=s tr_ireplace( '"', '', trim(get_the_title())); $desc=s tr_ireplace( '"', '', trim(get_the_content())); ?>
              <img class="image" src="<?php print team_thumbnail_url($post->ID) ?>" alt="liikme pilt">
<?php echo $title; ?>

             <?php echo $desc; ?>

               <?php endwhile; endif; ?>      All of the member posts show up. Not the **noukogu** category posts. Any ideas what might be causing this issue? **UPDATE:** I understand now that **cat** is used for category ID, but when I change it to **category_name** (to use category slug) no posts show up at all.


title: How can I automatically insert the page content as the title?

text: I have a custom post type with no Title field. These are short status messages, where only the content matters. The RSS feed and permalink display the title as Auto Draft, which is not very useful. Ideally, it would have the post content, or at least the first 10 or so words. I've tried this function, but it still appears as Auto Draft:               add_filter('title_save_pre', 'save_title');     function save_title($my_post_title) {             if ($_POST['post_type'] == 'servicestatus') :               $new_title = wp_trim_words( $_POST['content'], $num_words = 10, $more = null )               $my_post_title = $new_title;             endif;             return $my_post_title;     }          add_filter('name_save_pre', 'save_name');     function save_name($my_post_name) {             if ($_POST['post_type'] == 'servicestatus') :               $new_name = wp_trim_words( $_POST['content'], $num_words = 10, $more = null )               $my_post_name = $new_name;             endif;             return $my_post_name;     }


title: Retrieve all the data from the database which is under the farms property type

text: I'm using wp real estate plugin for my property site. I've created 5 property types which is stored in `wp_postmeta` table `meta_key` is `et_er_typeand` the `meta_value` is `farms`. How can I retrieve all the data from the database which is under the farms property type.


title: How to login Separately in each blog?

text: I am creating multiple WordPress sites. When I log in to my main site then I will be logged in automatically in all the blogs that I created in my WordPress Multisite instance. So, I want to separate the log-in for each blog.


title: Is there a filter for get_post_custom()?

text: I know there's a filter get_post_content that I can hook into, but that only seems to work with get_post_meta, I need to filter individual values of get_post_custom() by checking if the metadata key matches like:               function filter_custom($meta)     {         foreach($meta as $k => $v)         {                  if ($k === 'some_key') return $v . 'filtered';              }     }     add_filter('get_post_custom', 'filter_custom');      Is there a hook for this? if not what would be the best way to accomplish it?


title: Load parent theme files before child theme functions.php

text: I am creating a theme framework to use in future wordpress themes that I develop. I would like to include dependant files such as classes inside the parent theme before the child theme functions.php gets loaded. This way the child theme doesn't need to include the classes. I'll try to show an example: parent-theme - file.php:               require_once get_template_directory().'/classes/Core.php';     require_once get_template_directory().'/classes/Core_View.php';     $CoreView = new Core_View();     $CoreView->init();      child-theme - functions.php:               require_once get_template_directory().'/classes/ContentSidebarView.php';     $ContentSidebarView = new ContentSidebarView();     $ContentSidebarView->init();      ContentSidebarView Class file:               Class ContentSidebarView extends Core_View{              public function init(){             // Do Something         }          }      Currently, I get an error that class Core_View is not found when I use the child theme. This isn't the case if I just use the parent theme. What I'd Like: I would like to require only the template in the child theme and initiate it. This means that the Core_View would have to already be loaded. I am also open to suggestions as to how to initiate the template. Maybe it would be better in the child theme index file?


title: AJAX with Selectbox Plugins (Select2, Chosen, Selectize)

text: I have been searching all over the internet for tutorials on implementing AJAX actions from jQuery selectbox plugins such as Select2 , Selectize and Chosen. (these plugins look better than the inbuilt jquery ui) Unfortunatley I cannot find any tutorials specific for wordpress use. Using one of the tutorials i found on the internet, I adapted it as much as I could to use in wordpress, but unfortunatley I have encountered a **empty Bindvalue()** error. My HTML document contains the following               label>Option Value :</label>     <input class="input" id="selectbox-v" type="hidden" name="optionvalue" data-placeholder="Choose An Option.." />               <Script>          $(document).ready(function(){     $('#selectbox-v').select2({     minimumInputLength: 2,     ajax: {       url: "<?php  get_template_directory()?>/lib/options.php",       dataType: 'json',       data: function (term, page) {         return {           q: term         };       },       results: function (data, page) {         return { results: data };       }     }     });     });          </script>      My options.php document contains the following.               <?php global $wpdb;          // i have set the limit to 40 to speed up results     $result = $wpdb->get_results("SELECT location_id,location_name FROM $wpdb->locations WHERE location_name LIKE :term ORDER BY option ASC LIMIT 0,40");          // bind the value for security with the wildcard % attached.     $result->bindvalue(':term','%'.$_GET["q"].'%',PDO::PARAM_STR);     $result->execute();          // make sure there are some results else a null query will be returned     if($result->rowcount() != 0) {     while($row = $result->fetch(PDO::FETCH_ASSOC)){         $answer[] = array("id"=>$row['location_id'],"text"=>$row['location_id']."  ".$row['location_name']);         // the text I want to show is in the form of option id - option      }     } else {     // 0 results send a message back to say so.      $answer[] = array("id"=>"0","text"=>"No Results Found..");     }          // finally encode the answer to json and send back the result.     echo json_encode($answer);     ?>      My question: **Can some please advise me on what I have done incorrectly please?**


title: Multisite redirecting wrong when without WWW

text: Our Multisite WordPress installation has 3 subdomains:                   www.website.com         www.website.com/en/         www.website.com/es/      But when some URL without WWW is typed, the user is always redirected to `www.website.com`. For example:                   Typing:                         Leads to:         website.com/                    www.website.com         website.com/en/                 www.website.com         website.com/es/                 www.website.com         website.com/wp-admin/           www.website.com         website.com/en/wp-admin/        www.website.com         website.com/es/wp-admin/        www.website.com         [...]                           [...]      We have tried:   * Forcing WWW with .htaccess   * Changing configuration on Domain Network Dashboard But none of that solved the problem. We have not tried any plugin yet because we don't know exactly what our problem is. What can be happening?


title: Set featured image for multiple posts

text: Does anyone know how I can set an image as featured image for multiple posts. I have posts in a seri that I would like to use the same image as featured image. bulk edit doesn't have featured image in there though.


title: How to display text of a page in home or custom page?

text: I have "About us" content in a single static wp page and want to show a part of it in the front page with a read more... link. I want to make index.php like this: -Navigation- _-About Us - -Some part of About us page content_ - -Latest News- -The loop for latest news- How can I do the 'about us' part? Thanks


title: How to display thumbnail and excerpt of a page on homepage?

text: How to display attached thumbnail and excerpt (about 200 words) of a page on homepage?               <?php      $page_data = get_page( 401 ); // Get page ID 401     echo '<h3>'. $page_data->post_title .'</h3>';     echo apply_filters('the_content', $page_data->post_content);     ?>      I don't know how to display attached image as thumbnail. May be i use mb_substr php function to cut the content to the excerpt. Sorry, my english is not good. :) Thanks for help!


title: update_option using variable name

text: Title may not be clear but I'm using `update_option($my_option, $new_order);` and for some reason it would not work but if instead I change to `update_option('my-option-name' $new_order);` it works. I check that `$my_option` has a value and `'my-option-name'` exists and has some values on it. Without digging more, is there any reason or cases where using a `$variable` may stop the update_option(), If so, how can be sorted. Thanks


title: I can't find the relevant part of the loop in my theme file. How do I find the full content with "More..."

text:
Brunelleschi is based on the Twenty-Ten theme, but has really grown since then. I like my theme, but I'm trying to modify the way a posts in page plugin works and I need to copy the relevant part of the loop to do it.   1. I want to display full posts, but have them cut off at the "more..." spot.   2. In this theme, it says "Continue Reading."   3. The original code for the plugin below:
             <?php the_excerpt(); ?>
      The big issue with this is that excerpts are formatted differently and use a specific truncation and no pictures, whereas cutting off at the "more" is a manual thing, which I want. So I modified the code to:
                 <?php the_content(); ?>
      This displays full content, but it does not cut off at the "more." So I go hunting in the loop and try replacing the code with just about every potentially relevant snippet I can find in the loop.php theme file and nothing works. They do post formats, wonky image galleries (sort of), or the full content. I've pastebinned the loop.php. I just need help finding which snippet to copy over 'cause it's not working even though it does work in the regular templated pages, just not on the embedded posts in pages. The brunelleschi loop code on pastebin EDITED TO ADD: I keep thinking it should be this particular snippet:                                               <?php the_content( __( 'Continue reading →', 'brunelleschi' ) ); ?>      But when I use that instead of the version without args, it still shows the full post despite having manual more tags in those posts.


title: roots child theme can't override header.php

text: I made a child theme for roots and it worked as expected. I can override everything, including footer.php, but not header.php. My header.php looks exactly like the one from roots at the moment, except for the blog title, which I replaced. I googled it, but it seems that I'm the only one facing this problem.


title: WordPress import not importing custom taxonomy

text: First off, feel obliged to say I've posted this already in the WP Support Forum (http://wordpress.org/support/topic/wordpress-import-not-importing- custom-taxonomy) hoping to have more luck here. I'm trying to import a custom post type from one blog to another. (126 posts in the custom post type). I've exported using WordPress' export function from WP version 3.3.2 and trying to import into 3.2.1. I can get all the posts to import into the correct custom post type, but none of my custom taxonomy or meta information is being imported in. In both WPs I have the exact same name for each of my custom post types and taxonomies, I literally copied/pasted my functions.php over. Any idea why my import is adding all posts of my custom post type but not my custom taxonomy? Am I missing a step somewhere?


title: Is $wpdb->prepare escaping to much? How to use it properly?

text:
Im pretty much confused by $wpdb->prepare. I want to use it to sanitize user input but it turned out that it destroys the query. I cannot imagine that this is how it's intended to work but I can't find out what I'm doing wrong. Please be so patient and point me to the solution. The following code is just a simple example for demonstration purposes just to make it clear what's going wrong and how. **Later there will be user input** feeding this query. When I left out prepare and use sprintf instead this example is working :               global $wpdb;     $mydb = new \wpdb( "My_Login" ,"My_PW" , "My_Custom_DB" ,"localhost"); //wpdb instance for my custom db          $tablename = "books";     $sort_direction = "DESC";     $limit = 5;        $sqlquery = sprintf( "SELECT * FROM %s ORDER BY datum %s LIMIT %d", $tablename, $sort_direction, $limit );          $res = $mydb->get_results( $sqlquery );     echo "
".$sqlquery."
";     var_dump($res);      The output of var_dump() is a proper array containing the expected result. The output of $sqlquery is:               SELECT * FROM books ORDER BY datum DESC LIMIT 5      Which is proper SQL. Now I will use prepare (this is the only changed line):               global $wpdb;     $mydb = new \wpdb( "My_Login" ,"My_PW" , "My_Custom_DB" ,"localhost"); //wpdb instance for my custom db          $tablename = "books";     $sort_direction = "DESC";     $limit = 5;        $sqlquery = $mydb->prepare( "SELECT * FROM %s ORDER BY datum %s LIMIT %d", $tablename, $sort_direction, $limit );          $res = $mydb->get_results( $sqlquery );     echo "
".$sqlquery."
";     var_dump($res);      The output of var_dump() is **NULL** The output of $sqlquery is:               SELECT * FROM 'books' ORDER BY datum 'DESC' LIMIT 5      Where obviously table name and DESC shouldn't be enclosed in quotation marks. IMO this is the reason why it fails. I double checked that this isn't related to instancing $wpdb. When I work with $wpdb the escaping result is the same. What's going on or what did I wrong? Please help me.


title: how to limit query_post to first page?

text: I have a custom post type called listings with different taxanomies, I am using this query to display first only my post that have the type taxonomy featured. This is the code that does that :               <?php       query_posts( array( 'post_type' => 'listings','type' => 'featured' ) );       if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>               <?php endwhile; endif; wp_reset_query(); ?>     <?php      I want this query to limit it self to the first page in wich i have 10 post


title: Copy a user from one WordPress site to another

text: Is it possible to copy a user from one WordPress site to another? I copied the record from the `user` table and all the related records from the `usermeta` table (12 records by default) but I think something else is needed. I get this message upon login: `You do not have sufficient permissions to access this page.` The reason I need this is I have 4 users I'd like to grant access to on a new site but use their credentials from the current site.


title: Check is_single() outside loop

text: How can I check if an Id `is_single()` outside the loop in a plugin? When I try it I always get a fatal error The code                add_action('transition_post_status', 'pmc_update_notification',10,3);          function pmc_update_notification($new_status, $old_status, $post) {      if ( $old_status == 'publish' && $new_status == 'publish' ) {      $post_id = get_the_ID($post);       if (is_single($post_id)){      $post_title = get_the_title($post);      $post_url = get_permalink($post);      $message = __('Post updated','pmc').":\n";      $message .= $post_title . ": " . $post_url;             // Send notification        pmc_send($message);          }         }        }


title: Adding a date archive to Custom Post Type

text: Having a little problem with URL rewrites. Trying to get the following URL to display all the sermons in 2014               http://example.com/sermons/2014      Currently it is looking for a sermon called 2014               function caffeine_rewite_rules(){         add_rewrite_rule("sermons/([0-9]{4})/?$", 'index.php post_type=ctc_sermon&year=$matches[1]', "top");     }     add_action( 'plugins_loaded', 'caffeine_rewite_rules');      This "should" add a new rewrite rule to the top of the rewrite array that matches for sermons/year but it's never matching. Any thoughts?


title: Moving wordpress to VPS, text disappeared from posts

text: I've a big problem. Moved blog to VPS today. And now I see that texts are gone from posts, no excerpts no content... Just titles remain. I checked in DB, all seems to be in place. I also checked in wp-admin/editor and it works fine... only in frontEnd text is not visible. What can this be?


title: How to Highlight current category on category and single page template?

text:
On Wp Forums, I found a code that shows categories with images and it works very well. But I couldn't figure out how to highlight current category on _category.php_ and _single.php_ Here is the code that i'm using               $cats = get_categories('hide_empty=0&child_of=2&orderby=count&number=99&order=asc');     foreach ((array)$cats as $cat) {     $catdesc = $cat->category_description;     echo '
               slug. '.jpg" alt="' . $cat->cat_name . '" class="front-img" />
           ';     }