title: How to populate custom field dropdown box based on prior selection?

text: I have two dropdown boxes for a search that uses custom fields and I need the second dropbown box to be populated depending on the results of the first box. So far I have:               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">             <input type="text" name="s" id="s" value=""/>             <select id="stocktype" name="StockType">                 <?php                   //$make = $_GET['Make'];                   $metakey = 'StockType';                        $stocktypes = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );                   if ($stocktypes) {                     foreach ($stocktypes as $stocktype) {                       echo "<option value=\"" . $stocktype . "\">" . $stocktype . "</option>";                     }                   }                   ?>             </select>             <select id="make" name="Make">                 <?php                   //$make = $_GET['Make'];                   $metakey = 'Make';                        $makes = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );                   if ($makes) {                     foreach ($makes as $make) {                       echo "<option value=\"" . $make . "\">" . $make . "</option>";                     }                   }                   ?>             </select>             <select id="model" name="Model" onChange="handleSelection(value)">                 <?php                   //$make = $_GET['Make'];                   $metakey = 'Model';                        $models = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );                   if ($models) {                     foreach ($models as $model) {                       echo "<option value=\"" . $model . "\">" . $model . "</option>";                     }                   }                   ?>             </select>              <input type="hidden" name="post_type" value="vehicle" />             <input type="submit" id="searchsubmit" value="Search" />         </form>      I that works fine but right now the "Model" dropdown box is being populated with every model. I need it to only be populated with the models on the selection of the first dropdown box. For example, if the user selects "Toyota" than only the Toyota models will be shown in the second dropdown. I know I need to use ajax for this but I don't know how to set up the file that will be requested by ajax so that it contains logic. As far as js goes, I can do something like this:               <script>         jQuery(document).ready(function(){           $("#make").change(function() {             if ($(this).val() == 'TOYOTA') {                 $.ajax({                     url: "<?php bloginfo('template_url'); ?>/getModel.php",                     success: function(msg){                         $("#results").html(msg);                     }                });             }           });         });     </script>      How would I format the getModel.php file with specific database queries?


title: redirect to custom php template in wordpress plugin directory

text: i create a plugin that contain :   * index.php   * includes : index.php style.css i wanna create a plugin that when user active it , it redirect user to includes/index.html i wrote somthing like this               if(!function_exists(theme_redirect)) {      function theme_redirect () {        $options = get_option('option');         if(isset($options['redirect'])) {          $redirect = $options['redirect'];          }         else {          $redirect = false;          }               if($options['redirect'] == 1) {            include_once 'includes/index.php';            exit;          }         }        add_action (wp_header,'theme_redirect');       }      but when it redirected , it shows just html tag style never include i attached styles in includes/index.php with "> anyone can help me to include with another way?


title: Adding Media button to only pages

text: I have created a media button as such:                   // Create a media button for pages     function aisis_page_button_link(){         global $post_ID, $temp_ID, $iframe_post_id;         $iframe_post_id = (int) (0 == $post_ID ? $temp_ID : $post_ID);         $url = admin_url("/admin-ajax.php?post_id=$iframe_post_id&codes=aisis-page-codes&action=aisis_page_codes&TB_iframe=true");         echo "         ";     }          if(!empty($_GET['codes']) && $_GET['codes'] == 'aisis-page-codes'){         add_action( 'parse_request', 'parse_wp_request' );         echo parse_aisis_page_request($wp);         add_action( 'wp_ajax_asisi_page_codes', 'parse_aisis_page_request' );     }          function parse_aisis_page_request($wp){         aisis_require_page_code_display_page();         exit;     }          function aisis_require_page_code_display_page(){         require_once(CORETHEME_SHORTCODES . 'PageCodes.phtml');     }          add_action('media_buttons', 'aisis_page_button_link', 999);      Which then creates the desired effect of: ![enter image description here](http://i.stack.imgur.com/sQJ7i.png) **Note:** The above code is for the second "page" like icon. What I want to do is only have the above code run on pages, and only pages. that is edit and add new page. I know I would edit the `aisis_page_button_link()` function, and I can figure out how to make it appear for adding a new page, how ever how do you make it appear for editing a page?


title: Query & Sort Comments by custom comment meta

text: I added a basic "favorite/recommend" functionality for posts and comments to a wordpress site I'm working on. I'm storing the total numbers of comment "likes" in a custom comment meta field (update_comment_meta). Now I would like to query and sort comments based on this custom meta key and the corresponding values in order to display popular comments. Ideally I would like to be able to use parameters like "meta_key" and "order_by=meta_value_num" similar to WP_Query, but apparently comment queries don't support those. Do I have to use a custom written query to the database? If so, could anybody give me an initial push as to how to approach this?


title: Wrapping x posts in html without leaving empty html

text:
So I'm trying to spit out unlimited numbers of posts for this wp_query, 6 at a time, each one being wrapped in `<dd>` so that it functions with my jQuery slider. The problem is, if I have exactly 6 posts, or 12 posts, I wind up with one empty `<dd></dd>` at the end. Am I doing this wrong, or is this a limitation to Wordpress?

             <?php $our_work1 = new WP_Query(array(             'post_type' => 'our-work',             'posts_per_page' => -1,             'meta_key' => 'featured_work',             'meta_value' => 'yes',             ) ); ?>                  <?php $count = 1; while ($our_work1->have_posts()) : $our_work1->the_post(); ?>

                  <?php if ($count % 6 == 0){ ?>

             <?php } $count++; ?>             <?php endwhile; ?>


title: Category related -> excerpt, title and thumb in sidebar on article page

text:
I've done some research and tried different solutions but this snippet gets me the actual post content in sidebar, when on a single/article page, from the category the post belogs to. But I need to show the excerpt instead of the whole text and also a thumbnail and can't figure out how to add them. Any suggestions please?               <?php     $categories = get_the_category();     echo '

';     foreach ($categories as $c) {         if (strpos(get_permalink($post->ID), $c->slug) !== false) {             echo 'slug . '/">' . $c->name . '';             $current_cat = $c->cat_ID;         }     }     $posts = get_posts(array('cat' => $current_cat));     if (!empty($posts)) {         echo '
';         foreach ($posts as $p) {             echo '
ID) . '">' . $p->post_title . '
';             echo $p->post_content;         }         echo '
';     }     echo '

';     ?>       Or another approach maybe? Thank you.


title: margins in between pagination links

text: Any ideas how I could increase the spaces between the pagination links on my site? http://guvno.com/ I'm guessing adding some padding code to the custom.css maybe? I'm a beginner. Thank you for any advice.


title: Custom field as Slug

text: I would like to ask if it's possible for a custom field to become a slug. Like if I have a custom field of "when" whose value is "today", I would like the address of the post to be example.com/taxonomy/today I know slug is editable via permalink portion, but I plan on doing a frontend user posting, I want to try WP User Frontend Pro but it seems like it doesn't have the slug feature, but it has the custom field feature.. that's why I'm asking if it's possible for a custom field to become a slug. I've tried suggestions on other posts, nothing seemed to work.


title: Custom WP_Query with SQL directives for getting posts by authors and terms

text: I am making a custom page where I need to display posts from authors and terms (categories). I tried with the built in WP_query arguments but I am not getting the result I want. So I want to know how I can get all posts from X authors AND Y Categories (terms) using SQL directives and WP_Query. I already read the codex http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query but I still dont quite get how SQL works. I know the basics but I dont know how to link terms and categories, etc... Thanks in advance.


title: Infinite scroll repeats posts in custom loop in single.php

text: I'm feteching recent posts with infinite scroll in single.php. My single.php code looks like:               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>     ...     <?php endwhile; /* end loop */ ?>     <?php wp_reset_query(); ?>     <?php get_template_part( 'recent-posts'); ?>      The recent-posts.php code is:               <? $page = (get_query_var('paged')) ? get_query_var('paged') : 1;     $this_post = $post->ID;     query_posts(array('post__not_in' => array($this_post), 'posts_per_page' => 9, 'paged' => $paged,));     ?>     <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     ....     <?php  endwhile; endif; ?>      Everythinhg thing is working except the infinite scroll repeats the first set of 9 posts again and againt when I scroll down. I check the course code and found that pagination has a problem. It put the paging the end of post url. I've tried by adding Wp_reset_query in single.php as you can see in above mentioned code, but it didn't work either.               <a href="http://mysite.com/2013/07/current-post-example/page/2/" class="next">


title: Remove W3 Total Cache minified files on custom page outside of WordPress

text: I have created a page outside my WP network install (following this info from css-tricks) The output of which is used for a Facebook business page tab as a Facebook app. It is working just fine, however I use W3 Total Cache on the site and noticed the output contains redundant (in this instance) minified JS files, is there a way to stop The W3 Total Cache plugin from hooking in & including these files? The output is minified, which is a good thing so ideally i'd like to keep the minified output without the js files as they are not required. Any help, tips or links appreciated, thanks in advance, Aaron :)


title: media_sideload_image with rewritten urls?

text: When I try to use media_sideload_image with a path like this http://placekitten.com/300/200, it gives me an error. That is because it don't know the filetype or the filename. Best way to upload the image?


title: Custom posts per page does not work with pagination

text: I have one page in my template where I would like to set a custom posts_per_page. Here is the code I have used:               <?php     global $query_string;     query_posts($query_string . '&posts_per_page=4');      if ( have_posts() ) : while ( have_posts() ) : the_post();     ...      Now this code limits only 4 items per page and shows pageinate_links below as I have written. However clicking on any other page will lead to a 404. If I take out the global and query_posts line then it works fine. This is the paginate_links function I am using:               echo paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages,         'prev_text' => 'Previous',         'next_text' => 'Next',       ) );


title: Conditional tag in Widget Logic for checking if top level page or if subpage

text: I'm using the Widget Logic plugin to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code). What I would like to do is only show a widget on child pages, not top level pages. I tried both of the following but they both return true on all pages (so the widget shows on all pages):               global $post; return ($post->post_parent != 0);      and               global $post; return ( is_page() && $post->post_parent );      Note I tried this for testing and the widget displays on page ID 61 and its children, not just on its children as I was expecting:               global $post; return ($post->post_parent=="61");      Any tips? Thanks!


title: Horizontal drop down category with hover effect working

text:
It will be difficult to explain what I need in words, so please see a live demo of the horizontal navigation menu here, http://cn.wsj.com/gb/index.asp I want to replicate it for wordpress categories. The top menu should always show parent categories, and the drop down should show children of the parent category currently highlighted. So far I have this code.
         <li <?php if(is_home()) {echo 'class="current_page_item"';}?>><a href="<?php bloginfo('url'); ?>">Home
         <?php wp_list_categories('orderby=name&depth=1&title_li='); ?>
     <?php         $cat = get_query_var('cat');         $category = get_category ($cat);         $categories = get_the_category();              $subcat = get_the_category();         $parentCatName = get_cat_name($subcat[0]->parent);         $category_id = get_cat_ID( "$parentCatName" );              function post_is_in_descendant_category( $cats, $_post = null )         {             foreach ( (array) $cats as $cat ) {                 // get_term_children() accepts integer ID only                 $descendants = get_term_children( (int) $cat, 'category');                 if ( $descendants && in_category( $descendants, $_post ) )                     return true;             }             return false;         }              if ($category->cat_ID) {             if($category->category_parent) {                 //Displays subcategories on subcategory index                 $children = wp_list_categories("orderby=id&hide_empty=0&title_li=&child_of=".$category->category_parent."&echo=0");             }                 else {                     //Display subcategories on parent category index                     $children = wp_list_categories("orderby=id&hide_empty=0&title_li=&child_of=".$category->cat_ID."&echo=0");                 }             if ($children) { ?>
                   <?php echo $children; ?>
             <?php }         }         elseif (is_single() && (post_is_in_descendant_category($category_id)) && $categories[0]->category_parent == $category_id ) { ?>
                 <?php                                 $category = get_the_category();                     $cat_term_id = $category[0]->term_id;                     $cat_category_parent = $category[0]->category_parent;                     $listcat = wp_list_categories('echo=0&child_of='.$cat_category_parent.'&title_li=');                     $listcat = str_replace("cat-item-".$cat_term_id, "cat-item-".$cat_term_id." current-cat", $listcat);                     if ( in_category( $cat_term_id ) || post_is_in_descendant_category( $cat_category_parent )) {                         echo $listcat;                     }                 ?>
     <?php } ?>      But the issue is how to make the hover thing work. Please help. Thanks.


title: How to use more than 256MB of memory in the admin?

text: I'm building a site for a photographer who uploads pictures that are normally large for todays digital cameras. Images are quite memory intensive, especially the image operations like creating thumbnails. So I wanted to raise the memory limit in the admin above 256MB - how can this be done? I allowed CGI and PHP to use up to 1 Gigabyte but wordpress always decreases the memory to 256MB. Any idea how to fix that on a client side that needs to be able to auto-update? **UPDATE:** From Wordpress 3.2 ongoing the maximum memory limit in Wordpress will be configure-able again.


title: How to add default images for custom backgrounds?

text: The custom header feature allows (in some code I have found) to suggest several default images to use in the custom header. Could the same be built in the custom background? The idea is to have already some textures available for the user to choose from in the theme. Any ideas?


title: How to get IDs for objects in menu branch?

text: Is it possible to print content of all menu items, when displaying menu (or branch of menu as in question about displaying menu branches) ? ![enter image description here](http://i.stack.imgur.com/Eom4e.png) Once I click on `About Us` I wish for new page to display content of all it's children links. So basically I am looking for a way to get IDs of those posts/pages and use them inside my WP Query.


title: get_image_tag() html output : empty src attribute

text: I'm trying to use the `get_image_tag()` function to alter the html output of an image, like so :               add_filter('get_image_tag', 'kh_image_attachment', 10, 5);     function kh_image_attachment($html, $id, $alt, $title, $align) {         $html = '<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="' . esc_attr($img_src) . '" id="'.esc_attr($id).'" alt="' . esc_attr($alt) . '" title="'.esc_attr($title).'" class="'.$class.'" onload=lzld(this) onerror=lzld(this) />';         return $html;     }      Unfortunately, the `src` attribute remains empty (the class attribute as well, but I couldn't care less about that). I can't for the life of me figure out why. Can you help me out here? Thank you.


title: Is there a method to get a RSS element that is not covered by fetch_feed

text: Is there a method to get a RSS element that is not covered by current methods, for example:               $item->get_title()      when using fetch_feed? Thanks Kaiser, I found the solution:               if ($enclosure = $item->get_enclosure())          {              foreach ((array) $enclosure->get_thumbnails() as $thumbnail)                    {                          echo $thumbnail;                    }          }


title: wp_insert_post iframe missing

text: In my install, I used one custom page. Here I put one text field and the fck editor. This is for the title and the content. I need to insert this into a page. I used the following code               $my_post = array(         'post_title'    => $_POST['title'],         'post_content'  => $_POST['content'],         'post_type'       => 'page',         'post_status'   => 'publish',         'post_author'   => 1,         'menu_order'    => 10,     );          // Insert the post into the database     $post_ID = wp_insert_post( $my_post );        In the content field, I insert the content with some `iframe` videos. The page inserted successfully, but the iframe tags are not updated. They are deleted while update or insert the content.


title: Confused about image sizing business in Wordpress

text: I'm creating my first Wordpress theme and I've got everything working fine, and by following this tutorial and few others I've understood how to add custom image sizes by using add_image_size() function. However, I just don't know what image size to choose when. For example, in my theme I have created a blog template that shows blog thumbnails in 3 columns. Each column is around 400px wide. So my first guess is that I should create a 400px wide image size, so that image is loaded whenever the blog page is loaded. My confusion here is first of all, how much height should I set? Should I have:               add_image_size('blog-grid', 400, 300, true), // Or     add_image_size('blog-grid', 400, 500, true), etc. // Or     add_image_size('blog-grid', 400, 'auto', true), etc. // Can I set it to 'auto'?      Because really, how am I supposed to know what height would the images be, I would rather just set the width and let the height be automatically adjusted to the proportion, so I won't even have to crop the images. Also having different heights in the grid won't break my layout or anything, might even look good if I choose a masonry layout. My second confusion is that when the browser re-sizes, the columns stack on one another (I'm using Bootstrap), so the displayed image increases. Would this be a factor in choosing the custom image size? Another concern that I have is that I have given the user an option to choose between 2 column, 3 column and 4 column grid layouts. Should I create 3 different image sizes for these or it would be better if choose an average of the three. Also, I've inspected a theme and found out that it uses images double the size of the ones required. So for example, in a blog where a column is 400px wide(and so the image), the image size used for this is more than 800px wide. Is this to do with retina display? As I believe I've already taken care of that in my theme by using retina.js and by following this tutorial. Do I still need to worry about retina display, when adding custom sizes? I know these questions probably sound really stupid, but I would really appreciate any help regarding this. Thanks!


title: How to change color of registered widget areas in admin?

text:
Right now they are all gray. How to change the color? I mean, how to add a class or id to the registered widget area that are shown in the admin area? This is how you register the admin areas in my functions.php right now:               register_sidebar( array(             'name' => __( 'Main Sidebar', 'twentyeleven' ),             'id' => 'sidebar-1',             'before_widget' => '',             'after_widget' => "",             'before_title' => '
',             'after_title' => '
',         ) );      How can I add some attribute to add class in the admin, so I can style it later via CSS?


title: Output only the 3rd level of menu

text: Currently I use `wp_nav_menu` to output the first and second level of the menu in the header of the page. However the menus have more depth than that and I need the third level to be shown at a different place. I was hoping that `wp_nav_menu` had some kind of "level" parameter that shows only the appropriate level of the menu – but it hasn't. Note: I'm aware of `wp_list_pages`, which I can't use since there are not only pages involved.


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

text: 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 :)


title: Custom Plugin theme filter

text:
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?


title: How to change the menu items in WPTouch

text: 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?


title: Author capabilities: Deleting comments on their own published posts

text: 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?


title: Custom Post Type Order Issue

text:
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..


title: wp_logout_url isn't forwarding to correct link

text: 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!


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

text: 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?


title: Custom Post type taxonomy single templates

text: 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;     }


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

text: 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).


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

text: 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


title: Call a function with href

text: 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.


title: How to decrease the file size upload limit?

text: 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


title: wordpress plugins with add-ons

text: 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!


title: Add capability for editors to modify custom fields

text: 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?


title: Widgets not showing on sidebars

text:
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?


title: How do I Query 2 Custom Post Types?

text: 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?


title: Custom Query With Multiple Meta Key Value

text:
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 :)


title: Query shopp categories and CPT

text:
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.


title: using add_action without having custom plugin or theme

text: 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?


title: Uploaded images do not show on localhost

text: 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.


title: Exclude subcategory from wp_query

text: 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?


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

text: **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!


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

text: 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!


title: adding some custom html code to the wp_nav_menu function

text:
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         }     }


title: Display sidebar only if it has content

text:
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


title: Pros and cons of using Backbone for WordPress theming

text: 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?


title: What does get_current_screen() do?

text: 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;     }


title: What is WordPress file encoding?

text: 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.


title: standard wpGallery for post won't work

text: 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!


title: What does extract( shortcode_atts( array( do?

text: 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?


title: Can't access admin: "Not Acceptable"

text: 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?


title: $wpdb->insert Giving duplicates

text: 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"]     )     );     ?>


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

text: 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.


title: Prevent 404 of Author pages without posts

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


title: Simplest Way to Build Custom Archives Page?

text: 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 :)


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

text: 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.


title: Getting jQuery sortable items in custom metabox

text:
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 } ?>


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

text: 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.


title: How to duplicate custom menu settings to export to another site

text: 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


title: problem redirecting users to page on login

text: 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


title: Replacing broken urls (dreamweaver) to new ones in wordpress

text: 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


title: Moving Posts and Users Only to New Site

text: 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


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

text:
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 );


title: How to customize submenus isn wordpress theme

text: 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/


title: Problem with load_theme_textdomain

text: 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?


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

text:
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!


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

text: 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`)?


title: Same email for all comments

text: 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?


title: How to configure nginx for wordpress

text: 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?


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

text: 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


title: Plugin for communicating with clients

text: 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?


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

text:
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.


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

text:
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?


title: Dynamic carousel on individual posts

text: 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!


title: Limit cache size from W3 Total Cache

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


title: Show warning if plugin is missing

text: 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.


title: Migrating static site to multisite with multiple domains and subdomains

text: 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!!!


title: Can you please verify my robots.txt for wordpress

text: 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?


title: getting image alt text via ACF plugin in WordPress

text: 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.


title: How to remove the Plugins Editor from the admin menu

text: 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);


title: Query specific Pages

text: 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!


title: Specifying Mouseover Icon for Custom Post

text: 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 -


title: wp_generate_attachment_metadata returns empty array

text: 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?


title: Trying to limit access to custom meta box without success

text:
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**?