Temporary download page or restrict static download page based on how the user got to the page?

I basically want to know it if is possible to create a system where either when a user wants to download something it creates a temporary download page (not a download link, this I want static - I hotlink files instead of upload them directly on my server) and the page will delete itself after a certain period of time. Or my other solution may be to restrict the visibility of a page or pages content based on the url of how the user got there. The reason I ask is because I use adf.ly for guests to download things and members don't get the adf.ly pages, they go straight to the download. The registered user download page is blocked from guests accessing it but if any guest shares the guest download link's page url after the adf.ly, anyone can bypass the adf.ly and go straight to the download page via the direct link. Is there a way to make the page boot them off if they didn't get to the page via the adf.ly link or somehow create a temporary download page that will only stay up a couple of minutes and then disappear and keep changing the url so people can't give out the direct guest download link? If there is any way to do this I would be grateful :)


Custom Plugin theme filter

I am creating custom plugin and in my plugin file I have this:               add_filter('page_template', 'load_tq_templates');      function load_tq_templates() {         if (is_page( 'transport-quote-1' )) {             if ( $overridden_template = locate_template( 'tq-1.php' ) ) {                // locate_template() returns path to file                // if either the child theme or the parent theme have overridden the template                load_template( $overridden_template );             } else {                // If neither the child nor parent theme have overridden the template,                // we load the template from the 'templates' sub-directory of the directory this file is in                load_template( dirname( __FILE__ ) . '/templates/tq-1.php' );             }         }            }      I've created sub-folder "themes" in my plugin directory where I have file `tq-1.php` looking like this:               <?php get_header(); ?>

THIS IS MY CUSTOM THEME FOR PAGE tq-1

                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                    <?php the_content(); ?>                    <?php endwhile; endif; ?>

     <?php get_footer(); ?>      Problem is that the file really get's loaded on appropriate page, BUT after it's loaded the active theme's `page.php` is loaded as well, so I am basically getting duplicated content on front end as `tq-1.php` is loaded first and then theme's `page.php` file is loaded second. How to avoid theme's `page.php` from being loaded after my template?


How to change the menu items in WPTouch

Does anyone know a way to change the menu items in the header drop menu to be posts and not pages? Or to get rid of that menu all together?


Author capabilities: Deleting comments on their own published posts

I know users that have role _author_ can delete their own published posts. But if someone comments on one of their posts, does the post author have the capability to delete that comment?


Custom Post Type Order Issue

I am having an issue getting my Custom Post Type "slide" to pick up the custom order set in the order attribute. In fact I can't seem to get the order to change from ASC to DESC period. I have looked all over the net and can't seem to figure this one out, am I missing something? here is my code.. in my functions.php file:                 $labels = array(     'name' => _x('Home Slideshow', 'post type general name'),     'singular_name' => _x('Slide', 'post type singular name'),     'add_new' => _x('Add New', 'Slide'),     'add_new_item' => __('Add New Slide'),     'edit_item' => __('Edit Slide'),     'new_item' => __('New Slide'),     'view_item' => __('View Slide'),     'search_items' => __('Search Slide'),     'not_found' =>  __('No Slide found'),     'not_found_in_trash' => __('No Slides found in Trash'),      'parent_item_colon' => '',     'menu_name' => 'Home Slideshow'          );     $args = array(     'labels' => $labels,     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,      'show_in_menu' => true,      'query_var' => true,     'rewrite' => true,     'capability_type' => 'post',     'has_archive' => true,      'hierarchical' => false,     'menu_position' => null,     'supports' => array('title','editor','thumbnail', 'excerpt', 'page-attributes')     );      register_post_type('slide',$args);      And here is my query:               <?php         query_posts(array(             'post_type' => 'slide',             'posts_per_page' => -1,             'orderby' => 'menu_order',             'order' => 'ASC'              ));          if (have_posts()) :?>
         prev         next

                 <?php while (have_posts()) : the_post(); ?>                              <a href="<?php echo get_the_excerpt(); ?>">
                     <?php if(has_post_thumbnail()){                     $src_full = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slide' );                     $src_small = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slide_small' );?>
                         <div data-src="<?php echo $src_full[0] ?>" >
                         <div data-src="<?php echo $src_small[0] ?>" data-media="(max-width:479px)" >
                                                                           <img src="<?php echo $src_full[0] ?>" width="719" height="394" alt="image description" />
                     <?php } ?>
                         <?php the_title() ?>
                             <?php the_content(); ?>

                                   <?php endwhile; ?>

       <?php endif; ?>      Any help would be greatly appreciated..   I feel like this is one of those where I am just missing some small thing and it's driving me nuts..


wp_logout_url isn't forwarding to correct link

I set my site up at **_parentsite.com/childsite_**. When the site was there my logout button worked correctly and logged the users out and brought them back to the homepage. Here's what the code was:               <a class="logout with-icon" href="<?php echo wp_logout_url( get_permalink() ) ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      Then I bought a new domain name ( ** _childsite.com_** ) for the site and set up the A name to point to **_parentsite.com/childsite_**. Now the logout button logs users out but instead of bringing them to the homepage it brings them to the homepage of **_parentsite.com_**. I changed the above code to:               <a class="logout with-icon" href="<?php echo wp_logout_url('http://childsite.com') ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      but that didn't help. I've also tried               <a class="logout with-icon" href="<?php echo wp_logout_url('http://parentsite.com/childsite') ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      and               <a class="logout with-icon" href="<?php echo wp_logout_url( home_url() ); ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      Any ideas? This is very frustrating and embarrassing. Thanks!


Multiple queries on Home Page - page load/site speed issue

I acquainted a client who designed his own fashion magazine site. My company handed the project to me to make it with WordPress. When I was making the complete template for the site, I found his complete thought: and it's completely eerie for me; because the design for the home page had many more blocks, not less than 20 blocks, and each of the blocks demands a new `WP_Query()` (and just now from this thread I was known that I's right making new `WP_Query()` for each of the blocks). And the final product was damn slow - as I suspected. I'm not a WordPress master, so as I understood `WP_Query()` is whenever it's called, it hits the db with it's query and retrieve the data as per the query. So in this site, in the Home Page it's hitting 20 times and then retrieving the data and that makes it slower. With this scenario, I's thinking of some **Speeding Up** solutions, like:   * Separating the loop for each of the posts with a common function so that it loads a single time with different parameters each of the time   * Some basic CSS things to speed up the layout   * Separating the common things into different files and include them with `get_template_part()`, so that the common thing will load a single time and echo multiple times wherever it's necessary   * Using _LazyLoad_ to the site images to let 'em not hamper the site speed when the content and layout is important first   * Caching the site's content   * _WP Smush.it_ the images   * If possible and doesn't create conflict then using the .js compression With these thoughts, I may be wrong with much of their concepts, but I found them logically good. So the ultimate questions are:   * What can be done further to speed up a site with multiple queries (i.e. 20 different queries)?   * Or, is there any better solution instead of using `WP_Query()` for each of the queries?


Custom Post type taxonomy single templates

I have created a Custom Post type called "Ad" I then have a taxonomy under that called "type" I have added some terms in the Type category called "Radio", "TV", "Print". I would like WordPress to use a different `single.php` template for each term. I would like to have a Radio template that is different than the Print template. I have tried `taxonomy-ad-type-radio.php` I have tried `single-ad-type-radio.php` and every other form of those. Can someone tell me what's the best way to accomplish this? I have added filters to my `functions.php` file to no avail also. I know I am just missing something very easy. Thanks so much for your help.               <?php           /** Register the post type for the ads **/          add_action( 'init', 'register_cpt_ad' );          function register_cpt_ad() {              $labels = array(              'name' => _x( 'Ads', 'ad' ),             'singular_name' => _x( 'ad', 'ad' ),             'add_new' => _x( 'Add New', 'ad' ),             'add_new_item' => _x( 'Add New ad', 'ad' ),             'edit_item' => _x( 'Edit ad', 'ad' ),             'new_item' => _x( 'New ad', 'ad' ),             'view_item' => _x( 'View ad', 'ad' ),             'search_items' => _x( 'Search Ads', 'ad' ),             'not_found' => _x( 'No ads found', 'ad' ),             'not_found_in_trash' => _x( 'No ads found in Trash', 'ad' ),             'parent_item_colon' => _x( 'Parent ad:', 'ad' ),             'menu_name' => _x( 'Ads', 'ad' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => false,             'description' => 'Adbank system',             'supports' => array( 'title', 'excerpt', 'editor', 'thumbnail', 'custom-fields' ),             'taxonomies' => array( 'category', 'type', 'campaign', 'post_tag' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,         'menu_position' => 3,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'ad', $args );     }          /**Register the taxonomy for the ad types**/     add_action( 'init', 'register_taxonomy_type' );          function register_taxonomy_type() {              $labels = array(              'name' => _x( 'Ad Type', 'type' ),             'singular_name' => _x( 'Ad Types', 'type' ),             'search_items' => _x( 'Search Ad Type', 'type' ),             'popular_items' => _x( 'Popular Ad Type', 'type' ),             'all_items' => _x( 'All Ad Type', 'type' ),             'parent_item' => _x( 'Parent Ad Types', 'type' ),             'parent_item_colon' => _x( 'Parent Ad Types:', 'type' ),             'edit_item' => _x( 'Edit Ad Types', 'type' ),             'update_item' => _x( 'Update Ad Types', 'type' ),             'add_new_item' => _x( 'Add New Ad Types', 'type' ),             'new_item_name' => _x( 'New Ad Types', 'type' ),             'separate_items_with_commas' => _x( 'Separate ad type with commas', 'type' ),             'add_or_remove_items' => _x( 'Add or remove ad type', 'type' ),             'choose_from_most_used' => _x( 'Choose from the most used ad type', 'type' ),             'menu_name' => _x( 'Ad Type', 'type' ),         );              $args = array(              'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => true,             'hierarchical' => true,             'rewrite' => true,             'query_var' => true         );              register_taxonomy( 'type', array('ad'), $args );     }          /**Register the taxonomy for the campaigns**/     add_action( 'init', 'register_taxonomy_campaign' );          function register_taxonomy_campaign() {              $labels = array(              'name' => _x( 'Campaigns', 'campaign' ),             'singular_name' => _x( 'Campaign', 'campaign' ),             'search_items' => _x( 'Search campaigns', 'campaign' ),             'popular_items' => _x( 'Popular campaigns', 'campaign' ),             'all_items' => _x( 'All campaigns', 'campaign' ),             'parent_item' => _x( 'Parent Campaign', 'campaign' ),             'parent_item_colon' => _x( 'Parent Campaign:', 'campaign' ),             'edit_item' => _x( 'Edit Campaign', 'campaign' ),             'update_item' => _x( 'Update Campaign', 'campaign' ),             'add_new_item' => _x( 'Add New Campaign', 'campaign' ),             'new_item_name' => _x( 'New Campaign', 'campaign' ),             'separate_items_with_commas' => _x( 'Separate campaigns with commas', 'campaign' ),             'add_or_remove_items' => _x( 'Add or remove campaigns', 'campaign' ),             'choose_from_most_used' => _x( 'Choose from the most used campaigns', 'campaign' ),             'menu_name' => _x( 'Campaigns', 'campaign' ),         );              $args = array(              'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => true,             'hierarchical' => true,                  'rewrite' => true,             'query_var' => true         );              register_taxonomy( 'campaign', array('ad'), $args );     }          function query_post_type($query) {         $post_types = get_post_types();              if ( is_category() || is_tag()) {                  $post_type = get_query_var('ad');                  if ( $post_type ) {                 $post_type = $post_type;             } else {                 $post_type = $post_types;             }                  $query->set('post_type', $post_type);                  return $query;         }     }          add_filter('pre_get_posts', 'query_post_type');          /* NEW STUFF */          // Register the column     function price_column_register( $columns ) {     $columns['level'] = __( 'User Level', 'my-plugin' );          return $columns;     }     add_filter( 'manage_edit-ad_columns', 'price_column_register' );          // Display the column content     function price_column_display( $column_name, $post_id ) {     if ( 'level' != $column_name )         return;     $roles = get_post_meta( $post->ID, '_members_access_role', true );     if ($roles == 'level1') echo 'level1';     echo 'hello';     }     add_action( 'manage_posts_custom_column', 'price_column_display', 10, 2 );          /**      * Append the terms of multiple taxonomies to the list      * of classes generated by post_class().      *      * @since 2010-07-10      * @alter 2012-01-06      */     function mysite_post_class( $classes, $class, $ID ) {              $taxonomies = array(             'type',             'campaign',              );              $terms = get_the_terms( (int) $ID, $taxonomies );              if ( is_wp_error( $terms ) || empty( $terms ) )             return $classes;              foreach ( (array) $terms as $term ) {             if ( ! in_array( $term->slug, $classes ) )                 $classes[] = $term->slug;         }              return $classes;     }          add_filter( 'post_class', 'mysite_post_class', 10, 3 );     add_filter( 'tpicker_taxonomies', 'my_tpicker_taxonomies' );     function my_tpicker_taxonomies( $old_taxies) { // Filter taxonomy order              foreach( array("Categories ", "Campaigns ", "Ad Type " ) as $tax_label) {             $new_taxies[$tax_label] = $old_taxies[$tax_label];         }              return $new_taxies;     }


Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere

I'm trying to create a related posts WP_Query. So far, I've to created a custom WP_Query that queries all posts that match an array of tags. However, I'm trying to create a simple `if statement`: if the number of posts fetched are **less than 10** , get the remainder from **elsewhere** (this could be from a particular category). I have the following loop. It uses `$related_posts->found_posts` to get the number of posts.               $related_posts_args =         array(         'tag__and' => $list_of_tags, // array of tag IDS         'posts_per_page' => 10,         'post__not_in' => $already_posted, // array of post IDs         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'orderby' => 'rand',     );          $related_posts_query = new WP_Query( $related_posts_args );     if ( $related_posts_query->have_posts() ):         while ( $related_posts_query->have_posts() ):             $related_posts_query->the_post();     // this is the number of posts in my current query         echo $related_posts_query->found_posts;                  the_title();         endwhile;     endif;     wp_reset_postdata();      Would anyone know how use the remainder to get posts from elsewhere? (And is possible within the same loop).


Adding another state (spam, reject, approve) to wordpress comments?

i know this might sound a bit weird, but what I'm trying to do is rather simple in mind but may be technically difficult. I'm running small contests on my wordpress site where I ask users to leave a comment. I'm selecting a comment after a certain period of time and this is the winner. What I'd like to do now, is mark that comment as winner. So, I'm thinking of a solution like this: When viewing the comments in /wp- admin I can set a comment as spam, approved, rejected, etc. I'd like to have another Link/Button that says: "winner". If I click this link the comment has an additional class like `<li class="comment odd alt thread-even depth-1 winner">` Is there a clever solution that comes to your mind? How can I do that? Any other ideas? Thank you in advance. Matt


Call a function with href

Is there any way to call a function inside plugin with `<a href='plugin- function'>` tag? I need this to show user details which will not be bound to any action hook.


How to decrease the file size upload limit?

How do I decrease my media file size upload limit from 20 MB to 500 KB? I actually tried to follow the solution used in Decrease file size upload in Media but got a "undefined add_filter()" error. I inserted the code at the bottom of functions.php. Using WP 3.5.1 What should I do? Thank you


wordpress plugins with add-ons

Im wondering if anyone can point me in the direction of how to create a plugin with add-ons. It looks like the approach is first to create a plugin with the core feature, and then write other plugins that interact with the main plugin. But for some reason its impossible to google, as all my queries brings out plugins from wordpress.org, feather than how-to's and tutorials. So i was hoping someone here could explain or point me in the direction of a guide. Thanks!


Add capability for editors to modify custom fields

Editors don't have a way to edit custom fields and I'm not seeing the capability in the WordPress codex. Is there a way to give access to that without making a user an admin?


Widgets not showing on sidebars

I have registered two sidebars in my theme using the function below, but none of the widgets shows up in the sidebars even though I can manage them in the dashboard:               // register sidebars     add_action( 'widgets_init', 'my_register_sidebars' );     function my_register_sidebars() {              register_sidebar(             array(                 'id' => 'sidebar-left',                 'name' => __( 'sidebar-left' ),                 'description' => __( 'A short description of the sidebar.' ),                 'before_widget' => '
',                 'after_widget' => '
',                 'before_title' => '
',                 'after_title' => '
'             )         );                  register_sidebar(             array(                 'id' => 'sidebar-right',                 'name' => __( 'sidebar-right' ),                 'description' => __( 'A short description of the sidebar.' ),                 'before_widget' => '
',                 'after_widget' => '
',                 'before_title' => '
',                 'after_title' => '
'             )         );     }      and to call template file is like this
              <?php if ( is_active_sidebar( 'left' ) ) : ?>                  <?php dynamic_sidebar( 'left' ); ?>              <?php else : ?>
 here should be a left sidebar
              <?php endif; ?>
      The paragraph shows up but the widgets do not. Any suggestions?


How do I Query 2 Custom Post Types?

This is what I have, it **works** great except it only pulls from one CPT. I need it to pull from **two**.               <?php $my_query = new WP_Query( array(           'post_type' => 'Portfolio' , 'Artwork' ) );           while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;   $the_post_ids = get_the_ID(); ?>      If I use something like this as suggested elsewhere:               <?php query_posts( array(         'post_type' => array( 'artwork', 'portfolio' ));          while ( have_posts() ) : the_post(); $do_not_duplicate = $post->ID; $the_post_ids = get_the_ID(); ?>      It doesn't work at all with parse errors that I cannot seem to fix. Unexpected ";". I am fairly new, could someone suggest something to try?


Custom Query With Multiple Meta Key Value

I am new with WordPress development and I have found this query and I want pass multiple key and value in this query. My Query is:               $querydetails = "        SELECT wposts.*        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta        WHERE wposts.ID = wpostmeta.post_id             AND wpostmeta.meta_key = 'type' AND wpostmeta.meta_value = 'Collection1'        AND wposts.post_status = 'publish'        AND wposts.post_type = 'book'        ORDER BY wposts.post_date DESC     ";      I want add more statement with `OR` operator. My Original Code is:               <?php     $querydetails = "        SELECT wposts.*        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta        WHERE wposts.ID = wpostmeta.post_id             AND wpostmeta.meta_key = 'type' AND wpostmeta.meta_value = 'Collection1'        AND wposts.post_status = 'publish'        AND wposts.post_type = 'book'        ORDER BY wposts.post_date DESC     ";          $pageposts = $wpdb->get_results($querydetails, OBJECT);     ?>          <?php if ($pageposts):     foreach ($pageposts as $post):        setup_postdata($post); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php endforeach;     endif; ?>      I have also tried with this code but when I pass 4 records nothing happening, only page is loading and loading.               <?php        $args = array(                   //Type & Status Parameters         'post_type'   => 'book',         'post_status' => 'publish',              //Order & Orderby Parameters         'order'               => 'DESC',         'orderby'             => 'date',              //Pagination Parameters         'posts_per_page'         => -1,                 // Here you can add you second meta value              'meta_query'     => array(                        'relation' => 'OR',             array(                 'key' => 'type',                 'value' => 'Sample 1',                 'compare' => 'LIKE'             ),             array(                 'key' => 'type',                 'value' => 'Sample 2',                 'compare' => 'LIKE'             ),             array(                 'key' => 'type',                 'value' => 'Sample 3',                 'compare' => 'LIKE'             ),             array(                 'key' => 'type',                 'value' => 'Sample 4',                 'compare' => 'LIKE'             )         )     );          $query = new WP_Query( $args );     ?>          <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php echo the_title(); ?>
               <?php endwhile; ?>          <?php else: ?>          <?php endif; ?>          <?php      // Restore original Post Data     wp_reset_postdata(); ?>      Any Idea ?? I will appreciate if you guide me :)


Query shopp categories and CPT

I have a slider setup that is querying shopp categories that have products here: http://halliescomet.com/ Here's my code:

             <?php if( shopp('catalog','has-categories')) : ?>                  <?php while(shopp('catalog','categories')): ?>                  <?php                 // Skip sub-categories                 if (shopp('category','parent','return=1') > 0) continue;  ?>
                             <a href='<?php shopp('category','url'); ?>'>                              <?php shopp('category','coverimage','width=545&height=260&fit=crop'); ?>

<?php shopp('category','name'); ?>
                                 <?php shopp('category','description'); ?>                                      <a class="learnmore" href="<?php shopp('category','url'); ?>">View All

                                 <?php endwhile; ?>             <?php endif; ?>
             <?php wp_reset_query();?>

      I'd What I would like to do is combine that with a custom post type labeled "slides" so I am able to add non shopp content to the slider. Anyone know if this is do-able? Since the shopp while is different I am not sure how to go about this. Any help is again appreciated.


using add_action without having custom plugin or theme

I need to send an email after an author publishes or updates a post. But I don't like developing custom plugin or theme. Is there any plugin that runs a php script after publish. Or where can I insert my code and add have an add_action outside a plugin or theme?


Uploaded images do not show on localhost

I'm working with Wordpress 3.3.1 on a local installation. I've uploaded an image file and it doesn't show up. The base directory is a symbolic link `/var/www/wordpress/` that leads to `/usr/share/wordpress/` The file exists here: `/srv/www/wp-uploads/localhost/2013/01/Logo.png` Wordpress thinks the file is here: `http://localhost/wordpress/2013/01/Logo.png` (Apache gives 404) How can I configure Apache or Wordpress to get the correct file? I'm confused because `/srv/www/localhost/` contains the Wordpress files (as well). Also, I've found questions related to `wp-content/uploads` but this directory doesn't exist.


Exclude subcategory from wp_query

I've got a simple loop, that goes through the category `street-style`:               $street_style_tags = array(     'category_name' => 'street-style',     'posts_per_page' => 25,     'post_type' => 'post',     'post_status' => 'publish',     'orderby' => 'date',     'order' => 'DESC'          );      However, it is coming up in loops elsewhere on the site (because of its parent category). Is there a way I can exclude `street-style` from every other loop on the site, apart from this?


nginx + wordpress: Best practices for configuring it to be secure, reliable, and fast?

**BACKGROUND:** Running everything up on Linode. Having followed the "Getting Started," "Securing Your Server," "LEMP Server on Ubuntu 12.04," and the "Manage Web Content with WordPress" guides I was able to successfully get my first Wordpress site running. Now I want to know what I should do (or at least get some experienced recommendations for what I should consider doing) beyond the Guides. **QUESTION:** **What further configuration should I implement to produce the most solid, reliable, secure, and fast Wordpress sites that I plan on hosting?** A few of the areas I'm particulary concerned about:   1. What permissions should I set on each of wp folders? Users will need to upload various assets (images, pdfs, office docs, audio, video). I found this article here that seems helpful, but would like to get some input from folks having done this?   2. What is the/a recommended configuration for nginx? Below is mine, but as I'm new to nginx I'm not all that confident that I have the best configuration of if it is even a good one. What can/should be done to improve it?   3. w3 Total Cache or WP Supercache? What are the better/best caching options and how are folks managing their cache? As I'm running on an ummanaged server, perhaps there are other suggestions?   4. How do you set up a CDN and what should you put up in it? I have an Amazon S3 account to use, just not sure how it should be used?   5. What should I use to perform and manage backups of Wordpress sites (content and database)?   6. What should I install for a robust security infrastructure?   7. What should I be using to monitor the performance and potential problems (whether it be performance or security breaches)?   8. Generally speaking, in what ways should folks deviate from the Guides?   9. Any other recommendations??? MY CURRENT NGINX CONFIG: > >     user www-data; >     worker_processes 4; >     pid /var/run/nginx.pid; >   >     events { >             worker_connections 768; >             # multi_accept on; >     } >   >     http { >   >             ## >             # Basic Settings >             ## >   >             sendfile on; >             tcp_nopush on; >             tcp_nodelay on; >             keepalive_timeout 65; >             types_hash_max_size 2048; >             # server_tokens off; >   >             # server_names_hash_bucket_size 64; >             # server_name_in_redirect off; >   >             include /etc/nginx/mime.types; >             default_type application/octet-stream; >   >             ## >             # Logging Settings >             ## >   >             access_log /var/log/nginx/access.log; >             error_log /var/log/nginx/error.log; >   >             ## >             # Gzip Settings >             ## >   >             gzip on; >             gzip_disable "msie6"; >             # gzip_vary on; >             # gzip_proxied any; >             # gzip_comp_level 6; >             # gzip_buffers 16 8k; >             # gzip_http_version 1.1; >             # gzip_types text/plain text/css application/json > application/x-javascript text/xml >             application/xml application/xml+rss text/javascript; >   >             ## >             # nginx-naxsi config >             ## >             # Uncomment it if you installed nginx-naxsi >             ## >   >             #include /etc/nginx/naxsi_core.rules; >   >             ## >             # nginx-passenger config >             ## >             # Uncomment it if you installed nginx-passenger >             ## >   >             #passenger_root /usr; >             #passenger_ruby /usr/bin/ruby; >   >             ## >             # Virtual Host Configs >             ## >   >   >             port_in_redirect off; >   >             include /etc/nginx/conf.d/*.conf; >             include /etc/nginx/sites-enabled/*; >   >             server { >                     server_name www.mydomain.com mydomain.com; >                     access_log /srv/www/mydomain.com/logs/access.log; >                     error_log /srv/www/mydomain.com/logs/error.log; >                     root /srv/www/mydomain.com/public_html; >                     index index.html index.htm index.php >   >                     include conf.d/drop; >   >                     location / { >                             # This is cool because no php is touched for > static content >                             try_files $uri $uri/ /index.php?q=$uri&$args; >                     } >   >                     location ~ \.php$ { >                             try_files $uri =404; >                             include /etc/nginx/fastcgi_params; >                             fastcgi_pass 127.0.0.1:9000; >                             fastcgi_index index.php; >                             fastcgi_param SCRIPT_FILENAME   > > /srv/www/mydomain.com/public_html$fastcgi_script_name; >                     } >             } >     } >   Thanks!


Wordpress: Apply filter/hook to a particular sidebar widgets?

I'm developing a theme that has more than 5 different sidebars and I want to apply a function to a particular one of them for styling purposes. Basically, the function will modify it's params using a counter to show random 's between each of the widgets. I came up with that:               function widget_params( $params ) {          // ...     }     add_filter( 'dynamic_sidebar_params', 'widget_params' );      But however, it will run for each and every different sidebar. Is there any way to make it work only on a particular sidebar? Or alternatively, is there any way to get current widget's sidebar id inside of that function? Hope all of that makes sense. Thanks in advance!


adding some custom html code to the wp_nav_menu function

I would like to implement some custom html code to the wp_nav_menu function in WordPress so that I can add a bootstrap modal box to a navigation menu link but I am unsure how to go about it. The post http://stackoverflow.com/questions/12250866/how-to-add-custom-html-to-wp-nav- menu goes some way to explaining how to do so by extending the walker class. My goal is to create the following markup using the help of the walker class to create the custom html code at the end.

                 Home

                 About

                 Portfolio

                 Articles

                 Contact

      I'm having difficulty figuring out how to modify the start_el and end_el code to achieve the code in the last list item as my php skills aren't good. Any suggestions?               class Custom_Walker_Nav_Menu extends Walker_Nav_Menu {         function start_el ( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {             // Copy all the start_el code from source, and modify         }              function end_el( &$output, $item, $depth = 0, $args = array() ) {             // Copy all the end_el code from source, and modify         }     }


Display sidebar only if it has content

I have registered a new sidebar. Here is my code in functions.php:               register_sidebar(array(     'name'=>'1',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '',     'after_title' => '',     ));      How do I get to display this sidebar. I want to do something like this: > if sidebar(1) doesn't have widgets, it should not be displayed > > if sidebar(1) have widgets to display, it must display


Pros and cons of using Backbone for WordPress theming

I've been noticing how Backbone seems to be the latest trend for WordPress theme development. A few data points:   * Backbone.js and WordPress development resources   * Theme Foundry's Collections theme.   * Automattic's upcoming O2 theme seems to use Backbone.js also.   * Happy Table's job posting looking for front-end developer requires Backbone experience. I have done my homework and knew the general idea of what Backbone.js does. Nevertheless I don't have any experience with it. So, asking to those who have, what do you think are the pros and cons of using Backbone.js to develop WordPress themes?


What does get_current_screen() do?

Codex says ' This function returns an object that includes the screen’s ID, base, post type, and taxonomy, among other data points' . What does it mean by 'screen'? Coding example:               function change_default_title( $title ) {     $screen = get_current_screen();     if ( 'POST_TYPE' == $screen->post_type ) {     $title = 'Enter Invoice Title';     }     return $title;     }


What is WordPress file encoding?

I noticed that WordPress files use UNIX end-of-line and UTF-8 without BOM. Is this a standard that should be used? Is there anything else to pay attention to? I noticed that Filezilla fails to transfer Macintosh end-of-line files properly to Windows or Linux servers. New line endings are missing. And sometimes they are doubled with different configuration. I'd like to avoid that if possible.


standard wpGallery for post won't work

I'm trying to get the standard wpGallery running in my post. I followed this tutorial. But I ain't get it working. This is what my editor shows while editing a page: http://i39.tinypic.com/6ivi1z.png But at the front-end nothing displays.. I've edited the TwentyTwelve theme to get a custom layout so I delete some things in the page.php, content.php and several files. Someone familiair with this problem or knows what I can do to make it work? Thanks!


What does extract( shortcode_atts( array( do?

The codex says > _**`shortcode_atts()`** combines user shortcode attributes with known > attributes and fills in defaults when needed. The result will contain every > key from the known attributes, merged with values from shortcode > attributes._ It doesn't make much sense to me (I'm a newbie). Here is an example:               function wps_trend($atts) {     extract( shortcode_atts( array(     'w' => '500',      'h' => '330',     'q' => '',     'geo' => 'US',     ), $atts));     $h = (int) $h;     $w = (int) $w;     $q = esc_attr($geo);     ob_start();        Please can you explain?


Can't access admin: "Not Acceptable"

Today I tried to access the admin panel for a basic Wordpress site. It has no plugins, and uses the default theme. I haven't modified any files. Any admin url returns an HTTP 406 "Not Acceptable". What's going on?


$wpdb->insert Giving duplicates

I'm getting duplicate entries with this, how can I fix it please?               <?php          echo "Month". $_POST["Month"];          global $wpdb;     $wpdb->show_errors();      $wpdb->print_error();           $wpdb->insert(          'church',          array(              'Firstname' => $_POST["Firstname"],             'Surname' => $_POST["Surname"],         'Month' => $_POST["Month"],         'Day' => $_POST["Day"],         'Email Address' => $_POST["Email"],         'Mobile Number' => $_POST["Number"]     )     );     ?>


How to change the text generated by <!--more--> Tag

I've looked and looked, I've read the codex, and tired several things to change this but nothing has worked. I don't know how to indicate what text to use for the Tag I have a theme that is using some custom code for displaying a single post on the blog page. The theme options allow you to show full content or excerpt. I have excerpt selected. This is the code from the idex.php template file. I've looked for any references of "more" in fuctions.php or any other file for that matter but haven't found any.               <div class="post-content">                 <?php                 if($data['content_length'] == 'Excerpt') {                     $stripped_content = strip_shortcodes( tf_content( $data['excerpt_length_blog'] ) );                     echo $stripped_content;                  } else {                     the_content('');                 }                 ?>     </div>      Any help would be much appreciated, thanks in advance.


Prevent 404 of Author pages without posts

How do I prevent author archives without posts from 404ing?


Simplest Way to Build Custom Archives Page?

I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to overwrite a lot of other pages too (search results, author results, etc.) So my plan is to create a single page similar to this archives page example. I was going to write a separate function solely for this page in my functions.php file, then use a shortcode to call out the info. Is this the best approach, or could I be going about this another way? Would appreciate any help on the topic :)


What are the correct permissions so WP doesn't ask for FTP credentials if installing plugin?

My nginx user is www-data. If I do `su www-data` I can create both file and directory. But when installing plugin I am asked for FTP credentials. I tried to give the public_html directory 777 permissions for a while to test if I can install plugin without providing FTP credentials but it didn't help either.   * WP 3.2.1   * nginx   * ubuntu  How can I install plugins without providing FTP credentials.


Getting jQuery sortable items in custom metabox

I've gottent this far: I have a list of featured image thumbnails loading into a metabox on my home-page template. I'm stumped: I'm looking to make them sortable with jQuery but I'm really new to jQuery. The boxes move when I drag them but all haphazard, my placeholder is there but very small and they won't drop and save position. Thanks! Here's my code:                     How I'm getting my featured images from a custom post class to arrange:
                 <?PHP                            $posts = get_posts(array(                         'post_type'   => 'slidertype',                         'post_status' => 'publish',                         'posts_per_page' => -1,                         'fields' => 'ids'                         )                     );                          //loop over each post                     foreach($posts as $p){                              $thumb =    get_post_meta($p,"_thumbnail_id",true);                         $image = wp_get_attachment_image_src($thumb);                      ?>
<img src="<?PHP echo $image[0]; ?>" />
 <?PHP } ?>


I submit a non-latin string value and it returns like %23%24%%%

I am sorry I am anaware of the exact terms. I submit in non-latin a string and in the next page the value "%23%24..." returns. How can I retrieve the correct value? Thanks.


How to duplicate custom menu settings to export to another site

I'm trying to write a routine that will pull items from the wp_options table in order to transport them to another site. The problem I have is that if the source site has custom menus, I'd like to bring those along as well. What table records are referenced for custom menus? I see at least these three in wp_options:               widget_nav_menu     theme_mods_myTheme     myTheme_menus_created


problem redirecting users to page on login

I'm trying to redirect certain users to a part of my site but I cannot seem to make it work... can you take a look at this and tell me what I'm doing wrong?               if ( ! function_exists( 'redirect_after_login' ) ) :         function redirect_after_login() {             global $user_ID;             if ( $user_ID === 4 ) {                 global $redirect_to;                 if (!isset($_GET['redirect_to'])) {                     $redirect_to = get_option('siteurl') . '/stock-de-sexitive/';                 }        }     }     endif;     add_action('auth_redirect', 'redirect_after_login');      Also, I know globals are dangerous, so if you know of a canonical approach that would be great too


Replacing broken urls (dreamweaver) to new ones in wordpress

I am moving an entire site from html and dreamweaver format to wordpress. I imported the content using htlm import plugin that worked well. Now I have to correct all content links as they kept the same variable url format applied by dreamweaver and as I have changed the dite directory structure, most of them are broken now. Basically, my issue is the following: 1) OLD site internal links urls (dreamweaver):               page      2)Now, in WP, the correct url for it would be:               page      I am using BrokenLinks and Search&Replace plugins to correct them and my questions are: **Should i replace the old url (1 above) to:**               a) page (2 above), or     b) page ( I noticed that even though it is not the final full url (parent page and page), a link with this url works well in WP, probably due any redirect rules.      Even though both will finally work, I want to know if: **What should be the format (a or b above) I should use to replace the old ones to avoid problem in case I decide to modify the parent page, for example, from "/parentpage/page/" to "/parentpageX/page/"? My doubt is if I use the option "b" to replace the old one, if I change the parent page some time, this link would become broken again?** **What is the better option take into account SEO?** **Do you suggest any better method to handle this old broken url issue?** Thanks in advance for any help


Moving Posts and Users Only to New Site

For several weeks my client has been working with me to finalize a major content and design change on his site. At the beginning of the process, I created a clone of his production site and that was what they worked on with me to upgrade their site. However, during this time, people have signed up on the production site and new posts, comments and media uploads have been added to the production site. So, I have the new content (pages, media, etc) on a development site and new content (posts, users,etc) on a production site that I have to sync and I am asking for advice on how to accomplish moving all of the new users and posts to the dev site. Then I will clone the complete dev site as the production site. Thank you in advance for any guidance. Jon


Show/hide button in thickbox depending on from which page it is opened

I use the Taxonomy Images plugin and it generates a button in the thickbox for associating an image with a term (see screenshot). Due to the fact that I can only associate terms with images in a thickbox that is opened from edit- tags.php pages, is it possible to remove the button from all other thickboxes? Here’s the function that creates the button:               /**      * Modal Button.      *      * Create a button in the modal media window to associate the current image to the term.      *      * @param     array     Multidimensional array representing the images form.      * @param     stdClass  WordPress post object.      * @return    array     The image's form array with added button if modal window was accessed by this script.      *      * @access    private      * @since     2010-10-28      * @alter     0.7      */          function taxonomy_image_plugin_modal_button( $fields, $post ) {         if ( isset( $fields['image-size'] ) && isset( $post->ID ) ) {             $image_id = (int) $post->ID;                  $o = '
';                  $o.= '' . sprintf( esc_html__( 'Associate with %1$s', 'taxonomy-images' ), '' . esc_html__( 'this term', 'taxonomy-images' ) . '' ) . '';                  $o.= '' . sprintf( esc_html__( 'Remove association with %1$s', 'taxonomy-images' ), '' . esc_html__( 'this term', 'taxonomy-images' ) . '' ) . '';                  $o.= '<input class="taxonomy-image-button-image-id" name="' . esc_attr( 'taxonomy-image-button-image-id-' . $image_id ) . '" type="hidden" value="' . esc_attr( $image_id ) . '" />';                  $o.= '<input class="taxonomy-image-button-nonce-create" name="' . esc_attr( 'taxonomy-image-button-nonce-create-' . $image_id ) . '" type="hidden" value="' . esc_attr( wp_create_nonce( 'taxonomy-image-plugin-create-association' ) ) . '" />';                  $o.= '<input class="taxonomy-image-button-nonce-remove" name="' . esc_attr( 'taxonomy-image-button-nonce-remove-' . $image_id ) . '" type="hidden" value="' . esc_attr( wp_create_nonce( 'taxonomy-image-plugin-remove-association' ) ) . '" />';                  $o.= '
';                  $fields['image-size']['extra_rows']['taxonomy-image-plugin-button']['html'] = $o;         }         return $fields;     }     add_filter( 'attachment_fields_to_edit', 'taxonomy_image_plugin_modal_button', 20, 2 );


How to customize submenus isn wordpress theme

I have a wordpress theme and in the header.php file it is displaying menus through this line :               wp_nav_menu( 'theme_location=menu_2&menu_id=nav&container=&fallback_cb=menu_2_default');      Now if I hover some menu item, it displays submenus items. I just want to change the layout of the submenu items section or div , but I can't find any html of submenus. I need help in this Submenu is appearing in the form of dropdown , I want to change this into a different style like this one : http://opinion.inquirer.net/


Problem with load_theme_textdomain

I made my theme ready for translation. My `text domain` is `my_theme` and my `.po` and `.mo` (de_DE.po and de_DE.mo) files are located in a subfolder `languages` in my themes folder. In my `functions.php` I added the following code:               add_action('after_setup_theme', 'my_theme_setup');     function my_theme_setup(){         load_theme_textdomain('my_theme', get_template_directory() . '/languages');     }      My backend language is "German" but the translation isn’t loaded. Any ideas?


How do i calculate the total of values of custom fields in custom post types?

So the title is a bit unclear, but here is what i have: Custom post type: Projects   Custom post type: Investments          + Custom field: Amount   And i have one page where i load the investments + amounts in a custom post type loop, so it looks like this: Table:               ____________________________________________     | custom post type 1 |      amount 1       |     |____________________|_____________________|     | custom post type 2 |      amount 2       |     |____________________|_____________________|      Now what i want to do is calculate the total amount of amount 1 + amount 2 btw, the code that i use is:               <?php                         if ( is_user_logged_in() ):                             global $current_user;                             get_currentuserinfo();                                  $author_query = array('posts_per_page' => '-1','author' => $current_user->ID, 'post_type' => 'investeringen');                             $author_posts = new WP_Query($author_query);                             while($author_posts->have_posts()) : $author_posts->the_post();                                  $parent_id = wpcf_pr_post_get_belongs(get_the_ID(), 'project');                             $parent = get_post($parent_id);                             $percentagenumber = do_shortcode("[types field='rente' id='$parent_id']");                                  $geinvesteerd = types_render_field("geinvesterd", array( "raw" => "true") );                             $opgebracht = $geinvesteerd / 100 * $percentagenumber; //                           ?>
                                                      <?php                                 $parent_id = wpcf_pr_post_get_belongs(get_the_ID(), 'project');                                     if (!empty($parent_id)) {                                         $parent = get_post($parent_id);                                         echo $parent->post_title;                                 }                             ?>                         	                         € <?php echo number_format("$geinvesteerd",0,",","."); ?>,-	                         € <?php echo number_format("$opgebracht",0,",","."); ?>,-	                                                  <?php                             echo number_format("$percentagenumber", 2, '.', '') . ' %';                          ?>                         	                         <a href="                         <?php                             $parent_id = wpcf_pr_post_get_belongs(get_the_ID(), 'project');                                 if (!empty($parent_id)) {                                     $parent = get_post($parent_id);                                     echo post_permalink($parent_id);                             }                         ?>                         "><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/meta_icons/eye.png" />
                 <?php                     global $count;                     $count = $author_posts->post_count;                     endwhile;                          else :                 ?>
                         U moet inloggen voordat u deze pagina / statistieken kunt bekijken
                 <?php                     endif;                 ?>      Thanks for reading, hope you guys can help me out!


Warning: join(): Invalid arguments passed in post-template.php

I'm getting this warning with development mode: > Warning: join(): Invalid arguments passed in /webDir/project/wp- > includes/post-template.php on line 371 In production mode the `<article>` class attribute becomes blank (`class=""`). This error corresponds to the next function:               /**      * Display the classes for the post div.      *      * @since 2.7.0      *      * @param string|array $class One or more classes to add to the class list.      * @param int|WP_Post $post_id Optional. Post ID or post object.      */     function post_class( $class = '', $post_id = null ) {         // Separates classes with a single space, collates classes for post DIV         echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';     }      After debugging for a while, I've found the issue in the next custom function (functions.php):               /* Remove hentry class from "contact" page */          if(! function_exists( 'remove_hentry' )) {         function remove_hentry( $classes ) {             $classes[] = customTheme_layout_class();             if(is_page('contact')) {                             $classes = array_diff($classes, array("hentry"));                      return $classes;             }         }              add_filter( 'post_class', 'remove_hentry' );     }      Removing these lines the warning disappears and the `<article>` classes are shown correctly. `customTheme_layout_class()` is a theme function with the next code:               /* ------------------------------------------------------------------------- *      *  Template functions     /* ------------------------------------------------------------------------- */           /*  Layout class     /* ------------------------------------ */     if ( ! function_exists( 'customTheme_layout_class' ) ) {              function customTheme_layout_class() {             // Default layout             $layout = 'col-3cm';             $default = 'col-3cm';                  // Check for page/post specific layout             if ( is_page() || is_single() ) {                 // Reset post data                 wp_reset_postdata();                 global $post;                 // Get meta                 $meta = get_post_meta($post->ID,'_layout',true);                 // Get if set and not set to inherit                 if ( isset($meta) && !empty($meta) && $meta != 'inherit' ) { $layout = $meta; }                 // Else check for page-global / single-global                 elseif ( is_single() && ( ot_get_option('layout-single') !='inherit' ) ) $layout = ot_get_option('layout-single',''.$default.'');                 elseif ( is_page() && ( ot_get_option('layout-page') !='inherit' ) ) $layout = ot_get_option('layout-page',''.$default.'');                 // Else get global option                 else $layout = ot_get_option('layout-global',''.$default.'');             }                  // Set layout based on page             elseif ( is_home() && ( ot_get_option('layout-home') !='inherit' ) ) $layout = ot_get_option('layout-home',''.$default.'');             elseif ( is_category() && ( ot_get_option('layout-archive-category') !='inherit' ) ) $layout = ot_get_option('layout-archive-category',''.$default.'');             elseif ( is_archive() && ( ot_get_option('layout-archive') !='inherit' ) ) $layout = ot_get_option('layout-archive',''.$default.'');             elseif ( is_search() && ( ot_get_option('layout-search') !='inherit' ) ) $layout = ot_get_option('layout-search',''.$default.'');             elseif ( is_404() && ( ot_get_option('layout-404') !='inherit' ) ) $layout = ot_get_option('layout-404',''.$default.'');                  // Global option             else $layout = ot_get_option('layout-global',''.$default.'');                  // Return layout class             return $layout;         }          }      Any idea of what's the error in my custom function (`remove_hentry`)?


Same email for all comments

I have **An administrator must always approve the comment** checked, as well as _Email me whenever_ **Anyone posts a comment**. This sends an email to the post author. I don't want that. I have one person in charge of comments on my site, and I want that one person to be receiving all those emails. Any way to accomplish that?


How to configure nginx for wordpress

I'm having a working nginx, php-fpm and other php packages and mysql. I've extracted wordpress-3.4.2.zip in /usr/local/nginx/html/blog. When I visit localhost/blog I get "500 internal server error". Is there any special configuration that needs to be done for nginx to make wordpress work?


Get fatal error when I try signing into ADMIN. Fatal error: Call to undefined function wp_unslash()

I am getting this message when I try to get to admin > Fatal error: Call to undefined function wp_unslash() in > /home/content/a/r/b/arbordogcare/html/wp-admin/admin.php on line 46 I have other problems on my site, but need to get to admin-- highest priority. My site is _arbordogdaycare.com_ using theme twenty eleven and I believe its updated to 3.9.1 I reloaded the database in case that was the problem. I have disabled all the plugins. AND I don't see a function.php folder in wp-admin I do have a _function.php in my _wp-admin/core/advanced-custom-fields_ folder


Plugin for communicating with clients

I'm looking for a plugin, sort of like a white board, where clients and myself can communicate on the wordpress dashboard... perhaps something to manage client tickets...they can enter in one, and i can reply Any ideas?


How to sort queried pages by an array of page ids?

I'm creating a one page wordpress website, and I need my 'home', 'about', 'portfolio', 'services' and 'contact' pages to all be on my front page. I created the following page template for my front page: **page-home.php:**               <?php get_header(); ?>

                          <?php                               $titles = array('home', 'about', 'portfolio', 'services', 'contact');                               $ids = array();                              foreach($titles as $title) {                             $page = get_page_by_title($title);                             if($page) {                                 $ids[] = $page->ID;                             }                         }                              global $wp_query;                         $wp_query = new WP_Query(array('post_type' => 'page', 'post__in' => $ids));                          ?>                          <?php while ( have_posts() ) : the_post(); ?>                              <?php get_template_part( 'content', 'page' ); ?>                          <?php endwhile; ?>

                  <?php get_sidebar(); ?>          <?php get_footer(); ?>      The problem I have is that the queried pages, `$wp_query->posts`, aren't ordered by the array of page ids, `$ids`, that I used to query the pages. How can I sort the `$wp_query->posts` array against the `$ids` array? This is my first question on wordpress.stackexchange.com so if there is a problem with my question, please let me know.


Some doubts about how the main query and the custom query works in this custom theme?

I am pretty new in WordPress theme development and I'm not so into PHP (I came from Java and C#) and have the following situation in this custom theme As you can see in the homepage I first show a section (named _Articoli in evidenza_ ) containing the _featured posts_ (I've implemented it using a specific tag) and under it there is another area (named _Ultimi Articoli_ ) that contains the latest post that are not the featured post. To do it I use this code:

Articoli in evidenza
                                   <?php         $featured = new WP_Query('tag=featured');              if ($featured->have_posts()) :                  while ($featured->have_posts()) : $featured->the_post();                 /*                  * Include the post format-specific template for the content. If you want to                  * use this in a child theme, then include a file called called content-___.php                  * (where ___ is the post format) and that will be used instead.                  */                 get_template_part('content', get_post_format());                  endwhile;             wp_reset_postdata();         else :             // If no content, include the "No posts found" template.             get_template_part('content', 'none');              endif;         ?>
Ultimi Articoli
               <?     // get the term using the slug and the tag taxonomy     $term = get_term_by( 'slug', 'featured', 'post_tag' );     // pass the term_id to tag__not_in     query_posts( array( 'tag__not_in' => array ( $term->term_id )));     ?>          <?php         if (have_posts()) :             // Start the Loop.             while (have_posts()) : the_post();                      /*                  * Include the post format-specific template for the content. If you want to                  * use this in a child theme, then include a file called called content-___.php                  * (where ___ is the post format) and that will be used instead.                  */                 get_template_part('content', get_post_format());                  endwhile;         else :             // If no content, include the "No posts found" template.             get_template_part('content', 'none');              endif;         ?>
      It works fine but I have some doubt about the quality of this solution and how exactly it works. To select all the _featured posts_ , I use this line that create a new `WP_Query` object that define a query having the specific tag `featured`:               $featured = new WP_Query('tag=featured');      Then I iterate on this query result using its `have_posts()` method. So, from what I have understand, this is not the WordPress main query, but it is a new query created by me. From what I understand, it is better create a new query (as done) and not use the main query when I want perform this kind of operation. Is it true or am I missing something? If it is true can you explain me why it is better create a new custom query and not modify the Wordpress main query? Ok, going on. I show all the posts that have not the featured tag, to do this I use this code snippet that on the contrary to modify the main query:                   <?         // get the term using the slug and the tag taxonomy         $term = get_term_by( 'slug', 'featured', 'post_tag' );         // pass the term_id to tag__not_in         query_posts( array( 'tag__not_in' => array ( $term->term_id )));         ?>              <?php             if (have_posts()) :                 // Start the Loop.                 while (have_posts()) : the_post();     get_template_part('content', get_post_format());                      endwhile;             else :                 // If no content, include the "No posts found" template.                 get_template_part('content', 'none');                  endif;             ?>      So I think that this is pretty horrible. Is it true? To do the same operation I found this function that I have added to _functions.php_               function exclude_featured_tag( $query ) {         if ( $query->is_home() && $query->is_main_query() ) {             $query->set( 'tag__not_in', 'array(ID OF THE FEATURED TAG)' );         }     }     add_action( 'pre_get_posts', 'exclude_featured_tag' );      This function have an hook that is called after the query variable object is created, but before the actual query is run. So from what I have understand it take a query object as input parameter and modify it selecting all the posts excluding a specific tag (in my case the `featured` tag posts) So how can I use the previous query (the one used to show the featured posts) with this function to show the not featured post in my theme? Or do I have to create a new query?


Dynamic carousel on individual posts

I'm using Wordpress as a CMS for a small business website (not my first choice.) Each product page needs to have a small carousel of images that contains images relevant to the product. I've set up a custom Post Type for the products and am currently using custom fields to display some information specific to each product. I can't just cut and paste the code for each individual carousel into a custom fields; since, to get the images properly, I need PHP in the code for the carousel. I also can't use individual custom fields for each image since the number of images in the carousel could be unpredictable. Is there a good way to do this? Suggestions are appreciated!


Limit cache size from W3 Total Cache

Is it possible to define a limit for how much space W3 Total Cache is allowed to use?


Show warning if plugin is missing

Sorry if this question is a bit to trivial, but I'm writing a theme that depends on a plugin to be installed. It's a multilingual theme, so I absolutely need the user to have Polylang installed. I thought about just copying the plugin files into my theme, but that would mean my theme users won't get Polylang updates. So I hope you agree the best solution is to force the user to install polylang. Now, I would like to know what is the best way to let the user know he needs to install polylang? Is it possible to install a plugin automatically? What should happen if the user uninstalls polylang afterwars, just break the theme, or fall back to twentyeleven theme? I would really love to hear some other people's ideas on this.


Migrating static site to multisite with multiple domains and subdomains

ok, here's an overview as this is a bit of a tall order:) i need to migrate our entire site into wp. right now we're just using wp for a blog page (installed in subfolder w/ subdomain), and all other pages are static in the root of the site. i want to get all of this combined into one wp install for our main site, blog, and international sites. here's what i'm doing now -   * test wp multisite installed in subfolder of root   * migrated existing wp posts, plugins, and static pages into multisite (one site for main site, another for uk site) once i have all content migrated into my multisite install, what is the best way to handle making it live? there are some files and folders with other subdomains pointing to them in the root that exist outside of wp and can't be moved / changed. I was thinking i would,   * point mysite.com to my test multisite install subfolder and change my site url in wp to mysite.com   * point my uk domain to my test multisite install subfolder and change my site url in wp to mysite.co.uk is this the best way to go about doing this? also, what would be the best way to keep my top domain pointing to all of my other static content in my root? should I just drop all of those static files into my multisite install folder? can putting those other files in my wp folder mess up my install? this is a complex job and i'm looking for the best way to do it with minimal headaches (although i kinda have one now after posting this:)! thanks so much!!!


Can you please verify my robots.txt for wordpress

I am a newb in writing this and since this is dangerous stuff to fidlle with (if you are not sure what you are doing) can you please verify it? I use wordpress multisite, this is why I chose to allow blogs.dir I want only my posts and categories indexed. That's it:)               User-agent: *          Disallow: /cron/     Disallow: /lo/     Disallow: /portfolio.html          Disallow: /wp-admin/     Disallow: /wp-content/     Disallow: /wp-includes/     Disallow: /wp-login.php          Allow: /wp-content/uploads/     Allow: /wp-content/blogs.dir/          Disallow: /author/     Disallow: /tag/     Disallow: /archives/     Disallow: /2010/*     Disallow: /2011/*     Disallow: /2012/*     Disallow: /about/          Disallow: /trackback     Disallow: */trackback     Disallow: /comments     Disallow: */comments     Disallow: /feed     Disallow: */feed     Disallow: /*.php$     Disallow: /*.js$     Disallow: /*.inc$     Disallow: /*.css$     Disallow: /*.gz$     Disallow: /*.wmv$     Disallow: /*.cgi$     Disallow: /*.xhtml$     Disallow: /*.xlsx $     Disallow: /*.doc$     Disallow: /*.pdf$     Disallow: /*.zip$          # Google Image     User-agent: Googlebot-Image     Disallow:     Allow: /*      Ty, take care;)


How would I create a Password Protected Page with Content on it? So for example, I want the page to show some content (a little text and some picture, but also require a password. Is this a template customization or is there a plugin?


getting image alt text via ACF plugin in WordPress

I am using the ACF plugin in my WP 3.3.1 application and I use the `the_field` method in many places across the site. One place in particular I use it is in a slideshow/carousel as below: `<img alt="" src="<?php the_field('slideshow_image'); ?>" />` I am trying to pull in the image alt text, which I have stored in `wp_postmeta` under the `_wp_attachment_image_alt` metakey...however, i'm not sure how to access this. Calling `the_field` with "image_alt" does not work and there is limited documentation.


How to remove the Plugins Editor from the admin menu

I have the code to remove the editor from the Appearance menu. But I can't find anyway to remove the editor from the Plugins.                   // Remove Editor from Apperance Menu     function remove_editor_menu() {       remove_action('admin_menu', '_add_themes_utility_last', 101);         }     add_action('_admin_menu', 'remove_editor_menu', 1);


Query specific Pages

I wonder if someone would know how to query specific pages (not by id), lets say I create a custom field called "product", and I would like to query all pages with that custom field. Any Help? Kind Regards :)! UPDATE: So far I've found this solution thank u so much! so far I've found this solution                global $wp_query;      $args = array_merge( $wp_query->query, array( 'post_type' => 'page' , 'meta_key' => 'product' ) );      query_posts( $args );          ?>      and works really cool!


Specifying Mouseover Icon for Custom Post

I am using the register_post_type function in order to create a custom post type. I am already using the menu_icon parameter in order to set the admin icon for the post type. But, how can I set the 'mouseover' icon? When I have seen other plugins create custom post types, they have a seperate 'color' version of their icon that shows on mouseover -


wp_generate_attachment_metadata returns empty array

foreach ($_FILES as $key => $file) {                 $uploadedImage = wp_handle_upload($_FILES[$key], $upload_overrides);                      pre_r($uploadedImage);                      if (!isset($uploadedImage['error'])) {                          $attachID = wp_insert_attachment($uploadedImage, $uploadedImage['file']);                          require_once(ABSPATH . 'wp-admin/includes/image.php');                     $attach_data = wp_generate_attachment_metadata( $attachID, $uploadedImage['file'] );                          print_r($attach_data);                          wp_update_attachment_metadata( $attachID, $attach_data );                      } else {                      }             }      Im almost positive this code should work. I have looked around and people were saying once the added the require_once this worked. The upload works, the file is added to the media library but no metadata is generated. Any suggestions?


Trying to limit access to custom meta box without success

I have this meta box that I have added to my site:               // Assistant Editor Box     add_action( 'add_meta_boxes', 'assistant_editor_box' );     function assistant_editor_box() {         add_meta_box(             'assistant_editor_box', // id, used as the html id att             __( 'Assistant Editor' ), // meta box title             'assistant_editor_cb', // callback function, spits out the content             'post', // post type or page. This adds to posts only             'side', // context, where on the screen             'high' // priority, where should this go in the context         );     }          function assistant_editor_cb( $post ) {         global $wpdb;         $value = get_post_meta($post->ID, 'proofread', true);         echo '
Proofread: ';              $assedit = array(             1 => ' Yes ',         );              echo '<select name="proofread">';         echo '<option value=""' . ((($value == '') || !isset($assedit[$value])) ? ' selected="selected"' : '') . '> No </option>';              // output         foreach ($assedit as $id => $text) {             echo '<option value="' . $id . '"' . (($value == $id) ? ' selected="selected"' : '') . '">' . $text. '</option>';         }         echo '</select>';              echo '
';     }          add_action( 'save_post', 'save_metadata');          function save_metadataeditass($postid)     {            if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false;         if ( !current_user_can( 'edit_page', $postid ) ) return false;         if( empty($postid) ) return false;                   if ( is_null($_REQUEST["proofread"]) ) {             delete_post_meta($postid, 'proofread');         } else {             update_post_meta($postid, 'proofread', $_REQUEST['proofread']);         }          }     // END Assistant Editor Box      I want to limit access to it based on Capability. I tried the following code:               function remove_assistant_editor_box_meta() {         if (!current_user_can('edit_others_posts')){            remove_meta_box( 'assistant_editor_box', 'post', 'side' );        }     }          add_action( 'admin_menu' , 'remove_assistant_editor_box_meta' );      Did not work, tried this as well:               function remove_assistant_editor_box_meta(){         if(function_exists('assistant_editor_box') && !current_user_can('edit_others_posts')){             add_filter('assistant_editor_box', '__return_false');         }        }     add_action('init', 'remove_assistant_editor_box_meta');      According to the Wordpress documents, the first code should work, **what in the world am I doing wrong here**?


How to list all images in uploads directory except those that are attached to any post

I've got code in my functions.php which parses the WP uploads folder and lists all images it finds there. Is it possible to place a filter here that would exclude any image that is already "attached" to a post? eg: "List all images in folder "uploads" where image is not found in (attached images)"


Child Theme activates, but nothing from parent theme displays (MAMP, Multisite)

I searched for a solution for this problem, but cannot find an answer (or exact replica of the problem) Basically, I set up Multisite on MAMP Pro (Apache port 80, MySQL Port 3306). The set up was smooth, and I created a new site via a subdirectory. The parent theme loads fine. I created a child theme, and it activates (it doesn't show a broken message). On the Appearance page it shows the message "This theme requires the parent theme", but underneath the Theme Description. However when I view the front page of the site, the page is blank, and there is no html at all. Would could possibly be the error? I spent a few hours on this already and it's not going really well. Code of child theme, only CSS, no functions.php or other php files in the child theme folder.               /*     Theme Name: Confit Child Theme     Author: Automattic     Template: confit     Description: Confit Child Theme 1     Version: 1.0     */          @import url('../confit/style.css');        * Should also mention that the parent functions are not loading either.  Thanks!


How to detect mobile devices and present them a specific theme?

I would like to create a new modified version of my theme (check my profile if needed) to present to visitors if I detect that they are visiting the site from a hand-held device, like iPhone, Android, etc.   1. How to detect if the request is coming from a mobile device/browser?   2. How can I load and present them a dedicated theme? **More Info** : My theme is not fluid. It has a fixed width of about 976px (676px content + rest is left sidebar). I do not want to revolutionize the theme but I feel it is to large for 320x480 and 800x480 phones. Probably I will remove the sidebar or at least move it to right and do other small adjustments.


Advanced templating / Wordpress as a CMS questions

I have a Web site that consists of several pages, with different layouts, and also a blog. I would like all these page to be editable through Wordpress, rather than having them as custom pages through wordpress which I then have to manually edit the html for in a html editor. Is it possible to have multiple editable areas in a wordpress template? What I'm trying to achieve is a multi-column layout which is fully manageable in wordpress, is it possible? Thanks in advance!


Get the type of an advanced custom field (ACF) in a WP_Query loop

When reading posts with `WP_Query` how would I get the data type of an advanced custom field (textbox, date, number, repeater, …) ? My code:               $loop = new WP_Query( $args );       $posts = $loop->get_posts();      foreach ( $posts as $post ) {         $custom_fields = get_post_custom($post->ID);          foreach ( $custom_fields as $field_key => $field_values ) {             // Get type of field? How?         }     }


User registration approval based on role selected

On my site I've got two types of users, Subscribers and Partners. I've used Cimy User Extra Fields to add additional fields to the registration form. I've also used a plugin called WP Roles at Registration. This plugin adds a drop down box on the registration form so when a user registers they can pick their own role. What I want to be able to do is, if a user selects Subscriber as their role they become registered and can use their account as normal. However if a user selects Partner, the account needs to be reviewed and approved by an editor before they can use it, to ensure they are actually a Partner. The reason I say it needs to be approved by an editor is because the people who will be using it won't have access to an admin account. It also needs to send an email to an editor to tell them the account needs to be approved and possibly send an email to the user once their account has been approved. Is there anyway I can do this? Thanks


How to connect imported metabox content with media library id

i created metabox with media gallery id with it. i don't see any reverence on codex or anything that can point me how to connect my metabox content with media library id during import process. i try to find reference about `import_post_meta` action. but get nothing from codex. any one can point me how to link imported metabox content (width media gallery id with it) with meda gallery?


Extracting the post_id via the wp_insert_post action (external db query)

i'm writing a little action plugin. everytime a new post is created, a new table should be created in an external db. The name of the table sholud reflect the post_id of the newly created post, but i can0t figure how to pass it. Here's my code so far (for php purists, forgive me for using old mysql_connect (but adding the flag TRUE to the new_link parameter, i don't have to bother with wpdb globals etc)               function insert_new_table($post_id){         $usernamel = "secret";         $passwordl    = "secret";         $hostl    = "localhost";         $databasel    ="secret";         $connect = mysql_connect($hostl, $usernamel, $passwordl, TRUE) or die("Error");         mysql_select_db($databasel) or die("Error, Cannot locate the database!");         $table_name = 'tablename4';  //with this variable works         $postidl = get_the_ID();     // i'm outside the loop .. so what?         $sql = "CREATE TABLE $postidl (           id int(11) NOT NULL AUTO_INCREMENT,           name varchar(255) DEFAULT NULL,           UNIQUE KEY id (id)           );";         $query = mysql_query($sql);         return $post_id;         }     add_action( 'wp_insert_post', 'insert_new_table' );      everything is going smooth using the var $table_name in my $sql query; but i can't pass the post_id of the post that is currently being saved (don't know how to get it!) Any hint?


How To Display Pages Based On Subscriber Signup Date

I want to get a course rolling where I show a new link for a weekly lesson to a subscriber, based on how many weeks the subscriber has been registered. Say, the subscriber goes to the course page and gets shown something like the schematic below. http://imageshack.us/photo/my-images/845/coursedesignwordpress.png/ > Visitor Signups To My Blog = Week 0 I was thinking of using slugs to do this. So I would create a page with 'week-3' slug and then I would use some custom PHP code checking for the slug and return the right ones, on the course page. Example:   1. _Check for how long the user has signed-up (in weeks)_   2. _Show the title of page that has 'slug-'$weeks_ But there is a problem with this. **I wouldn't be able to easily change the order of the lesson. Say for example, change lesson from week-3 to week-2.** What is an easy way to do this and be able to easily change the lesson week?


Is It Possible to Restore Accidentally Deleted Widgets?

I accidentally deleted the widgets without dragging it to the inactive widgets section. I have a backup of all the files and the database but i have changed many things on the site other than the widgets. Can I only restore the widgets?


Taxonomy Drop Down with hierarchical view using $terms

I asked this on the Wordpress forum but dint get any replies now I hope I can ask it here. I found the code here My Code is:               function exc_custom_taxonomy_dropdown( $taxonomy, $orderby, $order, $hierarchical, $show_count,  $name) {         $args = array(             'orderby' => 'name',             'order' => 'ASC',             'hierarchical' => true,             'show_count' => true,         );         $terms = get_terms( $taxonomy, $args );         $name = ( $name ) ? $name : $taxonomy;         if ( $terms ) {             printf( '<select name="%s" class="postform">', $name );             foreach ( $terms as $term ) {                 printf( '<option value="%s">%s (%s)</option>', $term->slug, $term->name, $term->count );             }             print( '</select>' );         }     }     ?>     <form role="search" method="get" id="equipfilter" action="<?php bloginfo('url'); ?>">             <fieldset>                <?php exc_custom_taxonomy_dropdown( 'exc_equipment_cat', 'name', 'ASC', true, true, 'exc_equipment_cat'); ?>     -       </fieldset>             <fieldset>                 <legend>Kw Range:</legend>                 <input type="text" name="kw_min" placeholder="from" value>
                 <input type="text" name="kw_max" placeholder="to" value>             </fieldset>             <fieldset>                 <legend>Price Range:</legend>                 <input type="text" name="pr_min" placeholder="from" value>
                 <input type="text" name="pr_max" placeholder="to" value>             </fieldset>             <input type="submit" id="filtersubmit" value="Search" />         </form>      It creates a drop down for my custom taxonomy. It works 100% I just cant get it to show my categories with hierarchy like it would with wp_dropdown_categories. I have tried to use wp_dropdown_categories with a walker but it outputs a slug website.com?equipment_cat instead of website.com/equipment_cat. Here is my code for the wp_dropdown_categories with walker.               <?php     // Equipment Category Dropdown, thanks https://gist.github.com/2902509     class Walker_SlugValueCategoryDropdown extends Walker_CategoryDropdown {                  function start_el(&$output, $category, $depth, $args) {             $pad = str_repeat(' ', $depth * 3);                  $cat_name = apply_filters('list_cats', $category->name, $category);             $output .= "\t<option class=\"level-$depth\" value=\"".$category->slug."\"";             if ( $category->term_id == $args['selected'] )                 $output .= ' selected="selected"';             $output .= '>';             $output .= $pad.$cat_name;             if ( $args['show_count'] )                 $output .= '  ('. $category->count .')';             if (isset ( $args['show_last_update'] ) ) {                 $format = 'Y-m-d';                 $output .= '  ' . gmdate($format, $category->last_update_timestamp);             }             $output .= "</option>\n";         }     }     ?>     <form role="search" method="get" id="equipfilter" action="<?php bloginfo('url'); ?>">             <fieldset>                 <?php                 $dropdown_args = array(                     'taxonomy'      => 'exc_equipment_cat',                     'name'          => 'equipment_cat',                     'show_option_none'  => 'Select category',                     'show_count'        => 1,                     'orderby'       => 'name',                     'hierarchical'      => true,                     'echo'          => 1,                     'walker'            => new Walker_SlugValueCategoryDropdown);                      wp_dropdown_categories( $dropdown_args );                 ?>             </fieldset>             <fieldset>                 <legend>Kw Range:</legend>                 <input type="text" name="kw_min" placeholder="from" value>
                 <input type="text" name="kw_max" placeholder="to" value>             </fieldset>             <fieldset>                 <legend>Price Range:</legend>                 <input type="text" name="pr_min" placeholder="from" value>
                 <input type="text" name="pr_max" placeholder="to" value>             </fieldset>             <input type="submit" id="filtersubmit" value="Search" />         </form>      Help would really be appreciated.


Accessing two databases

I have two databases on my server, and wanted to know is there a way to access both databases from wordpress? My thought is adding the second set of credentials to the `wp-config.php`.


How to separate a specific page's comments from other comments

I am using WordPress comments on a page as a Contact form. Comments from my Contact form page are set to auto approve and only visible to the logged admin. Now in the dashboard I would like to separate my Contact form comments from the other comments. I would like to do it either by placing them in a theme option page or by using a filter on the comments page. Why I wanna do this new way? Because I believe it will be more user friendly.


How to Structure Wordpress for an Organization and its Departments?

I want to make a wordpress site for an organization (main) that has many departments. The requirements are   1. There is only one website ( or maybe same theme for the main site and its department site)   2. There are some categories such as news, events or other articles.    3. If writer from department post a news, it has to appear on main site in news section.    4. If writer from department post an event, it has to appear as well on main site but in event section.    5. User can visit department site that only contains news and events about that department   6. A Writer can post a news and event for main site that is not related to any departments. I have considered to use Multisite but the challenge is I can't find any plugins to retrieve post from another site for specific category (news or event). If I use a single wordpress, I have to think about how to display single page (I assume department is category or tag) with specific news and event widget that related to the department. **What is the best way in wordpress to achieve those requirements?**


Use lots of pages, or categories/posts?

Currently I am designing a website that will have alot of content. The site will be build like this: site.com/country/region/city/accommodationtype/accommodation Should I do this in pages and have A LOT of pages. Or... create alot of categories and have the accommodation as a post? Keep in mind that also the country, region, city and accommodation type should be able to rank in the search engines.


Problem with Custom Post Type Categories

Before I proceed on writing anything just have a look the following images. (snapshots) ![enter image description here](http://i.stack.imgur.com/LWlr3.jpg) ![enter image description here](http://i.stack.imgur.com/sLl3k.jpg) ![enter image description here](http://i.stack.imgur.com/HbOIv.jpg) I have one custom post type by name 'questions' just like we have 'posts/pages'. If you look at the image one, you can find that. And I found categories in that too. When I click on one of the categories in that (like Apostasy which has 1 article), I found that in categories of the questions (have a look at the image-2 for seeing that posts). Now, when I begin to edit that article (as you asked me in the question), I find 'categories on the right side as it supposed to be and it is no doubt have tick marks on the respected categories which my client needed. When I click on update. The questions are moving to the url `fatwaa.com/questions/post-title`. Whereas, when you look at the categories, you found zero posts. I then soon back posted a test article in the 'Post' Section by ticking mark the respected category then without any difficulty I'm getting that in the category. I have edited one archive and tick mark one category into that and it is working without any difficulty. So, I think the whole problem is causing due to this 'Questions Template'. Also on the home page whenever I go to any category it is displaying same posts again and again.. (here is the code of the home page) http://pastebin.com/5LqnwAzY


How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html? I read and it seems its not possible when using permalinks? The objective is to reduce the server load for 404 errors by not loading php.


How can I get only parent terms?

Is there any way to get only parent terms from custom taxonomy or category?


Conditional wp_enqueue_script on a page

For efficiency we are trying to hook some JS scripts only a certain page template of a theme that is to hold a form: page-with-form.php On the theme functions.php we've defined a init_method as such:               function my_init_method(){              $dir = get_bloginfo('stylesheet_directory')."/js/jquery.js";         wp_deregister_script('jquery');             wp_register_script('jquery',$dir);         wp_enqueue_script('jquery');              $dir = get_bloginfo('stylesheet_directory')."/js/jquery.validate.min.js";         wp_deregister_script('jquery.validate.min');             wp_register_script('jquery.validate',$dir);         wp_enqueue_script('jquery.validate.min');              $dir = get_bloginfo('stylesheet_directory')."/js/funcion.js";         wp_deregister_script('funcion');             wp_register_script('funcion',$dir);         wp_enqueue_script('funcion');     }          We then expected we could just add at the firts line of page-with-form.php page template (before get_header()) :               add_action('init', 'my_init_method');        * Is this not possible?   * Are we forced to add an if rule to the functions.php function to detect that we are on that page? _**Code modifications based on answers:_** On the page template load the function directly, no need to add_action("init"...               my_init_method();     ...     get_header();


How to automate featured posts number?

> **Possible Duplicate:**   >  featuring old articles without messing up with the archive Let's say you have a category called "featured". and you use that to feature posts. And the theme you have has a zone to show those featured posts and has room to show the last 5 featured posts in there. And you want to make the admin work as easy as possible to the degree that you only want to find yourself checking the posts into that "featured" category and you do NOT want to uncheck them later. You are basically only checking, and never unchecking. The problem is WP uses post_data to find out the most recent posts. But then, what do you do when you want to feature a very old post? how do you deal with that? Change the post_date? If you were to select that post into the "featured" category, that post is not going to make it into the top 5 because the other posts that happened to be "featured" and more recent may easily be pushing it down. In this case, I got no choice but change the the post_date of the article and this seems totally wrong to me. Because this definitely messes the ARCHIVE data integrity. Your 5 year old post will appear as brand new. What solutions are out there to address this problem? I almost think that the wp_posts table should have a special field called "post_feature_date". If we were to use the "sticky posts" feature, that's not gonna cut it neither because remember, I'm only interested in checking things, NOT UNCHECKING THINGS. If you got a simple blog, I do understand that this issue is not a matter but if you are using the WP to the rim in managing a huge portal, then you want to save every maintenance step as possible.


include wp-blog-header not working on MAMP

To clarify my question... My plugin is/was using AJAX to call the file `pluginname/submit/pick.php` My `pluginname/pluginname.php` contains the usual plugin header and wordpress automatically finds it. Original Question... I'm trying to use the global `$wpdb` in a plugin to insert data into one of my tables. From the docs it sounds like I just need to include `wp-blog-header.php` However when I try to do so I'm getting an error. > **PHP Fatal error:** [`require()`](function.require) : Failed opening > required 'http://localhost:8888/blog/wp-blog-header.php' > (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php') in > /Applications/MAMP/htdocs/blog/wp-content/plugins/pluginname/submit/pick.php > on line 4 My `pluginname/submit/pick.php` (which is called by AJAX) has the following code               <?php         $p = 'http://localhost:8888/blog/wp-blog-header.php';         echo $p;         require($p);         echo 'hi';     ?>       If I load the `pick.php`, I see `http://localhost:8888/blog/wp-blog- header.php` and that is it. So it must be failing on the require, as the error log confirms. The path is correct as I inserted a quick echo into `wp-blog-header.php`, and copy pasted the output from `pick.php` into the address bar and it worked. Any help would be appreciated.


Using Query Posts With Multiple Post Types And A Taxonomy

I am developing a site that has two different custom post types; one of them is called Articles and one is called Sketchpad. Sketchpad is user submitted content that is assigned a custom taxonomy term value of either; public or private. Public posts are shown on the site and private posts aren't. The article post type caleld Articles is added in by administrators in the Wordpress admin area, articles do not have a custom taxonomy. On the homepage I need to pull out both "article" and "sketchpad" post type posts and then sort them by date with newer posts as the top and older ones at the bottom. My current code is as follows:                   <?php             $args = array(                 'post_type' => array('sketchpad', 'article'),                 'taxonomy'  => 'type',                 'term'      => 'public'             );             // Only show content from the sketchpad post type where the taxonomy of type is public             query_posts($args);         ?>      The code above works, to an extent. You see only the post type "sketcphad" has the taxonomy of type and a term value of "public" so the issue is the above query is also checking if posts of the type "articles" have the particular taxonomy and term value as well. Is it possible to only make the taxonomy and term part of my query apply to the "sketchpad" post type and the post type of "article" doesn't have any filtering criteria applied to it? Basically what I am wanting to do is merge two different queries into the one and output the results.


Is my host the problem?

I've been working on my WordPress Site for quite some time now, and it's about ready to be deployed. One major issue, though - it's VERY SLOW! At first I thought that the 20 second load time could be attributed to the 100+ images on each page; however, after some analysis, I've come to find that it's taking nearly 10 seconds for the server to get through its initial queries (before any content can even think about being downloaded). I am very new to the hosting game, and I know nothing about it. I've done my fair share of reading and I've come across the idea of moving away from my cheap shared hosting plan to a dedicated host over at VPS.net. Furthermore, I plan on integrating a CDN to increase the speed of all of the images loading up. Two questions:   1. Would switching hosts make the page load time go down to around 5 seconds (or less!)   2. What are your thoughts on vps.net and their hosting options? Do you recommend any other hosts for a optimized wordpress site? Thank you! Evan


get excerpt without images

Is there any way to not get the images with get_the_excerpt()? I am using a my_recent_post() function to pull posts onto the home page and I don't need to have it pull the images within the posts, just some of the text. Here's the function that I am using:               function my_recent_post()      {       global $post;       $html = "";       $my_query = new WP_Query( array(            'post_type' => 'post',            'posts_per_page' => 3       ));            if( $my_query->have_posts() ) : while( $my_query->have_posts() ) : $my_query->the_post();                 $html .= "
" . get_the_date() . "" . get_the_post_thumbnail() . "            " . get_the_excerpt() . "

";            endwhile; endif;            return $html;     }     add_shortcode( 'news', 'my_recent_post' );