title: How do register_sidebar() and get_sidebar() work together?

text:
_**Disclaimer:_** I am brand spanking new to WP. I am using the Starkers HTML5 framework theme. In the `functions.php` I see this code:               function starkers_widgets_init() {            // Area 1, located at the top of the sidebar.       register_sidebar( array(         'name' => __( 'Primary Widget Area', 'starkers' ),         'id' => 'primary-widget-area',         'description' => __( 'The primary widget area', 'starkers' ),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',       ) );            // Area 3, located in the footer. Empty by default.       register_sidebar( array(         'name' => __( 'First Footer Widget Area', 'starkers' ),         'id' => 'first-footer-widget-area',         'description' => __( 'The first footer widget area', 'starkers' ),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',       ) );            // ... more calls to register_sidebar() ...      }      And in `footer.php` I see this code:               <?php get_sidebar( 'footer' ); ?>      I don't understand how `get_sidebar()` knows how to take that string argument and find the appropriate widgets that were defined by `register_sidebar()`. In the functions.php snippet I posted above. There isn't any mention of "footer" except for the `name`, `id` and `description` properties. But it would seem odd to me that `get_sidebar()` would search for 'footer' inside those properties. Does this make sense what I am asking? Is there some missing piece? The reasons I am asking is because - I would like to know more about the WP architecture - I would like to be able to define a custom widget area and know how to render it on a specific page. Thanks a ton.


title: Wordpress LaTeX symbol inline fails

text: I've got a problem with LaTeX and Wordpress. I want to put my formula inline with the rest of the text. I've tried several solutions, but none of them worked. I'm using Easy WP LaTeX plugin. Here's the formula:               blablabla $$A = \left \{ a_{1}, ..., a_{n} \right \}!$$ blablablabla...      I've tried this one, too:               blablabla $$\inline A = \left \{ a_{1}, ..., a_{n} \right \}$$ blablablabla...      But it's still in another line alone. What can be the problem?


title: URL redirect on updating the post date

text: I updated the date in the post. But the old URL has already gone viral and people end up in a deadlink as "page not found". I tried using Simple 301 Redirect WordPress Plugin and also Permalink Redirect WordPress Plugin. But it does not seem to work. I want to redirect from `http://www.example.com/2014/02/20/events-2014/` to `http://www.example.com/2014/03/02/events-2014/` Also all my Mobile apps are synced to the website. I do not want them to get affected because of this redirection.


title: Pages and posts with Rel Canonical issues across entire site

text: SEOmoz is showing that a number of my sites have issues with Rel Canonical which they describe as "Using rel=canonical suggests to search engines which URL should be seen as canonical." I'm using Yoast's SEO plugin but I'm unsure what would cause this error. Is it a result of something having to do with renaming pages or changing the permalinks? If so, how would I resolve it? http://www.seomoz.org/blog/canonical-url-tag-the-most-important-advancement- in-seo-practices-since-sitemaps


title: Link to user's profile settings page?

text: I'm trying to figure out how to link a logged-in user to his profile settings, but I can't seem to find a function that generates this link (like `wp_settings_url()` or `wp_profile_url()`) Is there a default function for this?


title: Set default post author to none on new post

text:
On a large multisite install with 200 authors I need the author on new posts to default to none. I unset the post_author div and moved it to the publish box (where it should be anyway) and wrote a new post_author_meta_box function since there is no way to change the wp_dropdown_users $args. <--track ticket. It works and sets the author to none but when a post is edited it goes back to none instead of the previously saved author.               //Replacement for post_author_meta_box           function better_author_meta_box($post) { ?>          <?php _e('Author'); ?> <?php              if ( empty($post->ID) ) : $selected = false; else : $selected = $post->post_author; endif;         wp_dropdown_users( array(                 'who' => 'authors',                 'name' => 'post_author_override',                 'selected' => $selected,     //also tried: 'selected' => empty($post->ID) ? false : $post->post_author,                  'include_selected' => true,                 'show_option_none' => 'NONE'           ) );       }          //Moves post_author_div to the publish box     add_action( 'post_submitbox_misc_actions', 'move_author_meta' );     function move_author_meta() {     global $post_ID;     $post = get_post( $post_ID );     echo '
Author: ';     better_author_meta_box( $post );     echo '
';     }


title: How to get the original post_id of a static home page?

text: I can't figure out how to get the original post_id of a specific page if that page has been set as the static posts page of the blog. I have a page that normally has a post_id of 95, but as soon as I set it to the static posts page, it returns a post_id of 0 and it's causing me lots of headaches. How can I retrieve the original post_id - which _is_ stored in the DB because it comes right back if I make it not the static posts page any longer.


title: Customise search page depending on result

text: Is it possible in wordpress to customise the search page to show certain information depending on the result? For example I run a motorsport site and if I searched for Jenson Button it would return a page with all the posts mentioning Jenson Button ( http://www.thecheckeredflag.co.uk/?s=Jenson+Button ). Is it possible to customise this page to show a div at the top with relevant links about that Jenson Button or whatever driver/search term the user is looking for?


title: Preview posts returns 404

text: It's a large Wordpress multisite installation, using subfolders for the individual blogs, not domains. We are running version 3.1, and preview posts doesn't work. When I press preview I get the 404.php page. Nothing in the log files that caught my eye, all plugins disabled. Sometimes I get an error message about insufficient rights when I press preview. I'm running out of ideas to try.


title: Can I Download a Free Wordpress Theme, Edit it and Use it?

text: I read that all themes on the wordpress.org site are GPL compatible. So can I download the theme, edit it and use it? Can I remove the links that point to the theme developer's website? Does the GPL license allow this?


title: Wordpress repository forbids me call wp-load.php in non-WordPress file

text: I have made a Wordpress Plugin that is a kind of Download Manager. I have a external file download.php that is responsible for making downloads. This file is away of environment Wordpress, for this reason I must called:               $wp_root = dirname(dirname(dirname(dirname(__FILE__))));     require_once $wp_root.'/wp-load.php';      and I can use $wpdb for my sql query. Note: This file must be external because I use functions "headers()" for force the download.               header("Pragma: public");     header("Expires: 0");     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");     header("Content-Type: ".$ctype);     header("Content-Length: ".$size);     header("Content-Disposition: attachment; filename=".$info->url_file);     header("Content-Transfer-Encoding: binary");      My plugin works great!, But when I want to publish it on the Wordpress repository, they answered me that it is forbidden to directly call wp-load.php or wp-config.php > Including wp-config.php and / or wp-load.php is not a good idea and we > cannot approve a plugin that does so unless it has a very good reason to > load the file(s). It is prone to failure since not all WordPress installs > have the exact same file structure. I don't know that use for I can use $wpbd Note2: For download I first validate it with the DB, then download. This is my plugin -> http://demo.gopymes.pe/social-godownload/ * * * Update Sunday 24 febrary 2013 This is getting complicated for me. I can not find documentation on "wp_loaded" so I'm lost with that function. I tested "template_redirect" but I realized that's not what I want, because redirects the document to download and I do not want the user to know where is located the document to download. I was reviewing the plugin "DownloadMonitor" and oddly have the same mistake I did, include "wp-load.php" and "wp-login.php" in download.php, however they are in the Wordpress's repository and I do not leave. Well, keep looking .. * * * Update ok Ok It Works ! I used               add_action('init', 'process');          function process() {         if(!isset($_GET['goaction'])) return;         if($_GET['goaction']=='process')         include("godownload.php");     }


title: can't limit search to only pages

text: I'm trying to limit a search to only pages, but it isn't working properly. When I include this hidden field in the search form:               <input type="hidden" name="post_type" value="page" />      The results include posts, pages, and custom post types. If I change the above to search only posts, it works properly, and only posts are displayed. Anyone have any ideas why it won't properly restrict my post to only display pages? I need to restrict the results for this search form only, so modifying the search query results in the search results template or in functions.php won't work for me.


title: On Multisite: Loop to Show First Four Images of Recent Posts Across Network

text:
I would like to display the first four images from posts across a WordPress network. In Otto's image gallery tutorial he recommended using the following to get images from recent posts. Query parameters:               $images = new WP_Query( array(     'post_parent' => get_the_ID(),     'post_status' => 'inherit',     'post_type' => 'attachment',     'post_mime_type' => 'image',     'order' => 'ASC',     'orderby' => 'menu_order ID',     'posts_per_page' => 4,     'post__not_in' => array($thumb_id),     'update_post_term_cache' => false,     ) );      Then the following in the loop to display the attachments:               foreach ($images->posts as $image) {     echo '
ID).'">'.wp_get_attachment_image( $image->ID, 'gallery-overview-thumb' ).'
';      I'm trying to do the same in a network. I started by trying to use the same code along with the "Sitewide Tags Plugin", but it won't show the images for sub sites, just images created from the main site dashboard. Would it be a lot more work to get the same to work across a network? Thanks so much.


title: Connect Agile Carousel to WordPress AJAX

text: Originally I hacked together Agile Carousel and WordPress by passing wp- load.php into the AJAX script but clearly that isn't the way to go. I've now read that wp-admin/admin-ajax.php is better, but I can't yet trigger the `add_action('wp_ajax_nopriv_...')` method. How can I find out what the action value is? Without knowing this, what other ways can I trigger a method that has access to all of WordPress' variables/functions?


title: Side by side blog posts that are tied together

text: I'm looking for a way to have the screen split with side-by-side blog posts that are tied together. My client has her Grandather's travel dairies and wants to posts the entries. The originals are in German but she also has English translations. So what I'd like is column A has an English post and column B has the German post. Anyone know if there is a plugin or easy-ish way to do this? Maybe something to do with tying the post dates together?


title: How to check if woocommerce is activated in theme

text:
I'm creating a theme with woocommerce which has the following:

                          <?php if ( is_user_logged_in() ) { ?>     <a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?>     <?php }     else { ?>     <a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Sign-in','woothemes'); ?>"><?php _e('Sign-in','woothemes'); ?>     <?php } ?>

<a href="<?php echo get_option('home').'/'.'my-lists/'?>" title="My Wishlist">Wishlist

 <?php global $woocommerce; ?>          <a id="header-ShoppingCart" class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', 'My Bag (%d)', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?>

      However this breaks the site if the woocommerce plugin is not activated. How can I check if the woocommerce plugin is activated?


title: Multisite configuration fails with css/js files

text: I have installed Wordpress using multisite + path (as opposed to subdomain).   Seems to work, except JS/CSS files are not loaded. my conf:               <Directory "/var/www/pages">       Options All       AllowOverride All       Order allow,deny       Allow from all     </Directory>      My htaccess               RewriteEngine On     RewriteBase /pages/     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) home/itaymoav/dev/lmspages/$2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ home/itaymoav/dev/lmspages/$2 [L]     RewriteRule . index.php [L]      I followed all the steps in worpress.org tutorial on how to create multisite. Here is the config file entries:               /* Multisite */     define('WP_ALLOW_MULTISITE', true);          define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', 'localhost');     define('PATH_CURRENT_SITE', '/pages/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      What am I missing?


title: How can I add a box to edit Order on a regular post?

text: I'm currently using the menu_order field in the DB to have some custom ordering of posts. I want to expose this field to the user via the admin section, like it is when editing a Page (in Page Attributes). Is there a simple way to do this?


title: Removing Edit Permalink/View "Custom Post Type" areas

text: Trying to replicate some functionality I've seen on a few other themes before, but would like to know/understand for my own uses. I've created a custom post type, called "testimonials". I believe I've knocked out a pretty good chunk of the setup, using Justin Tadlock's awesome post on Custom Post Types. I've also seen his post on removing meta boxes, which is great. The thing I'm after is, when you usually type in a title on a post/page and click off of it, you'll get an "edit permalink" area. Normally, this is actually a useful thing, but in my case, for "testimonials" or "slideshow slides" this may actually confuse the user. Furthermore, once you save a "testimonial" or "slide", you may not want there to be an actual "single view". I'm not sure how it is normally done (poked around inside WooThemes -- but I'm still lost). I could do this with CSS, but looking at the actual source code of the page for Woothemes for example... it's just gone (which is what I prefer). Any help would be greatly appreciated. Thanks!


title: register_post_type and register taxonomy and htaccess

text: I installed a theme called "The Dawn". It supports the addition of new type of post and a taxonomy. Here's the code:               register_post_type('portfolio', array(           'description' => 'TheDawn Portfolio',         'show_ui' => true,         'menu_position' => 5,         'menu_icon' => get_bloginfo('template_directory') . '/images/admin/portfolio.png',         'exclude_from_search' => false,         'labels' => array(             'name' => 'Portfolio',             'singular_name' => 'Portfolio Item',             'add_new' => 'Add Portfolio Item',             'add_new_item' => 'Add New Portfolio Item',             'edit' => 'Edit Portfolio Item',             'edit_item' => 'Edit Portfolio Item',             'new_item' => 'New Portfolio Item',             'view' => 'View Portfolio Item',             'view_item' => 'View Portfolio Item',             'search_items' => 'Search Portfolio Items',             'not_found' => 'No Portfolio Items found',             'not_found_in_trash' => 'No Portfolio Items found in Trash',             'parent' => 'Parent Portfolio Item',         ),         'supports' => array('title', 'editor', 'comments', 'excerpt', 'custom-fields', 'revisions', 'thumbnail', 'author', 'page-attributes'),         'public' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => false,         //'rewrite' => array('slug' => 'portfolio', 'with_front' => true),         'taxonomies' => array( 'post_tag' ),         )      );          register_taxonomy( 'portfolios', 'portfolio', array( 'hierarchical' => true, 'label' => 'Portfolio Categories', 'query_var' => true, 'rewrite' => false ) );          This works fine ... but I do not know what to put in the htaccess. Indeed, base, there is no url rewriting (`rewrite => false`). So I have URLs like this: my-site /?portfolio=my-item. I find it very ugly. So I forced rewrite (`rewrite => true`): urls are generated my-site/portfolios/my-item. Except that now, if I click on my menu ... Wordpress generates 404. I guess I need to change the htaccess. What should I put? thank you


title: How to exclude a particular category from the category list

text: I'm trying to edit a wordpress theme. The following is the section of code where the list of categories is retrieved and displayed in a drop-down menu.               <p>     <label for="entrycat">* <?php _e( "Question category:", "sofa_qanda" ); ?></label>     <?php     $select = wp_dropdown_categories( 'show_option_none=Select&show_count=0&orderby=name&echo=0&hide_empty=0' );     $select = preg_replace( '|<select(.*?).*?>|i', '<select id="entrycat" name="entrycat" tabindex="4">', $select );     echo $select;     ?>     </p>      I what to exclude a particular category, say category id 10 from the list. How do I do that?


title: Implement "No related posts for this entry" into the loop?

text:
For my related posts I have set up a scrollable container. I need the HTML to be outside of the loop or otherwise the layout will be a mess if there are no related posts to display (missing divs that are inside the loop only if there are related posts to be shown). So, the only option I have is to display a message within the container that only shows up if there are no related posts to display. Something like: "sorry but there are no related posts for this entry" Unfortunately I'm not sure how to modify the code / how to implement it into the current code:
Related Posts

          <?php           $tags = wp_get_post_tags($post->ID);      if ($tags) {          $tag_ids = array();          foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;           $args=array(     'tag__in' => $tag_ids,     'post__not_in' => array($post->ID),     'showposts'=>12, // get all the posts at once, then split them up afterwards.     'ignore_sticky_posts' => 1      );          $posts_per_block = 4;          $my_query = new wp_query($args); ?>                    <?php     if( $my_query->have_posts() ) : while ($my_query->have_posts()) : $my_query->the_post();     if ( ($my_query->current_post) == 0 ) {         echo '
';     }     elseif ( ( $my_query->current_post ) % $posts_per_block == 0 ) {         echo '

'; //close and open a new div every nth post     }     ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

          <?php          if ( ( $my_query->current_post + 1) == ( $my_query->post_count ) ) {         echo '
'; //close the block if you run out of posts     } ?>          <?php     endwhile; endif;     ?>                    <?php } // end if($tags) ?>

                     Here's an example page without any tags. Here's an example with tags and related posts. Thanks so much in advance to anybody who can help me fix this.


title: turning off multi site mode makes XMLRPC fail : you are not allowed to publish posts on this site"

text: I am encountering an annoying problem with XMLRPC in wordpress. The following error is thrown: "Sorry, you are not allowed to publish posts on this site" Here is a snippet to test :               /*Credentials for XML-RPC server, plugin option*/     define('XMLRPC_USER',get_option('xmlrpc_user')) ;     define('XMLRPC_PWD',get_option('xmlrpc_pwd')) ;     define('XMLRPC_URL',get_option('xmlrpc_url')) ;          $client = new IXR_Client(XMLRPC_URL);          $content = array(             'title' => 'title',             'description' => 'description', //$wp_post_to_sync->post_content             'mt_allow_comments' => 0,  // 1 to allow comments             'mt_allow_pings' => 0,  // 1 to allow trackbacks             'post_type' => 'post',     );          $params = array(0,XMLRPC_USER,XMLRPC_PWD,$content,true); //true : publish, false, draft          $client->query('metaWeblog.newPost',$params) ;          var_dump($client->getErrorCode()) ;     var_dump($client->getErrorMessage()) ;          var_dump ($client->getResponse());       The code works fine when the website is set in multisite mode but when I turn the website in single mode, it fails.               /**     define('WP_ALLOW_MULTISITE', true);     // COMMENT MULTISITE SECTION     define( 'MULTISITE', true);     define( 'SUBDOMAIN_INSTALL', false );     $base = '/';     define( 'DOMAIN_CURRENT_SITE', 'mydomain.fr' );     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );     */      Does anybody can help me ? Thanks, ben


title: add_filter to the_content after apply_filters

text:
I have a shortcode that outputs null (""). What I'm trying to accomplish is to output a default message if the shortcode outputs null. I don't want to extend my shortcode because there may be multiple instances of the shortcode and I don't want to output the message multiple times. So my function is as follows:               function av_standalone_doc_404($content) {         if(has_term('standalone-document', 'formats')){             $filtered_content = apply_filters('the_content', $content);             if(empty($content)){                 // Display 404 message                 $output .= '
Error:                     Please check this page later.
';             }else{                 $output .= '';             }             return $output . $content;         }     }     add_filter('the_content', 'av_standalone_doc_404', 12);      The problem is that `apply_filters` is causing a fatal error - obviously because you can't apply a filter to the content and call `apply_filters` within that filter. The '12' load order doesn't appear to help either. How can I apply the filter after the subsequent filters which apply the shortcode to `the_content`?


title: best way to communicate between php and jquery/javascript

text: I have a custom post type "pakket", in which I've put all kinds of data in the taxonomy terms. This custom post type has about 50 items, each with their own values for taxonomy terms. For example: Pakket Hakhoutsingel (waardedaling)=0.6 (opbrengstderving)=YES (aanlegkosten)='string' Bossingel (waardedaling)=6 and so on.. I have the same 50 corresponding values (hakhoutsingel, bossingel etc.) in a dropdown box on a page with a form. http://areal-agro.nl/tool/?page_id=6 I want to get the 50 values from the database (with php), and check if they match the values from the dropdown box (jQuery). I know how to do both. Problem is, I cannot use a jQuery variable in php, because php is server-sided scripting. How can I tackle this problem?


title: Edit Yoast SEO breadcrumbs output

text:
I want to customise the output of Yoast SEO breadcrumbs, I have this so far which works great:               add_filter( 'wpseo_breadcrumb_single_link', 'ss_breadcrumb_single_link', 10, 2 );     function ss_breadcrumb_single_link( $link_output, $link ) {         $element = 'li';         $element = esc_attr( apply_filters( 'wpseo_breadcrumb_single_link_wrapper', $element ) );         $link_output = '<' . $element . ' typeof="v:Breadcrumb">';         if ( isset( $link['url'] ) && ( $i < ( count( $links ) - 1 ) || $paged ) ) {             $link_output .= '' . esc_html( $link['text'] ) . '';         } else {             if ( isset( $opt['breadcrumbs-boldlast'] ) && $opt['breadcrumbs-boldlast'] ) {                 $link_output .= '' . esc_html( $link['text'] ) . '';             } else {                 $link_output .= '
' . esc_html( $link['text'] ) . '
';             }         }         $link_output .= '</' . $element . '>';         return $link_output;     }          add_filter( 'wpseo_breadcrumb_output_wrapper', 'ss_breadcrumb_output_wrapper', 10, 1 );     function ss_breadcrumb_output_wrapper( $wrapper ) {         $wrapper = 'ol';         return $wrapper;     }      Next step is to change this line:               return apply_filters( 'wpseo_breadcrumb_output', '<' . $wrapper . $id . $class . ' xmlns:v="http://rdf.data-vocabulary.org/#">' . $output . '</' . $wrapper . '>' );      I want to add an aria element of `aria-labelledby="breadcrumblabel"` to that output. So I setup this function:               add_filter( 'wpseo_breadcrumb_output', 'ss_breadcrumb_output' );     function ss_breadcrumb_output() {         return apply_filters( 'ss_breadcrumb_output', '<' . $wrapper . $id . $class . ' xmlns:v="http://rdf.data-vocabulary.org/#">' . $output . '</' . $wrapper . '>' );     }      Problem I am having is `$wrapper $id $class` and `$output` all return null. I think I know why they are null although as a PHP beginner I can't explain it. If someone could point me in thr right direction so I can go figure this out, i'd appreciate it. Thanks.


title: get_post_custom_values not working

text:
I have made a custom template to show the posts in "Products" category in a single page.I have some custom fields.I need to show the values of the custom fields in the page. I have used the get_post_custom_values as the following but i get an error as               Warning: Invalid argument supplied for foreach() in C:\wamp\www\SampleSite\wp-content\themes\TwentyElevenChildTheme\products.php on line 11      The code for products.php is as follows.               <?php     /*     Template Name: Product Template     */     ?>     <?php get_header(); ?>
       <?php $recent = new WP_Query("cat=4&showposts=10"); while($recent->have_posts()) :$recent->the_post();?>       <?php $key_values = get_post_custom_values("Description"); ?>       <?php foreach($key_values as $key => $value )?>       <?php echo  "$key  => $value("Description")
";?>       <?php endwhile; ?>
     <?php get_footer(); ?>      I am not able to find what the error is.Someone please help me.


title: Show future events based on custom field AND order by date

text: I have a custom content type (event), within that type I have a custom date field, with the name: 'date'. In my template I am running the WP_Query to return a list of events. I would like to only get events that are in the future (according to my custom 'date' field) and then order the list by that same field. I have tried the following but it simply returns a list of all the 'events' in the system, regardless of date               $today = date('d M, y');          $args = array (         'post_type'              => 'event',         'meta_query'             => array(             array(                 'key'       => 'date',                 'value'     => $today,                 'compare'   => '>',                 'type'      => 'CHAR',             ),         ),         'meta_key'               => 'date',         'orderby'                => 'meta_value_num',         'order'                  => 'ASC'     );      As a note: if I replace the type from 'CHAR' to 'DATE' I get no results returned...


title: Can't get the previous and next posts permalink

text:
I tried to get the next and previous URL, and create a navigation. But it seems to only retrieve the permalink from the two first posts (but not the others recents posts). I have 5 posts (ID = 25, 86, 80, 75, 45). When I am on the first post (ID = 25) and I click on previous post, I am going to post ID = 45, and after when I click on previous it stay on the same page.               <?php        if (have_posts()) : while (have_posts()) : the_post();            $prev = get_permalink(get_adjacent_post(false,'',false));       $next = get_permalink(get_adjacent_post(false,'',true)); ?>
         <a class="prev" href="<?php echo $prev; ?>">

         <a class="next" href="<?php echo $next; ?>">
          <?php endwhile; endif; get_footer(); ?>      I also tried to put the code after the while loop. **Update** I solved the problem. When I published my posts, they had all the same date, so it displayed only one post from this date. I changed with a different day date, and it works! My bad.


title: How to use default WP form elements to interact with custom DB table?

text:
I know about the use of Custom Post Types, but in this case I do need to use a custom database table (FYI: it's a table that is IP-based shared with another non-WP website). In wp-admin, I'd like to use as many as possible default/built-in WP functions for form elements. For example, I'd like to use a photo upload. I am also following the CreateReadUpdateDelete (CRUD) principle. So for example, for the read part, I extended the `WP_list_table` class. What WP form elements can I use for create and update part?   I started out with this, but it doesn't look WP-ish               function contender_add_form_display(){         $return ='

Add contender
             <form name="contender" method="post" action="'.str_replace( '%7E', '~', $_SERVER['REQUEST_URI']).'">                <input type="hidden" name="online" value="1">              <input type="hidden" name="add" value="1">      Contender Description             <textarea id="contender_descr" style="width:260px!important;height:250px!important;"  name="contender_descr"></textarea>     etc.             </form>
         ';         echo $return;     }      Any tips, pointers?


title: JavaScript && operator in visual editor

text: I am used to of adding javascript/jquery code in posts via visual editor but it seems I never used && operator cause wordpress is altering && operator in &. Here is a link where I am using &&. http://demo.techstriders.com/corey/canyon/calculator/ I am wondering what is correct way of using javascript in wordpress visual editor.


title: Editor and contributor roles not correct after adding function

text: ** RESTATED ** I am creating a bridge. The work involves a default installation of WordPress and a plugin to bridge a forum and WordPress. The forum provides all the account information. The secondary usergroup of the forum is matched to the WP role. Now I am trying to retrieve the "role" selected in the options for that logged in user and add_role for the string. Inserting wp_die shows the correct role is being given to the logged in user. However, the wrong capabilities are being added. Everyone is getting admin.               // returns an array     var_dump( $XF->options['xf_user_role'] );          //returns string() "role such as administrator" (in quotes)     var_dump( $XF->options['xf_user_role'][$user_group] );      ** UPDATED **: Here is the latest partial code. There is no reason to really show filluserData               class XF_User_Data {          public static function fillUserData($visitor, $classObj, $user_id) {         // doing something and calls set_user_roles     }          public static function set_user_roles( &$classObj, $user_group_id, $secondary_group_ids ) {         /**          * Function set_user_roles(&$classObj, $user_group_id, $secondary_group_ids)          *           * This function sets the current user role based on the secondary group          */         global $XF, $wp_roles;         $user_groups = explode( ',', $secondary_group_ids );         $user_groups[] = $user_group_id;              /**          * Loop through the user_roles and find the WP role equivalent for each          */         $user_roles = array();         foreach( $user_groups as $user_group ) {             $user_roles[] = $XF->options['xf_user_role'][$user_group];                  /**              * wp_die( 'This is the role:' . var_dump( $XF->options['xf_user_role'] ) );              *               * Returns:              *              * array(7) { [3]=> string(13) "administrator" [4]=> string(6) "author" [2]=> string(10) "subscriber" [1]=> string(10) "subscriber" [5]=> string(6) "author" [7]=> string(11) "contributor" [6]=> string(6) "editor" }              */                  /**              * wp_die( var_dump( $XF->options['xf_user_role'][$user_group] ) );               *              * Returns for user Ellie who has secondary group related to author              * string(6) "author"              *               * Returns Albert who has secondary group set to editor              * string(6) "editor"              *              * Returns Pascal who has secondary group related to contributor              * string(11) "contributor"              *              * Returns Gracie NO secondary group for registered members.              * NULL              *                         */                  $new_roles =  $XF->options['xf_user_role'][$user_group];                  // wp_die( var_dump( $XF->options['xf_user_role'][$user_group] ) );                  if( $new_roles == 'administrator' ) {                      $capabilities = array (                      'activate_plugins','delete_others_pages','delete_others_posts','delete_pages','delete_plugins','delete_posts','delete_private_pages','delete_private_posts','delete_published_pages','delete_published_posts','edit_dashboard','edit_files','edit_others_pages','edit_others_posts','edit_pages','edit_posts','edit_private_pages','edit_private_posts','edit_published_pages','edit_published_posts','edit_theme_options','export','import','list_users','manage_categories','manage_links','manage_options','moderate_comments','promote_users','publish_pages','publish_posts','read_private_pages','read_private_posts','read','remove_users','switch_themes','upload_files','create_product'                 );                      $user_id = $XF->visitor->get('user_id');                      $user = new WP_User( $user_id );                      foreach ( $capabilities as $cap ) {                          $user->add_cap( $cap );                       }                      break;                  }                                 elseif( $role == 'editor' ) {                      $capabilities = array (                      'delete_others_pages','delete_others_posts','delete_pages','delete_post','delete_private_pages','delete_private_posts','delete_published_pages','delete_published_posts','edit_others_pages','edit_others_posts','edit_pages','edit_posts', 'edit_private_pages','edit_private_posts','edit_published_pages','edit_published_posts','manage_categories','manage_links','moderate_comments','publish_pages','publish_posts','read','read_private_pages','read_private_posts'                 );                      $user_id = $XF->visitor->get('user_id');                      $user = new WP_User( $user_id );                      foreach ( $capabilities as $cap ) {                          $user->add_cap( $cap );                       }                      break;                  }                  elseif( $new_roles == 'author' ) {                                $capabilities = array(                     'delete_posts', 'delete_published_posts','edit_posts', 'edit_published_posts','publish_posts', 'read', 'upload_files','upload_files'                     );                      $user_id = $XF->visitor->get('user_id');                      $user = new WP_User( $user_id );                      foreach ( $capabilities as $cap ) {                          $user->add_cap( $cap );                       }                      break;                  }                     elseif( $new_roles == 'contributor' ) {                      $capabilities = array( 'delete_posts', 'edit_posts', 'read' );                      $user_id = $XF->visitor->get('user_id');                      $user = new WP_User( $user_id );                      foreach ( $capabilities as $cap ) {                          $user->add_cap( $cap );                       }                      break;                  }                  elseif( $new_roles == '' || $new_roles == NULL || $new_roles == 'subscriber' ) {                      $capabilities = array( 'read' );                      $user_id = $XF->visitor->get('user_id');                      $user = new WP_User( $user_id );                      foreach ( $capabilities as $cap ) {                          $user->add_cap( $cap );                       }                      break;                  }              }          }          public static function create_new_wp_user( $new_role, $user_id ) {              if( null == username_exists( $user_id ) ) {              ini_set('memory_limit', '128M');                // Generate the password and create the user           $password = wp_generate_password( 12, false );           $user_id = wp_create_user( $email_address, $password, $email_address );                // Set the nickname           wp_update_user(             array(               'ID'          =>    $user_id,               'nickname'    =>    $email_address             )           );                // Set the role           $user = new WP_User( $user_id );           $user->set_role( $new_role );                // Email the user           wp_mail( $email_address, 'Welcome!', 'Your Password: ' . $password );                return;                } // end if          }          }      The wrong capabilities are being added to the user roles. For example, everyone is getting administrator capabilities. What is wrong with this code? PS. I am a neophyte and know just enough to be dangerous ;)


title: Conditional logic for the new 3.6 structured post formats

text: Currently i have couple of custom fields in a custom metabox for post format options, like link url, video embed code etc... This works fine in version 3.5 and below. Now, with the new soon to be released 3.6, we have these structured post formats interface and of course i would like to use this instead of the custom metabox solution. What conditional logic should i use to disable the metabox in wp 3.6, so the metabox is still working in older versions?


title: Taxonomy query of custom post displays archive instead of posts

text:
I'm facing a strange issue displaying all posts of a certain type of custom post sorted by their category. The code below to display them works fine locally but when I view the page on the server it returns an archive page with three posts instead. How is that possible? This is the code to display the posts:                <?php $categories = get_terms('categor', 'orderby=count&order=DESC&hide_empty=1');      foreach( $categories as $category ):?>
<?php echo $category->name; // Prints the cat/taxonomy group title ?>
     <?php $posts = get_posts(array(              'post_type' => 'downloads',              'taxonomy' => $category->taxonomy,              'term' => $category->slug,              'nopaging' => true,       ));          foreach($posts as $post):       setup_postdata($post); //enables the_title(), the_content(), etc. without      specifying a post ID ?>          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

 <?php the_title(); ?>

 <a href="<?php the_field('file'); ?>"          target="_blank">Download file
<?php the_field('discription'); ?>
               <?php echo '
'; ?>

       <?php endforeach; ?>


title: How do I add tags/taxonomy to images + a query field on page to query 'albums' (images with same tag/taxonomy)

text: I've got lots and lots of photos on my site and I want to seperate them into albums. Every album is a client album (photoshoot). Though.. I want all my clients to query their album on my site. Something like: *Go to site, page "View your album!", fill in a search bar with unique id (e.g. Client.001.2013) and click non 'Show'. Now they see all their photos (that share the same id, (e.g. Client.001.2013). So summarized: I need two things (I guess), a way to give all my photos an ID/tag/Taxonomy (back-end) and a search bar on the front end of the site, so people can query those ID's/Tags/Taxonomies, so they see all pictures who share the same ID. What can you people advise me? ++ for thosesuggestions of a plugin that automatically nicely shows all the queried images in a gallery order or such. Thanks!


title: WP_Query and help with the loop for magazine front page

text:
I'm having a difficult time writing out the PHP for this magazine layout I'm making. Here's the prototype: http://socalnpo.org Here's what I currently have: http://socalnpo.org/wp The first 3 are the most recent (left to right) and the next 6 are the older ones. They all go in reverse chronological order. I'm not sure how to write the PHP for the loop because it's definitely not like a basic post. Here's what I have so far, but there really isn't much for PHP because I didn't know where to start.               <a href="<?php the_permalink() ?>" rel="bookmark">     <?php     if ( has_post_thumbnail() ) {       the_post_thumbnail('medium');     }     ?>
<a href="<?php the_permalink() ?>" rel="bookmark">     <?php the_title(); ?>
     <?php the_excerpt(); ?>
     <?php endwhile; ?>      I just need some help in the right direction to be able to do this, since I've been stuck on this for days. I was hoping there would be a way to isolate the last 9 individual posts so that I can force them into their own `<div>` to make it a little easier, even though it will be more tedious. Let me know what you think! Any help will be greatly appreciated! :) -Dana


title: How can I log a user out of Wordpress before the page loads?

text: I would am using the code below so that on my wordpress site if `?logout` is appended to the end of the URL the user will be logged out. This works well - if the user visits a page such as `mysite.com/?logout` or `mysite.com/test- page/?logout` or any page where the `$_GET['logout']` variable is set s/he will be logged out.               if( isset($_GET['logout']) ){         add_action('plugins_loaded', 'wp_logout',0);                 }      The problem I'm facing is that even if I add this action to `plugins_loaded`, which is at the very top of the list of action hooks, the page that displays will still show the user being logged in. If the page is refreshed on a subsequent load it will display the "logged out" version of the page, but not on the same request. **Steps to recreate problem:**   1. Add this code to a plugin or perhaps to your `functions.php` file. I have it in a file in the `mu-plugins` directory.   2. Log into your Wordpress site.   3. Visit a page or post on your site, perhaps one with a comments box, and append `?logout` to the URL   4. The page will load as normal, the comments box will have your name and show that you are logged in and can leave a reply   5. Reload the page (with or without `?login" appended to the url)   6. The page is now logged out **Desired Behavior** After you are logged in to Wordpress visiting a page with `?login` appended to the URL will complete the logout process and display the page as if you were logged out when it loads - without having to refresh it. I don't think I can hook into Wordpress any earlier, and so I'm not sure how to get around this.


title: How to unset adminmenu completely?

text: Is there a way to completely remove (unset) the left hand side admin menu? I examined the ozh-admin-drop-down-menu plugin, since it removes the entire admin menu and adds a top menu bar in order to get a clue.. I made a few snippets, but probably I am missing sth.. I couldn't manage to find a way out..


title: jQuery autcomplete not working

text: I am trying to implement jQuery autocomplete but it is not working. When loading it the following way it does work:               wp_enqueue_script('jquery-ui-autocomplete', '',array('jquery-ui-widget', 'jquery-ui-position'), '1.8.6');      However when loading the full jquery-ui downloaded from the website:               wp_deregister_script('jquery');     wp_deregister_script( 'jquery-ui-core' );          wp_register_script('jquery', (COLLABPRESS_PLUGIN_URL . 'includes/js/jquery-1.9.1.js'), false, '1.9.1');     wp_register_script('jquery-ui-core', (COLLABPRESS_PLUGIN_URL . 'includes/js/jquery-ui-1.10.3.custom.min.js'), array('jquery'), '1.10.3', 1 );          wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-core');      It does not work..   What am I missing here? There should be no different here, right? All other elements, such as calendar and slider, do work. UPDATE:   The plugin was loading a jQuery-ui theme, removing this results in the following:   Image: http://i.stack.imgur.com/UbymQ.png It thus does seem to work. However, adding any jquery-ui theme will result in the auto-complete not to be working at all anymore? Doesn't matter what version. Unless I use the first method mentioned above to include it, than it works no matter what jquer-ui style I use. UPDATE:   It seems that the div in which the results are displayed is automatically set to `display:none`. I also noticed when including both methods at the same time, it does work but when I rollover the selection menu quickly disappears (this is expected due to the multiple instances of auto complete). I looked online for similar issues with the `display:none` but non of the found answers are appliable. Any pointers? Thanks,


title: Display single widget

text:
I've created a simple one-off widget to let the admin change some copy on the home page, but the widget isn't showing its contents. On the home page, I have this code: `<?php the_widget('home_widget'); ?>` And this is the source code for the widget itself, as it appears in my functions.php file (it's Jeff Starr's Clean Markup Widget):               // Clean Markup Widget @ http://perishablepress.com/clean-markup-widget/     add_action('widgets_init', create_function('', 'register_widget("home_widget");'));     class home_widget extends WP_Widget {         function __construct() {             parent::WP_Widget('home_widget', "home page box",                               array('description'=>"The contents of the home page box"));         }         function widget($args, $instance) {             extract($args);             $markup = $instance['markup'];             if ($markup) echo $markup;         }         function update($new_instance, $old_instance) {             $instance = $old_instance;             $instance['markup'] = $new_instance['markup'];             return $instance;         }         function form($instance) {             if ($instance) $markup = esc_attr($instance['markup']);             else $markup = __('Sample markup', 'markup_widget'); ?>
                 <label for="<?php echo $this->get_field_id('markup'); ?>"><?php _e('Markup/text'); ?>
                 <textarea class="widefat" id="<?php echo $this->get_field_id('markup'); ?>" name="<?php echo $this->get_field_name('markup'); ?>" type="text" rows="16" cols="20" value="<?php echo $markup; ?>"><?php echo $markup; ?></textarea>
     <?php }     }      The widget looks and works perfectly in the Admin tool, and I can add text and save it, etc. But nothing displays on the home page. How can I get it to display the widget contents? To be clear: while I am putting the widget into a sidebar on the Admin interface (because you have to), I don't want to display the sidebar (since I have other widgets in there). I just want this one-off widget to display its contents on the home page. Very simple.


title: add_action and wp_head not display content in head section

text: I have a big problem. In a Wordpress page I've a function that generate og meta tags. I want to "append" that generated meta in the head section. So, I write this code:               add_action('wp_head', '_set_meta_tag');     function _set_meta_tag()     {         global $nome;         global $descr;         global $file;         global $path_meta;              $output = "";         $output .= '<meta property="og:title" content="'.$nome.'" />';         $output .= '<meta property="og:type" content="article" />';         $output .= '<meta property="og:image" content="'; $output .= get_bloginfo('template_url'); $output .= '/includes/img/immagini_evento/'.$file.'" />';         $output .= '<meta property="og:url" content="'.$path_meta.'" />';         $output .= '<meta property="og:description" content="'.truncate(htmlentities($descr),200).'" />';         $output .= '<meta property="og:site_name" content="'; $output .= get_bloginfo('name'); $output .='" />';              echo $output;}      `add_action('wp_head', '_set_meta_tag');` not display `$output`. Why? I've prooved also to echoes a simple "hello world", but nothing happened!


title: Suddenly unable to share WordPress link on Facebook

text: I was able to share links from my WordPress blog on Facebook with no issues up till about a month ago. Previously, the abstract and featured image turned up fine, but now only the link shows up. I've tried adding OG meta tags to my `functions.php` but it is not solving the problem. Using a plugin didn't help either. I ran the facebook object debugger and I got a response code: 200 Error: > Can't Download: Could not retrieve data from URL. Here is a sample link.


title: Create a wordpress admin user and only let them edit and post blog posts?

text: Is it possible to create a WordPress admin user and only let them edit and post blog posts?


title: Display Custom Post Type Taxonomy Child Categories and their Posts

text:
How can I do this for custom post type taxonomies?               <?php     //get all child categories for category 15, then for each child category display the posts     $parent_cat = 15;     $taxonomy = 'category';     $cat_children = get_term_children( $parent_cat, $taxonomy );          if ($cat_children) {     echo '
Category 15
';     foreach($cat_children as $category) {     $args=array(       'cat' => $category,       'post_type' => 'post',       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       echo 'List of Posts belonging to Category ' . $category;       while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php     the_title_attribute(); ?>"><?php the_title(); ?>
         <?php       endwhile;     }     }     }     wp_reset_query();  // Restore global post data stomped by the_post().     ?>


title: Changing the permalink structure with 'with_front' not redirecting old URL

text: I'm attempting to change the permalink structure of the default post type with the following code:               $args = array(         'rewrite'   =>  array(                 'with_front'    => true,                 'slug'          => 'the-lab'             )         );     register_post_type( 'posts', $args );      However,               http://www.example.com/hello-world/     http://www.example.com/the-lab/hello-world/      both work.


title: sharing video on facebook from wordpress

text: When a user tries to share a page with an embedded video on it only the title of the pages shows up on their facebook status and not the flash video player. This happens while sharing with the addthis button or if the url is posted directly to the facebook page. Any idea how I can make facebook pickup the embedded flash video?


title: Would it be dangerous to send all the wp_options to javascript file?

text: I've noticed that wordpress allows me to send the wordpress options to javascript via wp_localize_script:               wp_localize_script( $this->plugin_slug . '-plugin-script', 'wp_options', wp_load_alloptions() );      This way, my javascript can access different settings such as what day the week start on and what date format the user has chosen. Are there any risks, sending all the options as a variable to js, or is this okay? I've noticed that options such as "logged_in_key" and "logged_in_salt" becomes available in the front end too. My gut tells me that this is bad practice - securitywise ? But I wanted to hear from someone who knows more about security in wordpress. Thanks. Malthe


title: Redirects from Tumblr to new WP

text: I migrated a site from Tumblr to WordPress and was able to get all the content over (in pieces) using the FeedWordPress plugin. What I am now trying to do is get the old permalink structure to redirect dynamically. The plugin added a custom field with the old Tumblr permalink (syndication_permalink is the name of the field). Is there a function I can write using wp_redirect to check for this field, and if so redirect to the new permalink URL?


title: deny IPs from wp-login using .htaccess

text: i am trying to ban a spam bot IP from my wordpress, since the "limit login attempts" extension mails me multiple times every day, that the same IP is trying to login. so i added the following to the .htaccess file in the wordpress root:               order allow,deny     allow from all     deny from x.x.x.x      with x.x.x.x being the IP of the bot. still the bot is trying to login. so i tried my own IP and found out, that the htaccess order does only block the css of the login page. mywordpress.com/wp-login.php still shows the login form, though without any styling, but the bot can still try to gain access. so how can i really block the entire site including the backend from certain IPs?


title: How to redirect /%postname%-%post_id%/ to /%postname%/

text: I expected WordPress to handle this permalink change automatically but it is not doing so. I tried Redirection plugin but it requires Regex. Can anyone suggest what can be added to .htaccess file to handle the redirection without requiring any plugin? Even Regex for Redirection plugins would help. Thanks!


title: How do I create Widget within plugin that uses its own class?

text: I wrote WordPress plugin and want to include 2 extra Widgets with it...               if( !class_exists('plugin_name') ) {         class plugin_name {                 // plugin code         }     }          // include widgets code     require_once( 'include/custom_functions.php' );      ...and Widgets (according to WP codex) should be created like this within "custom_functions.php":               class My_Widget extends WP_Widget {         // widget code     }     function sfp_register_widgets() {         register_widget( 'My_Widget' );     }     add_action( 'widgets_init', 'sfp_register_widgets' );      I can't put "class SFP_Search extends WP_Widget" inside my plugin's class and if I place it outside, I get an error:               Class 'WP_Widget' not found in /Applications/XAMPP/...etc      Is there any other solution? Thanks!


title: How can I only show a widget prior to a specific date?

text: I can't find a solution for this anywhere, so help is highly appreciated! The problem is, that my Dropbox account is losing aboz 48 GB's, so I had to remove my podcast episodes from there... because there are too many posts to change now, I want to add a note in the left sidebar. This note should only be seen on posts prior to August 22nd. Where I will tell the people on how to download now, if they tried to download using the dropbox link. I tried widget changer, dynamic widgets and some other plugins, but none of those did the trick. Maybe you have an idea. I hope I made clear what I meant, if not please ask if something is unclear. again, any help would be highly appreciated. thank you


title: How To Limit Hierarchical Pages Depth (For Custom Post Types) To Children Only

text: Is there a way to **limit the creation of pages** (custom post type) to a **specific depth** - e.g. level 1 (where 0 = parent, 1 = child, 2 = grand- child, etc.)? For example, let's create a 'Summer' recipe page (custom post type: Recipe) with a slug '/summer'. Let's now create a 'Pie' page (a child of 'Summer') with a slug '/summer/pie'. I want to prevent the user from creating a page which is a child of 'Pie' or of any other sub-page.   * example.com/summer -> GOOD   * example.com/summer/pie -> GOOD   * example.com/summer/pie/apple -> BAD   * example.com/summer/pie/blackberry -> BAD Thanks.


title: How can I check email exists via a jquery keyup()?

text: I have setup a jQuery keyup delay function to check the email typed into an input field. It works fine after testing with an `alert('Key pressed!');` But I want it to say, for example, 'Yes this email is associated with a user' OR 'Sorry, this email is not in our database' without submitting any page requests.                   var delay = (function(){             var timer = 0;             return function(callback, ms){                 clearTimeout (timer);                 timer = setTimeout(callback, ms);             };         })();         $('input').keyup(function() {             delay(function(){                 // check email exists and output result                 // Can I use PHP here?                  // Can ajax/json help?             }, 500 );         });           I tried to check with php but this is rendered before the jQuery of course which is where I'm storing my email var. After a few google searches it sounds like this may not be possible. Can anyone confirm or offer a solution? Thanks


title: Force unique page slugs across all post types

text: I have a site with many custom post types and I need a unique slug for each page. What I'm seeing is that wordpress only checks for slug conflicts within a post type before appending "-2", "-3". So I can have "actor/foo", "book/foo", "book/foo-2". I don't want that. I want each foo to have its own slug no matter the post type. I want to avoid using a rewrite on the slug and I'd prefer not to edit any WP source outside of plugins/themes. Is this possible?


title: Force hide custom field metaboxes

text: How can I completely remove the custom fields and the collapse button in the Edit Post/Edit Page custom screen, but without removing the capability to add custom fields with a PHP function?


title: Media Library not showing images but still acknowledges existence

text: I have no idea why this is happening. I've read A LOT about it and there don't seem to be any solutions. I once read that it was expected behaviour because of some plug-ins and that the Hotfix plugin would fix it but that wasn't the case. ![media library](http://i.stack.imgur.com/tblrU.png) However, if I go to the actual media gallery through the sidebar, I can see all my images. I've tried searching and filtering the page in the image but still no images show. **Any one familiar with this problem and know of a fix?**


title: is_user_logged_in() not working in Firefox

text:
In Firefox (IE, Chrome, and Safari are fine), we are having a problem with is_user_logged_in(). What happens is: a member logs in and is then automatically redirected back to the portal page. This page does not recognize they are logged in (we use is_user_logged_in()) until they refresh the page. Then all is fine after that. Any ideas? Here is a small piece of the code which changes the log in/out button based on is_user_logged_in(). Upon log in and redirect, is_user_logged_in() is false until the page is refreshed in browser (Firefox only):
          <?php if( is_user_logged_in() ) : ?>          <a class="button full-width" href="<?php echo wp_logout_url( home_url() ); ?>" target="_self">         Quitter               <?php else: ?>          <a class="button full-width" href="<?php echo wp_login_url( get_permalink() ); ?>" target="_self">         Ouvrir mon portail               <?php endif; ?>
      Sorry I'm unable to share the site as it's a private members portal.


title: How to pass url as a parameter in a add_rewrite_rule

text: I am building a plugin which relies on passing the url as a GET parameter. Now, I am trying to prettify the links by using rewrite rules but am stuck. What I have now:               function oe_wpib_add_rewrite_rules() {              add_rewrite_tag( '%wpib%','^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$' );         add_rewrite_rule( '^wpib/([^&]*)', 'index.php?wpib=$matches[1]', 'top' );          }          add_action( 'init', 'oe_wpib_add_rewrite_rules' );      What above does is recognizes               http://domain.com/wpib/somestring       and translates it to a               http://domain.com/?wpib=somestring      The problem is that when I pass the url like this:               http://domain.com/wpib/http://google.com      I get this as the query value:               http://domain.com/wpib/http:/google.com      So basically, one slash is missing. Can you help me out here, as I am lost, first time doing rewrites so would appreciate any guidance.


title: Dynamic number of fields in a meta box

text:
I am working with a recipes blog and I use custom meta boxes.               $food_box = array(         'id' => 'foodbox',         'title' => __('Ingredients details','splus'),         'page' => 'recipes',         'context' => 'normal',         'priority' => 'high',         'fields' => array(),);     $arr = array ( 'name' => '-', 'desc' => '-', 'id' => '-','type' => 'text', 'std' => '');     add_action('admin_menu', 'mytheme_add_box');  // Add meta box          function mytheme_add_box() {         global $meta_box;         global $food_box;         global $test_box;         add_meta_box(             $meta_box['id'],              $meta_box['title'],              'recipe_details_show_box',              $meta_box['page'],              $meta_box['context'],              $meta_box['priority']         );         add_meta_box(             $food_box['id'],              $food_box['title'],              'ingredients_show_box',              $food_box['page'],              $food_box['context'],              $food_box['priority']         );     }      Acoording to recipe ingredients are devided to sets of food and the same food item can be present 2 time in one recipe (for example, 200gr sugar for dough and 50 gr for stuff). To combine two taxonomies (food items and food sets) I created custom table and I add fileds `$food_box['fields'][] = $arr;` from this table by next code:               foreach ( $terms as $term ) { // show tabs content for foodset         $s = ($i==1) ? ' ': ' style="display: none;"';         echo '
term_id .'" class="tabs-panel"' . $s . '>';             echo '
';                 echo '
';                 echo '
';   //show header                     echo '  FoodSet        	';                     echo '  FoodId     	';                     echo '  Description    	';                     echo '  FoodUnit       	';                     echo '  Quantity       	';                     echo '  Order      	';                     echo '  Comment        	';                 echo '
';                 foreach ( $foods as $food ) {       //show data                     $food_row = $wpdb->get_row($wpdb->prepare(                         "SELECT rf.post_id, rf.foodset_id, rf.food_id, tt1.description, rf.food_unit, rf.quantity, rf.food_order, rf.food_comment                            FROM $wpdb->term_taxonomy tt1 JOIN $wpdb->recipefood rf ON rf.food_id = tt1.term_id                           WHERE (rf.post_id=".$post_id.") AND (rf.foodset_id=".$term->term_id.") AND (rf.food_id=".$food->term_id.")"));                     $food_set = $term->term_id;                     $food_id = $food->term_id;                     $id = $food_set . '-' . $food_id;                     $food_name = $food_row->description;              echo '
';         echo '',$food_set,'	';         echo '',$food_id,'	';         echo '',$food_name,'	';         $fls = array ('food_unit','quantity','food_order','food_comment');         foreach ($fls as $fl) {             switch ($fl) {             case 'food_unit':             $def_val = $def_unit; break;             case 'quantity':             $def_val = $def_qty; break;             case 'food_order':             $def_val = '1'; break;             case 'food_comment':             $def_val = 'comment'; break;         }         $meta = ($food_row->$fl == '') ? $def_val : $food_row->$fl;         $arr = array ( 'name' => $fl.'-'. $id, 'desc' => $fl.'-'. $id, 'id' => $fl.'-'. $id,'type' => 'text', 'std' => $meta);         $food_box['fields'][] = $arr; //add new field to array         echo '','<input type="text" name="'.$fl.'-'.$id. '" id="'.$fl.'-'.$id.'" value="',$meta , '" style="width: 50%"/>', '	';         // $meta ? $meta : $food_box[$fl.'-'.$id]['std']     }     echo '
';      But unfortunately I can not save my updated data as `$_POST['quantity-708-481']` is empty and not defined in               add_action('save_post', 'mytheme_save_data');   // Save recipe post from meta box     function mytheme_save_data($post_id) {             global $meta_box, $food_box;             //...             $wpdb->update( $wpdb->recipefood,             array( //set                 'food_comment' =>  $_POST['quantity-708-481']             ), array( //where                 'post_id' => '1',                 'foodset_id' => '822',                 'food_id' => '484'             )          );      In other words, the field is added in meta box but not visible during saving. Any suggestion are more than welcomed.


title: Trying to display short code content in template file with do_shortcode()

text: I installed the WP Issuu plugin on a site and tried to use `do_shortcode()` to render the shortcode in the template file. Strangely it doesn't work, although it does for the `[gallery]` shortcode. I.e. this works:               echo do_shortcode('[gallery link=file]');      But this doesn't work:               echo do_shortcode('[issuu width=420 height=272 documentId=120118010023-8b7bf623bdd642d98252f310d62f1625]');      After some research, I found that this would work too:               echo apply_filters('the_content', '[issuu width=420 height=272 documentId=120118010023-8b7bf623bdd642d98252f310d62f1625]');      Any idea what's going on and how I can solve this? Thanks


title: Load comments.php template outside the post loop

text: I'm loading a post via ajax and outputting using `$post = get_post( $post_ID );` Is there a way to load the comments.php template after I've output my post? I tried using:               global $withcomments;     $withcomments = true;     comments_template();       But it's not within the loop so it's not loading the template. I'm trying to get my comment form and any current comments to display, just having some difficulties. Any help would be much appreciated!


title: WPML & CFT: keeping custom field file to translation

text: i got a wp site with the WPML plugin and the CFT plugin. I set up custom fields for posts and what i'm trying to do is to keep the content of an `input type file` from the original post to its translation. That would save time as the pictures are the same between both posts and also save disk space on the ftp. So far i couldnt get it working, not even to get basic `input type text` automatically pasted from the 1st post to its translation. I tried the different options in WPML > Translation management > Mutlilingual content setup > Custom fields translation without any result. PS: am using WP 3.1.3, WPML 2.0.4.1 and CFT 1.9.2.


title: Change code to display image attachment page

text:
I have this code which displays images with their captions in a list. On clicking caption, opens image in an attachment page, but clicking on image, opens that image with a dark-gray background. Is there a way to display image on attachment page on clicking on it?? I played alot with it, but no success.               $i = 0;         $rand_id = mt_rand(1,1000);         foreach ( $attachments as $id => $attachment ) {             $image_attributes = wp_get_attachment_image_src( $id,'large' );                       $link = isset($attr['link']) && 'file' == $attr['link'] ? ''.wp_get_attachment_image($id, $size, false).'' : ''.wp_get_attachment_image($id, $size, false).'';             $output .= "<{$itemtag} class='gallery-item'>";             $output .= "                 <{$icontag} class='gallery-icon'>                     $link                 </{$icontag}>";                   if ( $captiontag && trim($attachment->post_title) ) {  //caption display                 $output .= "                     <{$captiontag} class='gallery-caption'>                     " .wp_get_attachment_link($id, $size, true, false, wptexturize($attachment->post_title))  . "                     </{$captiontag}>";                }                  $output .= "</{$itemtag}>";             if ( $columns > 0 && ++$i % $columns == 0 )                 $output .= '
';         }


title: Transferring author information from a custom field to a proper author

text: A WordPress site I'm doing a redesign for has around 1.400 posts by approximately 30 different authors. Unfortunately the authors of the posts have so far been entered as a custom field within the post, and not as separate authors in WP. I'd like to transfer this to the 'proper way', where each post has an author attached to it, since this would make it possible to display more posts by each author without resorting to plugins like Search Everything. Does anybody know of a script that could look through all the posts, search for the custom field containing and author and create that author, and then link the post to that author? (I know, long shot...) Is that even possible or is there an another way apart from going through 1.400 posts and changing them by hand?


title: How do I get allowed Media Library upload file extension list?

text: WordPress has list of allowed Media Library upload extensions in wp- includes/functions.php but is there any way to return them to theme's files as an array?


title: Woocommerce Product Category Widget - hide categories that have no products in stock

text: I'm using WooCommerce on my Wordpress site, and have a widget in the sidebar showing all product categories. It's setup to hide empty categories, and that works well. However, it still shows categories that contain only products that are out of stock - that I would like to change. Technical explanation: WooCommerce products are a custom post type (`product`), the product categories are a custom taxonomy (`product_cat`), and the stock count is a custom field on the products (`_stock`). The WooCommerce Product Categories widget shows them using `wp_list_categories()`. I have tried digging into a code to look for some filter call that I could hook onto, but failed to find one. Is there a good way of doing this without modifying core or WooCommerce code? Maybe a hook/filter somewhere that I missed that would allow to check the custom field value?


title: Displaying Archives List

text: I'm displaying list or archives using               <?php get_archives('monthly', '', 'html', '', '', FALSE); ?>      and my list displays December 2012 November 2012 etc However I would like to format this to display: 12.12 11.12 10.12 etc Any ideas?


title: Displaying the custom taxonomies side by side on the admin dashboard

text: I got 5 top level cats and for each of these top level cats, I have directly corresponding 5 non-hierarchal custom taxonomies. By default, WordpPress UI display these CT's one after the other. Right below the cats... By using a plug in, I can define the order... As far as admin UI options, WP gives me the ability to change the UI from 1 col to 2 col view which helps but not totally. In 2 col view, I can easily see that I got plenty of room to fit in at least 3 or 4 CT's floating next to each other. When I turned the 2-col view however, current UI allows me to drag only one tag box into what's below the post content editor. So, with 2 col view, I don't get to do what I wanted to. There simply is no point to drag a tag box below the post editor cause it is unnecessarily too long. Is it possible to make the tag boxes to float right next to one another? So, The more room there is, the more the CT's show side by side.               post content___________________________________________________cats box here          CT 1__________CT 2__________CT 3__________CT 4__________                       CT 5__________


title: Woocommerce with metabox plugin

text: I'm using woocommerce as my e-commerce solution and the metabox plugin ( http://www.deluxeblogtips.com/meta-box/ ) to make my life a lot easier when implementing meta boxes. I've never had any issues with it but I now need to add my own custom meta box to the woocommerce product post type....but it never gets added? If I add the meta box in the old fashioned add_meta_box way and the meta box gets added correctly....so I was just wondering if you would have any ideas why using the plugin would cause an issue? Here is the code I'm using to add the meta box to the global meta_boxes array:               global $meta_boxes;          $prefix = "esfproduct_";          // Aggregator metaboxes          $meta_boxes[] = array(     'id'    => 'additionalproductdetails',     'title' => 'Additional Details',     'pages' => array( 'product' ),     'context' => 'normal',     'priority' => 'side',     'fields' => array(         array(             'name' => 'Product Features',             'id'   => "{$prefix}productfeatures",             'type' => 'text'         ),     )     );      Thanks for any help you can provide!


title: Show only posts with images and a fixed amount of posts

text: I found this code online. Its a code that only shows posts with images inside. Now, the problem is that if you set Wordpress to show 50 posts, this code shows the posts with the images, but also counts the ones without. With other words.. if you got 50 posts on your frontpage where 6 are with images this code shows only 6 posts. Does anyone know how I can make it show 50 posts (the same as set in WordPress) with images?               <?php      while ( have_posts() ) : the_post();         $content = $post->post_content;         $searchimages = '~<img [^>]* />~';         preg_match_all( $searchimages, $content, $pics );         $iNumberOfPics = count($pics[0]);         if ( $iNumberOfPics > 0 ) {             //your loop content goes here         }      endwhile;      ?>


title: Convert imploded plain text into links

text: I'm completely open on how to do this: I have the line:               echo implode(', ',get_field('categories'));      Which is outputting this:               Branding, Web, Print      I have 20 or so options it can output depending on what checkboxes were ticked. At the moment, what it's outputting is just plain text. How can I make each tag a link? The link would need to be unique per tag so:               Branding, Web, print       UPDATE: The first part of the question is working thanks to Brady. I now have an additional question - Using Brady's answer on the line:               $elements[] = '' . $category .'';      If you look at the href it has the link /tags/design/, some of the tags it's outputting are using the correct link but some are from another section and the link should be /tags/marketing/. How can I account for this? (Not that I know how to do this, someone will need to show me!) Could I create an array with the tags "Branding, Web, Print" and if the $category variable matches this then give it the variable $design. Could I then create another array with "Advertising, Analysis, Campaign" and give it the variable $marketing if the $category matches that. Then in the link I could put href="/tags/$design/$category" or href="/tags/$marketing/$category"? So a couple of examples would be (I'll put them as normal links): From the design section:               Branding     Web     Print      From the marketing section:               Advertising     Analysis     Campaign      There are only two sections design and marketing, within those sections there are several tags, if that makes sense. The sections in WP are setup like this: tags > design > (each tag - branding, web, print is it's own page). tags > marketing > (each tag - advertising, analysis, campaign is it's own page).


title: Match checkbox data with page title to show certain items

text: I want to show the projects that has had it's checkbox ticked as Branding, if it's on the Branding page (i.e the page title is Branding). To explain the code a bit: This line show's all the checkboxes that have been ticked for each project so it will output "Branding", "Web", "Print" if they have been ticked.               implode(', ',get_field('categories')      This next line is just checking the page title is "Branding":               implode(', ',get_field('categories')      I'm trying to put these both in an if statement where it would just output the checked boxes and if they match the title then output them.               <?php if(implode(', ',get_field('categories')) && $grid_title == "Branding"); {     echo "testing";      }     ?>      The code above shows what I want to do but it doesn't quite work. **IMPORTANT: I'm usingthis plugin to create the custom checkboxes so please bear that in mind.**


title: Custom query with DECIMAL(5,2)

text: I want to know if there is a way to DECIMAL (5,2) instead of DECIMAL in meta_query


title: How To Protect Plugin Display From Being Affected By Theme's CSS

text: I am developing a custom wp plugin that is using shortcode to display table in the front end. But its front end display is affected by the theme's css. So it is always following the table styling that comes with the theme. Is it possible to protect it from being affected by any theme's css' without doing any extra work digging into the theme which the plugin is installed together with?


title: Using /%postname% for a custom post type

text: I have a custom post type whose permalink needs to sit in the same space as pages, like so:               /an-example-thing  <--  custom post type 'thing'     /about-the-things  <--  a normal page      I'm well aware that this isn't the recommended way to do it, but I don't really have a choice - that's what the client has specified. I've created the custom types with register_post_type, and used the Custom Post Permalinks plugin to set their permalink like so:               /%thing%/      However, this creates a conflict between the rule that recognises my custom posts, and the one for normal pages - which turns all normal pages into 404s. This problem disappears when the permalink is changed to something like this:               /things/%thing%/      Using the Monkeyman Rewrite Analyser shows that the rule for the custom post is coming first. Even when I try forcing it to use verbose rules:               global $wp_rewrite;     $wp_rewrite->use_verbose_page_rules = true;      the custom post type rule is higher priority than the verbose rules for pages so they still get a 404. I'd like it to look for _things_ first, and when none is found with that name look for pages. The other way round would be acceptable. Is there no way of persuading it to look for both _things_ and pages before hitting a 404?


title: How to add a Capability to a User Role?

text: I am managing a Wordpress network and would like to add the unfiltered_html user capability to the already predefined user role of Admin. In a standard installation of Wordpress the Admin account would already have this capability but in an MU installation only Super Admins are afforded this capability. Wordpress Roles and Capabilities. How can I augment the Admin role from within a theme or plugin?


title: What exactly does "Posts page" do in WordPress?

text: Hay, I'm making a WordPress template, and i have 4 main pages.               HOME     BLOG     CONTACT     ABOUT US      As you can see "Blog" is a page (i need it to display when i call wp_list_pages()), but how do i edit this blog page? I assigned the "Blog" page a custom temeplate (called blog.php), but when "Blog" is set as the "Post page" in the Reading section of the WordPress admin, the page fails to render the template. How do i edit this "Blog" page?


title: Possible to change the URL for the regular post type without affecting the URL of other custom post types?

text: _**The Dilemma_** I have a few custom post types:   * Portfolio Items   * Testimonials   * FAQs The URL structures for these custom post types are:   * mysite.com/ **portfolio** /name-of-custom-post   * mysite.com/ **testimonial** /name-of-custom-post   * mysite.com/ **faq** /name-of-custom-post I'd like to use the normal, built-in WordPress post type to control our blog entries, and have the URL for each blog entry be like this:   * mysite.com/ **blog** /name-of-post If I go to Settings > Permalinks and adjust the URL structure to be like...               /blog/%postname%/      ...then the URLs for _all_ of my post types are affected, which results in:   * mysite.com/ **blog/portfolio** /name-of-custom-post   * mysite.com/ **blog/testimonial** /name-of-custom-post   * etc... _**The Question_** What I'd like to know -- is it possible to adjust the URL structure for the built-in WordPress post type without affecting the URL structure of other custom post types? The only other way I see to solve my dilemma is to create another custom post type called "Blog." This seems wasteful, because then I won't be using the built-in WordPress post type at all. _**If anyone needs it, The Why_** If anyone wonders why I need "blog" in the URL so badly, it's because we're merging our blog into the same install as our site, and want to keep the URLs intact so we don't lose valuable Google juice. Any help is greatly appreciated -- thanks!


title: Site Registration & MailChimp Coordination?

text: I have a client who would like to post research documents on his site for download with the following functionality:   1. Users could browse entire site, but in order to download, users would need to register and login.    2. Would like all registration info to be automatically passed to MailChimp (name, email, other optional info) for inclusion into mailing list.    3. User would be able to opt out of mailings, but keep site registration active Are there any existing plugins (or combo of plugins) that do this?


title: Passing feed URLs with "&" to fetch_feed()?

text: How do I pass feed URLs with `&` in the URL to `fetch_feed()`? The feed is not parsed correctly if there is a `&` in the feed URL. Actually it works in the example I gave, but now I'm populating the feeds array dynamically with this code :               $rss_subscriptions = array();     $terms = get_terms('news_rss','hide_empty=0');     $count = count($terms);     if($count > 0){         foreach ($terms as $term) {             array_push($rss_subscriptions,$term->description);         }     }      The RSS feeds URLs are stored in the descriptions of the taxonomy `news_rss` terms. Somehow in this code, passing `&` into the array makes the `fetch_feed($array)` not work. * * * ### Original question: fetch_feed() on multiple feeds, how to pass the feeds array properly ? Hi, this is too weird, perhaps someone can explain what is going on here. Why does this :               $feeds = array('http://www.mysite.com/feed','http://www.coolsite.net/feed');     $result = fetch_feed($feeds);      return a different result than this :               $result = fetch_feed(array('http://www.mysite.com/feed','http://www.coolsite.net/feed'));      Actually, the second example works, the first one returns feed items, but for some reason they are not the last ones... I want to find a way to populate the feeds array dynamically, that's why I'd like something like the first example better.


title: Troubleshooting fetch_feed and SimplePie

text:
I've got a very basic solution using `fetch_feed()` and SimplePie to pull in RSS items which is working on my localhost, but for some reason `is_wp_error()` persists as `true` on the live server. Is there anyway for me to get specific output about the nature of the error so as to work towards a solution on the live server?               <?php       include_once(ABSPATH . WPINC . '/feed.php');       $rss = fetch_feed( '[rss feed removed from example]' );       if (!is_wp_error( $rss ) ) :         $maxitems = $rss->get_item_quantity(5);         $rss_items = $rss->get_items(0, $maxitems);         $isc = 'http://dtd.interspire.com/rss/isc-1.0.dtd';       endif;     ?>
       <?php if ( $maxitems == 0) : ?>
No items.
       <?php else : ?>         <?php foreach ( $rss_items as $item ) :            $image = $item->get_item_tags( $isc, 'thumb'); ?>
...
         <?php endforeach; ?>       <?php endif; ?>


title: Allow anonymous users to post to my site for moderation

text: I'm in need of the ability to allow anyone (they don't have to login) to fill out a form with email and a textarea and submit it to my site. This form would be treated as a post and appear somewhere for me to moderate. If i hit publish, it would be published to my site like any other post i wrote. Is there a plugin that allows me to do this or do i need to code it myself, if the latter, how would i go about doing that? Thanks in advance!


title: Relative instead of absolute links in pages?

text: I have my blog under `blog.mydomain.com`. I am using pages for some static content that needs to be accessed from another subdomain. So `careers.mydomain.com` will show WordPress content from `blog.mydomain.com/careers`. My problem is that all the links on the page still reference `blog.mydomain.com`. Is there a way to ask WordPress to use relative links? Or a way to change the baseURL for pages?


title: How can i force wp-admin to use 2-column dashboard layout?

text: How can i force wp-admin to use 2 column layout via plugin?


title: Hide widget on page

text:
How can I hide a widget from a certain page (one page). After spending an hour, all I can find is with the plugins. The problem is, that I know with them how to do it, but one widget (ad widget) is placed inside my theme panel not like a drag/drop widget, so I cant set it up with widget. This is my code of widget which i need to hide on one page. Any solution how to do it ?               <?php if(get_option('gd_leader_ad')) { ?>
                          <?php if(get_option('gd_logo_loc') == 'Small in navigation') { ?>
                             <?php echo get_option('gd_leader_ad'); ?>
                          <?php } else if(get_option('gd_logo_loc') == 'Large below navigation') {  ?>
                             <?php echo get_option('gd_leader_ad'); ?>

                             <?php if(get_option('gd_logo_large')) { ?>                             <a href="<?php echo home_url(); ?>"><img src="<?php echo get_option('gd_logo_large'); ?>" alt="<?php bloginfo( 'name' ); ?>" />                             <?php } else { ?>                             <a href="<?php echo home_url(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/logo-large.png" alt="<?php bloginfo( 'name' ); ?>" />                             <?php }
?>                     <?php } ?>


title: Posts and Pages not showing on admin, but showing in theme

text: I've just transferred a WordPress install over from and old IIS server set up by our client, to our new Lunix based VPS. Whether that is relevant or not, i'm not sure. I've changed all the usual settings and database options i'd usual do on moving a website to a new/live server environment.. This has worked perfectly other than the data doesn't show in the WordPress admin specifically, but does if you visit www.lenstec.co.uk. That suggest the data is being successfully pulled in as it normally would. My initial thoughts are that this may be a global variable somewhere within the theme that WordPress does not like? Unfortunately, i've check through my function file and corresponding theme files and not come across anything. Can anyone suggest something I may have missed?


title: Notification that the admin is online

text: How can I say to all visitors that the admin is online. I mean if the admin is online all the visitors, registered and none registered, will see this words "hello the admin is online...talk with me"... ? Thank you


title: Custom taxonomy in WP_Query not working

text: I'm truly stumped here. I have a specific taxonomy for sorting posts into different types of "featured" posts on a news site. Here's the problem: When querying by them the results aren't what they should be. Here's what I have:               $featured_loop = new WP_Query( array( 'featured' => 'home-featured', 'posts_per_page' => '1') );     if ( have_posts() ):             while ( $featured_loop->have_posts() ) : $featured_loop->the_post();                 the_post();       There is then another underneath, with different formatting:               $featured_loop_2 = new WP_Query( array( 'featured' => 'home-featured', 'posts_per_page' => '3', 'offset' => '1') );     if ( have_posts() ):             while ( $featured_loop->have_posts() ) : $featured_loop->the_post();                 the_post();      The problem is, it is outputting posts that aren't in the taxonomy... although which ones it outputs changes as I tweak it, which I find even more strange. I tried a tax_query, and that didn't seem to solve it either. Any ideas? I used "Ultimate Taxonomy Manager" to create the taxonomy.


title: When I try and use contact form 7 it breaks my page

text: I am using the following code to add a contact form to my template, but this code as is breaks the page. It just shows a white page when I add this code. Am I doing it wrong.               <?php     [contact-form-7 id="181" title="Contact form 1"]     ?>


title: Enable post excerpts in wordpress theme twentythirteen

text: How do I enable excerpts in the theme?Currently excerpts are only displayed on the search page but I would like to enable them on tag and category pages.


title: How to second orderby in "pre_get_posts" by meta value or combine single date and time to timestamp

text: This is somewhat of a continued problem from another question that I had asked. Here is the original post. pre_get_post filter returns results when there should not be Since then I added an orderby clause....                 if ($post_ids) {                     $wp_query->set('post__in', $post_ids);                     $wp_query->set('meta_key', '_start_date');                     $wp_query->set('orderby','meta_value');                     $wp_query->set('order', 'ASC');                 }else{                     $wp_query->set('post__in', array(0));                      }                 return $wp_query;      Problem is that I need to order by another meta_key's value. The meta_key is`'_start_time'`. The $post_ids are compiled from another (complex)query and then I needed to compile that even more based on other factors. What I ended up with was the post ids that I needed and now I just need to display them in the order that I need. I have the order by `_start_date` working, but if there are more than one post on that date then they are not ordering by the right time that I need. So I also need to order based off the `'_start_time'` meta_key value, but can't seem to find a solution for this. Thanks for any help you can provide.


title: how do I know the term used for accessing my taxonomy page?

text: In a custom taxonomy, using the taxonomy.php, how can I work out for the terms associated within that taxonomy? E.g. A taxonomy of three elements, I need to list all of them. Thanks Andrea


title: Thumbnails for custom post not showing up in query

text:
My thumbnails are not showing up in my custom post type when I do a query, however they show in the `single.php` file. I have added `'supports' => array('title','editor','author','thumbnail','excerpt','comments')` to the function so I know its not that issue. I am gettin the rest of the data on the query as viewable below but the image should be above the text: ![enter image description here](http://i.stack.imgur.com/7VjAi.png) I am not having this issue in the single page with the featured image showing up : ![enter image description here](http://i.stack.imgur.com/oH5te.png) I am registering my custom post type as so:               add_action('init', 'video_custom_init');              /* SECTION - video_custom_init */     function video_custom_init()     {         // the remainder code goes here     }     /* #end SECTION - video_custom_init --*/          // The following is all the names, in our tutorial, we use "video"         $labels = array(             'name' => _x('videos', 'post type general name'),             'singular_name' => _x('video', 'post type singular name'),             'add_new' => _x('Add New', 'video'),             'add_new_item' => __('Add New video'),             'edit_item' => __('Edit video'),             'new_item' => __('New video'),             'view_item' => __('View video'),             'search_items' => __('Search videos'),             'not_found' =>  __('No videos found'),             'not_found_in_trash' => __('No videos found in Trash'),             'parent_item_colon' => '',             'menu_name' => 'video'         );              // Some arguments and in the last line 'supports', we say to WordPress what features are supported on the video post type         $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','author','thumbnail','excerpt','comments')         );              // We call this function to register the custom post type         register_post_type('video',$args);      I am pretty confused about what the issue would be. It is probably something really simple. Query used to display custom post.               <?php if ( have_posts() ) : ?>          <?php $args = array( 'post_type' => 'video', 'posts_per_page' => 3 );                 $loop = new WP_Query( $args );                     while ( $loop->have_posts() ) : $loop->the_post();                               get_template_part( '/templates/content-3col');                              endwhile;?>                      <?php endif; ?>      and the code in col3.php
     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                      <?php if ( 'post' == get_post_type() ) : ?>
             <a href="<?php the_permalink(); ?>" rel="bookmark">         <?php   if ( has_post_thumbnail() ) {                 the_post_thumbnail('col-6-thumb');                          } ?>
             <?php endif; ?>

<?php the_time('M jS') ?>

<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>

by <?php the_author() ?>


title: Enqueue never runs

text: My enqueue scripts are never called I can't figure out why. All my paths are correct and I'm assuming the code is correct **Functions.php**               function tim_enqueue_default_scripts() {         if (ENVIRONMENT == 'dev') {             $globaljs = 'global.js';             $globalcss = 'global.css';         }         else {             $globaljs = 'global-0.3.min.js';             $globalcss = 'global-0.5.min.css';         }         wp_enqueue_script('globaljs', get_bloginfo('template_directory') . '/res/js/' . $globaljs . '', false, false, true);         wp_enqueue_style('globalcss', get_bloginfo('template_directory') . '/res/css/' . $globalcss . '', false, false, true);     }     add_action('wp_enqueue_scripts', 'tim_enqueue_default_scripts');      **Header.php**               <?php wp_head(); ?>     </head>      **Footer.php**               <?php wp_footer();  ?>     </body>


title: Single parent post lists child posts with pagination

text: I would like to build on this answer so I can incorporate pagination and a couple of other features. We have over 1,600 entries in our Glossary so certain letters have far more than 20 (my max posts/page) entries. If a user clicks "A" or accesses "/dev/glossary/a" I'd like them to see a list of all entries with parent "A". I'd also like:   * The list to be in alphabetical order   * The number of entries for this parent to be displayed at the top of the page   * The list to be paginated I've had a basic attempt at this using `$paged = (get_query_var('page')) ? get_query_var('page') : 1;` and the `paged` argument in the `WP_Query`, but my `next_posts_link` doesn't even display. I'm not quite sure where to begin with this so any guidance would be much appreciated.


title: What's the purpose of $wp_did_header?

text: It is referenced in load_template but Wp does nothing with it ?!!! so what's the use ?               1105  function load_template( $_template_file, $require_once = true ) {     1106      global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;     1107       1108      if ( is_array( $wp_query->query_vars ) )     1109          extract( $wp_query->query_vars, EXTR_SKIP );     1110       1111      if ( $require_once )     1112          require_once( $_template_file );     1113      else     1114          require( $_template_file );     1115  }


title: Value prints outside of the echo

text:
My code validates and returns the custom field value. However, I can't get the value to return inside of the anchors. Here is the code:
     <?     if(function_exists('get_custom_field_data')) {     echo '';     }      ?>
      This is what is returned:
     http://yada.yadayada.yada:5000/pop.jsp?id=1711436