title: Advanced Multi Tier Navigation across columns

text: I've been struggling with this for a while now and need some help. I'm trying to create a quite specific navigation setup for a client. I have a top level navigation which is hard coded and not a problem. The second level of navigation should populate the left sidebar of the site, it should also show a third level of nestled/folding navigation within it. The fourth level of navigation is then shown separately in a column next to the left sidebar. The illustration below or this image example should help explain:               ------------------------------------------------------------------------     | topNav | topNav | topNav | topNav | topNav | topNav | topNav | topNav |     ------------------------------------------------------------------------     | childNav01  v | greatgrandchild > | Content Goes Here                 |     |---------------|-------------------|                                   |     | grandchild    | greatgrandchild   |                                   |     |---------------|-------------------|                                   |     | grandchild    | greatgrandchild   |                                   |     |---------------|-------------------|                                   |     | grandchild  > | greatgrandchild   |                                   |      |---------------|-------------------|                                   |     |               |                   |                                   |     | childNav02    |                   |                                   |     |---------------|                   |                                   |     | childNav03    |                   |                                   |     |---------------|                   |                                   |     | childNav04    |                   |                                   |     |---------------|                   |                                   |     |_______________|___________________|___________________________________|                  The issues I'm having is no solution I've come across can do all of these things. In an ideal world I'd love to have one dynamic template rather than having lots but any help would be great.


title: How do I set user account inactive?

text: One solution is to remove all roles. But the user will still be able to log in. Should we at the same time delete password? **Scenario:** * * * > Users "delete" their account and account is set to innactive in our system. > 2 months later, the user want's to sign up again. > > Since e-mail is already registered, he gets a message that the email exists. > > What do we do now? > > Well, if user request a new passord, he will get one. But he still doesn't > have any user roles. Doe anyone have any suggestions on how this may be solved?


title: query usermeta from custom field

text: I am using a plugin to create custom fields in the user registration. I have created a check box field called g300 which is the name of the meta_key stored in wp_usermeta. It looks like the value in the database is a comma when the checked it off. How could I return a list of users that checked off this box?


title: Custom search page and search by title, content and tag

text:
Can someone review my code , I need to know better solutions or any bug. Okey ! , I made a PHP file to get search results by parameters and search by title , content and tag **PHP's head look like:**               include('../../../../wp-config.php');     header('Content-type:text/html;charset=utf-8');     $keyword = $_GET['k'];      That I will bring search results by jQuery after. My main search function to show result from database:               function search($keyword,$mark){         while($data=mysql_fetch_array($keyword)){             if($data['post_status']=='publish'){                 echo '
#'.$data['ID'].' '.htmlentities($data['post_title']).' ('.$mark.')
';             }         }     }       **Search by title function :** Full keyword (ex : "jack daniels")               $sql_full_keyword       = "SELECT * from wp_posts WHERE post_title LIKE '$keyword%'";     $search_full_keyword    = mysql_query($sql_full_keyword) or die(mysql_error());     search($search_full_keyword,"Full keyword(s) = '$keyword'");      So i split keyword for next steps like :               $keywords_split         = explode(" ",$keyword);      **Search by title function :** multi keywords (ex : jack + daniels)               for($i=0;$i<count($keywords_split);$i++){         $sql_split_keyword      = "SELECT * from wp_posts WHERE post_title LIKE '$keywords_split[$i]%'";         $search_split_keyword   = mysql_query($sql_split_keyword) or die(mysql_error());         search($search_split_keyword,"Split keyword = '$keywords_split[$i]'");     }      **Search by content function :** (same above, but search by content)               for($i=0;$i<count($keywords_split);$i++){         $sql_split_keyword      = "SELECT * from wp_posts WHERE post_content LIKE '$keywords_split[$i]%'";         $search_split_keyword   = mysql_query($sql_split_keyword) or die(mysql_error());         search($search_split_keyword,"Split keyword = '$keywords_split[$i]' (Content)");     }      Than close mysql               mysql_close();      **Search by tag function :** (using normal wordpress query)                   $tags = str_replace(" ","-",$keyword).",".str_replace(" ",",",$keyword);         query_posts(array('post_type'=>array('one','two','three') ,'tag' => $tags,'posts_per_page'=>-1));              while (have_posts()):the_post();         echo '
#'.get_the_ID().' '.get_the_title().'
';         endwhile;      Everything work now and I need someone to review my code, tell me better things or tong ... Full code here : http://snipt.org/zpz0 Thanks


title: Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms

text: I am importing a large DB from an Excel spreadsheet into a wordpress DB. I was going to do it manually by creating a new table but decided to import it into the existing wordpress framework as it will allow me to change information manually in the wordpress back end. I was importing all 2000 rows into the wp_posts table when I realised this table doesnt have a term column. The terms are stored in other tables. My question is... how can I import the spreadsheet into the database and keep all of the important data, especially the terms, as my site queries all information by the "term" and uses jQuery tabs to display the different terms as sub-categories. My information looks like this:               post-title(title)---category(term)---description(content)---imageUrl---price      Note: I will create a seperate column in the wp_posts table to handle the price, or any other information I need bringing in, Im just unsure about how I can get the term information into the corresponding tables... Thanks :)


title: Static files or dynamic WP pages for "static content"?

text: Ok = I've looked around a lot for a clear answer to this, but find very few real answers. I would really appreciate some info from experienced individuals. A tiny bit of background. I've worked content generation (among other thing) on a largeish website for many years, and it follows the pretty basic file system and discreet html (.aspx) pages for content. You want a new page, you make a new file and build your content. Done. I've built a dozen or so brochure sites like this as well. This is the system that makes sense to me, and I find myself a little hesitant to veer away. CMS systems, like WP, obviously do not work like this. I am not inexperienced with wordpress. I've built and implemented a couple custom themes, but have "tried" to make the above file structure work "along side" of a wordpress install - mostly leading to headaches. That is where I currently sit, having spent a couple of months of weekends building my new personal site (which is almost finished). The format of the site is pretty straightforward - its a developer blog (I do a lot of AS3), a portfolio for artwork, and a main intro page that contains a bit of both. My file structure looks a bit like so:                mysite.com-          /css/           /home/           /images/           /javascript/          /portfolio/           /php/ (holds a lot of php snippets that is included elsewhere)          /swf/          /wordpress/../theme/ (draws upon img/css/php in external folders)          index.php      While I do very much like the familiarity of this structure, the cross sharing of assets between static files and dynamic wordpress content is a pain. My option is to turn all static files into templates, and make use of WP's database driven page system. What do I stand to gain from "buying into" the WP system completely? Or, conversely, is a static file structure external to wordpress "workable" - and are there preferred methods of doing so? I realize this question is somewhat subjective, however, the proper handling of static content is, I think, a quite valid point of inquiry (tho... you might not think it, considering how little info there is to be found on the subject). Thanks


title: Hide content from Post Preview

text: Is it possible to hide content in Post Preview (that is not hidden when the post is published)? I have customised `single.php` quite extensively and there are a few elements that I do not want my authors to load up every time they preview their post.


title: wp.getComments is returning nill, when i called from my iphone app

text: i have called **`wp.getComments`** from my iphone app, but its returning nil,, following r my parameters can anybody tell me where i gone wrong               NSDictionary *DicCommentStructure = [NSDictionary dictionaryWithObjectsAndKeys:@"",@"Approved",@"50",@"10",nil];              // Send XMLRPCRequest to the server         NSArray *arrParameters = [NSArray arrayWithObjects:@"1", @"username", @"password",DicCommentStructure, nil];         NSString *strServer = [[[NSString alloc] initWithString:@"http://xyz.com/xmlrpc.php"] autorelease];         // the server         NSString *strMethod = [[[NSString alloc] initWithString:@"wp.getComments"] autorelease];                        // the method         XMLRPCRequest *objXMLRPCRequest = [[XMLRPCRequest alloc] initWithHost:[NSURL URLWithString:strServer]];         [objXMLRPCRequest setMethod:strMethod withObjects:arrParameters];      thanx in advance!!


title: Wordpress update and plugin install not working

text: I am working on a website that I installed WP on a few months back but haven't worked on beyond the install of WP and a theme. I went back to it today and needed to update WP and install a few plugins. When I went to do that it started asking me for FTP info, which was new to me. After research I added said FTP info into the wp-config file. Now when I go to update WP or install a plugin, where it should start putting info on the screen about downloading and updating the files I get nothing in the right pane of the dashboard. I've tried chmod wp-content to 777 and still nothing. I can FTP but I need to be able to update via WP. I'm stumped. Any thoughts?


title: Comment forum to display under the comment you're replying too

text: I am making a theme where I have built in my own custom threading and such using twitter bootstrap. I have it now so that, as per default, when you click reply you are shot down to the WordPress comment forum. Is there a way to make the comment forum come to you? to display right under the comment you are replying too?


title: How code a redirect back to page from form thanks

text: I building a site in WordPress (my own theme) that includes a very simple "sign up" email form. Person enters name and email address and hits submit button. Client currently using a script through Bluehost so I want to recreate vs. using a form plugin. The form is fine. After hitting "submit" person is redirected to a "Thank You" page. I would like to be able to add a "back to page" link after the "Thank You for signing up" message that would take them back to whatever page they were on (the form will be on most site pages). Tried adding this to the template:                   <?php     $url = htmlspecialchars($_SERVER['HTTP_REFERER']);     echo "Back to Page";     ?>      but it generates an error message because it's kicking back to Bluehost, not to the original page. Can anyone help? Thanks!


title: Password Protect Pages Not Working

text:
I recently switched to a new theme, and it does not seem to have the functionality to password-protect individual pages. It only displays "Protected" in page title, but still shows the content without prompting for password. How can I enable this manually? I tried to add (if ( post_password_required( $post ) ) { into a custom page template, but it didn't work. Please help me with correct code here or some other solution. Thanks a lot!                <?php      // Template Name: Password Protected      get_header(); ?>

<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>

                              <?php                                   $my_postid = get_page( $page_id );//This is page id or post id                             $content_post = get_post($my_postid);                             $content = $content_post->post_content;                             $content = apply_filters('the_content', $content);                             //$content = str_replace(']]>', ']]>', $content);                             echo $content;                              ?>

         <?php         if ( !function_exists('dynamic_sidebar')             || !dynamic_sidebar(2) ) :          endif;              ?>

                    <?php get_footer(); ?>


title: Ending Pagination loop in PHP

text:
<?php next_posts_link('←') ?>

             <?php                 global $wp_query;                 $big = 9999;                 echo paginate_links(array(                     'base' => str_replace($big, '%#%', get_pagenum_link($big)),                     'format' => '?paged=%#%',                     'total' => $wp_query->max_num_pages,                     'current' => max(1, get_query_var('paged')),                     'show_all' => false,                     'end_size' => 1,                     'mid_size' => 5,                     'prev_next' => false,                     'prev_text' => 'Prev',                     'next_text' => 'Next',                     'type' => 'list'                 ));             ?>

<?php previous_posts_link('→') ?>

      Hi, I have a pagination loop setup and am choosing to display both the numbers and the prev / next links. However, I'm trying to figure out how I can end the #'s at the most recent 5 articles [1,2,3,4,5] instead of it carrying over to [1,2,3,4,5,6,7]. How would I go about ending it at the most recent 5 articles published on my blog? "I'm just wanting to edit the div-class pages part so it just ends at 5." - If that makes any sense. ![Screenshot](http://i.stack.imgur.com/1cyXV.png)


title: Does WordPress cache get_user_meta() results?

text: If I call get_user_meta() to retrieve a value, does WordPress cache the value? If I call get_user_meta() to retrieve the same value, does WordPress have to query the database again or is it stored in PHP memory?


title: Get posts from current category?

text: How can i display 5 posts from current category (exclude current post). Order by post time. _**Example:_**   * To day news to reading 3 (12/11/2012 - 8:10 PM)   * To day news to reading 2 (12/11/2012 - 6:07 AM)   * To day news to reading 1 (12/11/2012 - 6:05 AM)   * Yesterday news to reading 2 (11/11/2012 - 9:10 PM)   * Yesterday news to reading 1 (11/11/2012 - 7:12 AM)


title: remove_action returns FALSE

text: I'm trying to remove the canonical link reference from my page headers and I'm using the following code in my `functions.php`:               remove_action('wp_head', 'rel_canonical');      However, when I test the return value of remove_action it's value is `FALSE` and I notice that the canonical link reference is still rendered in the `head` of my pages. I've tried wrapping the `remove_action` in an `init` but I get the same result:               function my_init()     {        remove_action('wp_head', 'rel_canonical');     }          add_action('init', 'my_init');      How do I remove the canonical link reference from my page headers?


title: Custom Post Type / Tab Limit

text: I've created a site with **nine** (gulp) custom post types. It's a huge site unsurprisingly. The 9 post types fit on the admin menu but I was wondering if there is a limit to the number of extra post types you are allowed in WordPress? Say this because when enabling PollDaddy that adds two more tabs (Polls and Ratings) which then hides two of my custom post types from the menu. Anyone know if there's a limit and how/if I can increase it? I may try adding a 10th custom post type and see if that displays


title: Verify signup via SMS?

text: Does anybody know of a plugin available for WordPress that would require a new user to enter their mobile phone number as part of the sign up process? The user would then be sent a verification code via SMS which they would have to enter to complete the sign up process. Any ideas? Thanks


title: WP-PostRatings - how to make rating show up?

text: I have Boldy theme on a 3.2.1 instance of Wordpress. I have installed the plugin WP-PostRatings. I want it to show up on my individual posts when posts are viewed individually on a page.   * I installed and activated the plugin.   * I added   `if(function_exists('the_ratings')) { the_ratings(); } ?>`   within my _single.php_ file, as shown in pastebin. However, nothing is happening with my blog posts when viewed as single pages. Have I put the code in the wrong place/file?


title: A little confused as to what add image size actually does

text: I have a call to add_image_size like so:               if ( function_exists( 'add_theme_support' ) ) {          add_theme_support( 'post-thumbnails' );      }          if ( function_exists( 'add_image_size' ) ) {          add_image_size( 'sidebar_thumb', 109, 60 );     }      But then when I try to use that image size in my template...               if ( has_post_thumbnail() ) {           the_post_thumbnail( 'sidebar_thumb' );     }      The first image is 80X60, the second is 45 X 60; that's obviously way off. ![images are not the size I wanted](http://i.stack.imgur.com/7BDmv.png) =The height is right on both images. So I guess my question is how do I get an image outputted with an exact size, and if that's not possible by default, then how would I get the URL of a featured image (the image than the user picked as Featured in the admin section) so I can put that URL into a script like timthumb.


title: How to add meta boxes to Pages

text: I'm almost complete whit my wp theme an I'm now translating it with the WPML plugin. This is working out great (even all my custom post types and meta boxes :) ), but of course there have to be a problem. I have added meta boxes to one specific page and have target it like this:               add_action('admin_init','my_meta_init');          function my_meta_init()     {         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;                   // checks for post/page ID         if ($post_id == '17')         {             add_meta_box('meta_webdesign', 'Webdesign', 'my_meta_webdesign', 'page', 'normal', 'high');             add_meta_box('meta_grafisk', 'Grafisk design & Identitets design', 'my_meta_grafisk', 'page', 'normal', 'high');             add_meta_box('meta_illustrasjon', 'Illustrasjon', 'my_meta_illustrasjon', 'page', 'normal', 'high');         }      But now I need to also target the English version of the page (id 348), how do I do that? Ps. I have tried this: **if ($template_file == 'page-tjenester.php')** (the Norwegian and English version both use the same template, but then all the meta boxes disappear. I would be very grateful for help with this :)


title: Woocommerce - Change Variable Product Add to Cart to behave like external product using Custom Field (link)

text: I am importing affiliate products via XML into Woocommerce. Due to products having variations if I use the External/Affiliate product type I get repetition of product on my front end (eg. same product with different location/colour). To avoid this I am attempting to import these products as variable products, this solves the problem, except now I need to Change the add to cart to behave like an external product (i.e. a Button that links to another website). I've created a Custom Value associated with each product called "Buy_Link", now what? I have searched and searched, but unable to find a solution for something I thought would be relatively simple for someone with php knowledge. I know that I should be able to retrieve the link doing something like this:               <?php echo get_post_meta($post->ID, 'Buy_Link', true); ?>      (After some help and a bit more searching) I believe I will need to place code: ID, 'Buy_Link', true); ?> into single-product/add-to-cart/variable.php, but I am still unsure where it would go in that template. I would like the link to replace some of the functionality of the original add to cart button. Obviously, I am not too familiar with php code, so please be specific about how and where in the template I can put the code. Much appreciated.


title: Adding Separator to Breadcrumbs

text:
I have pieced together a breadcrumbs code that displays child pages/posts and is markedup for schema. The only thing this code doesn't have is a separator between each link. How can I add a separator in one instance, rather than adding the separator after each individual generated link?               function crumbs() {      if ((is_page() && ! is_category()) || is_archive() || is_single() || is_single()) {      echo '
';      echo 'Home';      $post_ancestors = get_post_ancestors($post);      if ($post_ancestors) {      $post_ancestors = array_reverse($post_ancestors);      foreach ($post_ancestors as $crumb)      echo ''.get_the_title($crumb).'';      }      if (is_category() || is_single()) {      $category = get_the_category();      echo 'cat_ID).'">'.$category[0]->cat_name.'';      }      if (!is_category())      echo ''.get_the_title().'';      echo '
';      }     }


title: Is it possible to run plugin code when a multisite blog is deleted?

text: I have a plugin that creates tables when activated or when a new blog is added to a network. When a blog is deleted I would like to be able to remove those tables for that blog. Is there a hook available to do this? I imagine it would be something similar to wpmu_new_blog, but I can't find an equivalent for deleting.


title: _n() Single and Plural for search results?

text:
This code produces > Search Results for "hello" - 1 articles "
Search Results for <?php echo'"'?>         <?php /* Search Count */          $allsearch = &new WP_Query("s=$s&showposts=-1");          $key = wp_specialchars($s, 1);          $count = $allsearch->post_count;          _e('');          _e('');          echo $key;          _e('');          echo '"';          _e(' - ');          echo $count . ' ';          _e('articles');          wp_reset_query(); ?>
      How can I make it `$single` and `$plural` for eg. "1 article" or "2 articles"?


title: Opening a link automatically on page load?

text: Well I am new and beginner ! I installed auto thickbox plus for wp. Now all I want to do is automatically open a link in specific page. Let's suppose I have a page "about us" on which I have a video. When I click a nice insite popup appears playing the video by thickbox. All I want to do is automatically open that video when someone click on "about us" after the page load of "about us". Kindly help me !


title: JS error: The "fb-root" div has not been created, auto-creating

text: There are two errors on my page but i dont know where they are coming from The "fb-root" div has not been created, auto-creating all.js?ver=3.6.1:56 FB.getLoginStatus() called before calling FB.init(). http://bikepologear.eu


title: How can I find out what an `apply_filter` call is actually doing?

text: As an example, I'm looking at `class-wp-xmlrpc-server.php` and there's a line (~115) that says:               $this->methods = apply_filters('xmlrpc_methods', $this->methods);      How can I actually find out what transformations are performed on the data by the filter? Obviously, I can compare `$this->methods` before and after the filter is applied to get the bottom line differences but I'd like to know what code is actually being run to make those changes. Any ideas?


title: What's wrong with my $wpdb query?

text: I'm just trying to query the first user, but it outputs this error, **WordPress database error** : [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wp_users' WHERE ID = 1' at line 1] SELECT * FROM 'wp_users' WHERE ID = 1 And my code,               <?php        global $wpdb;          $wpdb->show_errors();          $sql = $wpdb->prepare( "SELECT * FROM %s WHERE ID = %d" , $wpdb->users, 1);     $results = $wpdb->get_results($sql);          echo '<pre>';     print_r($results);     echo '</pre>';         ?>


title: Add Text Domain To Post Navigation

text: I'm using `previous_post_link('%link','Previous Post');` and `next_post_link('%link','Next Post');` for post navigation but I want to add text domain to that similar to `_e('Next Post' , 'ft');` How can I do that?


title: How to combine multiple body classes

text: My theme already has a specific body class filter for the colorscheme it uses. How can I also add a body class filter for the page name? Basically I want to combine these statements:               <body <?php body_class(); ?>>     <body class="<?php echo get_stencil(); ?>">      I've been trying but I just keep getting error messages with variations like this:                <body class="<?php echo get_stencil(); ?> <?php body_class(); ?>">


title: Putting a wordpress custom post into a widget

text:
I have just recently created a widget in my Wordpress theme that inserts a widget into the sidebar. Its based upon the text widget. However the html content is hard coded into the widget and it has its own title, that way if the user ever decided to get rid of the widget out of the sidebar, then the widget would always be available for reuse in the "available widgets" section if they ever changed their mind and wanted it reinstating on that sidebar or another one. Here is the code:               <?php     /* Plugin Name: Basic Text Widget     Plugin URI: www.lancscps.co.uk     Description: Text to put into the sidebar regarding free consultation     Version: 1.0     Author: Jonathan Beech     Author URI: www.lancscps.co.uk     */     class freeconsultation extends WP_Widget {           function freeconsultation() {                     $widget_ops = array(                     'classname' => 'freeconsultation',                     'description' => 'Text to put into the sidebar regarding free     consultation'           );           $this->WP_Widget(                     'freeconsultation',                     'Free Consultation',                     $widget_ops           );     }           function widget($args, $instance) { // widget sidebar output                     extract($args, EXTR_SKIP);                     echo $before_widget; // pre-widget code from theme     print <<<EOM

In order to establish how we can proceed together with your needs, our first meeting is free of charge.

     EOM;                     echo $after_widget; // post-widget code from theme           }     }     add_action(           'widgets_init',           create_function('','return register_widget("freeconsultation");')     );      I was hoping there would be a method of inserting a custom post into the widget replacing the HTML that is already there. Perhaps this could be done by id so that the user could adjust the content of the post and therefore the widget as they see fit. Changing the code file wouldn't be feasible for the end user.


title: admin.php taking 14 seconds

text: This is a clean install but it has a (relatively) huge database of dummy posts/comments/etc. But even on single-post loads it still takes just as much. ![scr](http://i.stack.imgur.com/qP7Kk.png) Narrowing further down `menu.php` takes 8 seconds but I'm lost at where exactly... ![scr](http://i.stack.imgur.com/GLMrX.png) All its sub values are small... * * * **Edit**   Question: Any pointers on where to look for the bottleneck? (that call stack is HUGE, and apparently child-`callable`'s `Time` doesn't add to parent - as seen in `menu.php`)


title: How can I change the look of a post as is displayed

text: When an article is posted it comes out like this:   Where the title is on top, then the picture, then the image. ![enter image description here](http://i.stack.imgur.com/Xiyf5.png) But what I would like to do is how technobuffalo.com has it: ![enter image description here](http://i.stack.imgur.com/Zx36k.png) How is this done? is a template html copied and pasted for each new article and displays in that format or does WordPress render it for each posting? Thanks


title: How to get the id or url of the image in an image post?

text: I have a bunch of image posts and I'd like to get the ID of those images I didn't set a featured image so I can use `wp_get_attachment_image_src()` to get the urls of various sizes of those images. This is what I created:               $img_posts = get_posts( array(         'tax_query' => array(             array(               'taxonomy' => 'post_format',               'field'    => 'slug',               'terms'    => 'post-format-image',               'operator' => 'IN'             )         )     ) );          foreach( (array) $img_posts as $post ) {         setup_postdata( $post );        $imgID = get_img_id();         //img sources         $thumb = wp_get_attachment_image_src($imgID, 'thumb');         $reg = wp_get_attachment_image_src($imgID, 'large');         $big = wp_get_attachment_image_src($imgID);     }      The `get_img_id` function on the 6th to lastline, which is probably the source of all of my problems, looks like this:               function get_img_id() {             global $post;             $id = intval( $post->ID );             $imgID = get_children( array(                     'post_parent' => $id,                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'numberposts' => 1                 ) );              return $imgID;     }      When I do this I get no errors or output. If I add something like `the_content` to the array instead it functions properly. UPDATE: Per @TheDeadMedic's suggestion I tried this:               $img_posts = get_posts( array(         'cat' => '2',         'tax_query' => array(             array(               'taxonomy' => 'post_format',               'field'    => 'slug',               'terms'    => 'post-format-image',               'operator' => 'IN'             )         )     ) );     foreach( (array) $img_posts as $post ) {         setup_postdata( $post );         $img_id = get_img_id();         var_dump ($img_id);     }      This returned               array         empty      Once per post queried.


title: Enqueue a stylesheet for login page and make it appear in head element

text:
I try to style the login page in my theme. Very simple:               add_action( 'login_enqueue_scripts', function()     {         wp_enqueue_style( 'TEST', get_template_directory_uri() . '/css/login.css' );     });      Unfortunately, it doesn’t work as expected. The `link` element appears in the `body` of the login page, very late. Rendered output:               <link rel='stylesheet' id='TEST-css'  href='http://themes.wp/t5-theme-base/css/login.css?ver=3.9-alpha' type='text/css' media='all' />

                This is wrong, how can I print the link element in the `head`?


title: Show author name not the author ID

text:
I have added the code to get the author, but it displays the author's ID number. How can I get the author's name to show and their gravatar. **CODE**               <?php     $product_pages_args = array(         'meta_key' => '_wp_page_template',         'meta_value' => 'page_library_html_content.php',         'hierarchical' => '0'     );     $product_pages = get_pages( $product_pages_args );     ?>          <?php     foreach ( $product_pages as $product_page ) {         echo '
';         echo '
ID ) . '">' . $product_page->post_title  . '
';         echo '
' . get_post_field('post_content', $product_page->ID ) . '
';         echo '
' . get_post_field('post_author', $product_page->ID ) . '

';     }     ?>


title: How to echo Widget Title in Custom Frontend-Template Box

text:
I've created a custom Widget with the help of following code:                   // Creating the widget      class wpb_widget extends WP_Widget {          function __construct() {         parent::__construct(         // Base ID of your widget         'wpb_widget',               // Widget name will appear in UI         __('WPBeginner Widget', 'wpb_widget_domain'),               // Widget description         array( 'description' => __( 'Sample widget based on WPBeginner Tutorial', 'wpb_widget_domain' ), )          );     }          // Creating widget front-end     // This is where the action happens     public function widget( $args, $instance ) {         $title = apply_filters( 'widget_title', $instance['title'] );         // before and after widget arguments are defined by themes         echo $args['before_widget'];         if ( ! empty( $title ) )         echo $args['before_title'] . $title . $args['after_title'];              // This is where you run the code and display the output         echo get_template_part( 'partials/widgets/test-w' );         echo $args['after_widget'];     }          // Widget Backend      public function form( $instance ) {         if ( isset( $instance[ 'title' ] ) ) {             $title = $instance[ 'title' ];         }         else {             $title = __( 'New title', 'wpb_widget_domain' );         }         // Widget admin form         ?>
         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?>          <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
         <?php      }          // Updating widget replacing old instances with new     public function update( $new_instance, $old_instance ) {         $instance = array();         $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';         return $instance;     }     } // Class wpb_widget ends here          // Register and load the widget     function wpb_load_widget() {         register_widget( 'wpb_widget' );     }     add_action( 'widgets_init', 'wpb_load_widget' );      **As you can see, i echo a html template with**               echo get_template_part( 'partials/widgets/test-w' );      in the main code. I've register the sidebar in my functions.php with following code                   register_sidebar(         array(             'name'              => 'Index Right',             'before_widget' => '
',             'after_widget'  => '
',             'before_title'  => '
',             'after_title'   => '
',         )     );      The widget output in my frontend looks like: ![enter image description here](http://i.stack.imgur.com/ihXw5.png) **THE PROBLEM** The title is outside the widget box. I tried a lot of things to get the title to the top of the box like following image - but no luck :( ![enter image description here](http://i.stack.imgur.com/BBGIe.png) My php/html code ( `echo get_template_part...` ) for the widget looks like                   <?php        $default_thumbnail = 'http://vvvvvvvv.com/vvvvvvvvv.png';        $the_query = new WP_Query('showposts=12&orderby=desc&category_name=featured');       while ($the_query->have_posts()) : $the_query->the_post();     ?>
                       <a target="_blank" href="<?php the_permalink()?>">

                             <?php                             if (has_post_thumbnail()):                             the_post_thumbnail('thumbnail-test');                             else:                             ?>                             <img src="<?php echo $thumbnail; ?>"/>                             <?php endif; ?>

                                <?php the_title(); ?>

           <?php endwhile; ?>     <?php wp_reset_query(); ?>      Any suggestions on how to solve my problem?


title: Force changing the Site Title and add link

text: I have the function below, but it's not actually changing the site title where it is called in my theme.               function blog_filter($string, $show) {         if ( $show == "name" ) {             $string = str_replace('Blog', 'blog.com', $string);         }     return $string;     }     add_filter('bloginfo', 'blog_filter', 10, 2 );      anyone knows why? thank you


title: Limit categories visible

text: How could you limit the categories displayed for a certain role when adding a new post? I would like to only list a few categories, but would rather not prevent them from seeing these categories elsewhere. I already have something for the conditional user role portion:               function dashboard_limited_options() {         if(current_user_can('add_users'))             {                 // donlt do anything             }             else             {             remove_menu_page('options-general.php'); // Settings             remove_menu_page('tools.php'); // Tools             remove_menu_page('upload.php'); // Media                     }         }


title: How to change order of custom post types. I want Featured post to come first

text: Used this but not working:               $my_query = new WP_Query( array(              'post_type' => 'businesslistings',             'post_status' => 'publish',             'orderby' => get_query_var('orderby'), // will return orderby query string variable             'order' => '$var',              'paged' => get_query_var('paged'),         ));


title: WordPress admin webfonts (dashicons) go to blank squares after inactivity (random)

text: I'm using the new WordPress 3.8 and I've noticed that when I leave the admin page open in a tab, and return later, I'm getting a random thing happening with the dashicon fonts used for the menu icons. They all turn to squares, rather than the appropriate dashicon. Its as if the connection to the server that hosts the webfonts has been temporarily lost. Interestingly, just moving my mouse over the sidebar area makes the squares transform into their appropriate dashicon font symbol. Has anyone else experienced this?


title: next_posts_link does not work when querying a specific category

text:
What I am trying to do is display every post from the "News" category (in my case the "news" category's ID is 13), with 5 posts per page. The pagination links display on the page, but when I click on the 'previous' link, it will only show me the first 5 posts in the category. The contents of page-news.php:               <?php get_header(); ?>
Latest News
     <?php         /*$args = array('cat' => 13);         $posts = new WP_Query($args);*/         global $paged;         global $wp_query;              $temp = $wp_query;         $wp_query = null;         $wp_query = new WP_Query();         $wp_query->query(array('cat=13', 'paged='.$paged));              if ($wp_query->have_posts()) :     ?>
     <?php             while ($wp_query->have_posts()) : $wp_query->the_post();     ?>

<a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                     <time datetime="<?php the_time( 'Y-m-d' ); ?>" pubdate><?php the_date(); ?> <?php the_time(); ?></time>                     <?php the_content(); ?>

     <?php         endwhile;     ?>

             <?php next_posts_link( __( '← Older posts')); ?>             <?php previous_posts_link( __( 'Newer posts →')); ?>
     <?php         $wp_query = null;         $wp_query = $temp;         else :     ?>
It looks like there's nothing happening at the moment.
     <?php endif; ?>          <?php get_footer(); ?>


title: Woocommerce override mini-cart.php not working

text: I am trying to override `mini-cart.php` which is template file located at `woocommerce/cart/mini-cart.php`. It should override behaviour of woocommerce widget cart but it isnt working. I can make any changes to the file but it looks like it is still loading from some other place and it is not overriden. I have also tried modifying core template files of woocommerce and deleting mini-cart.php from it but widget is still working. However `mini-cart.php` structure looks exactly the same as html structure generated in final. But it looks like woocommerce isnt using this file so it has probably changed by some update and mini-cart.php is just remain from later versions. Any ideas what file should I override to change look of widget cart? I dont want to completely override whole core widget cart class because I just want to change one `<span>` to `<p>`. Thanks in forward


title: Shortcode or placeholder for theme options page?

text: I'm writing a theme options page that provides a space for the user to enter code for social buttons e.g.               <a href="https://twitter.com/share" class="twitter-share-button"          data-url="<?php echo get_permalink(); ?>">Tweet      Obviously, having `<?php echo get_permalink(); ?>` for the data-url attribute is not going to work in a theme options textarea. What are my options here? I've seen others user   1. shortcodes e.g. [permalink] - but how can I process the shortcode?   2. placeholders e.g. {{url}} - again, how do I replace these placeholders? Appreciate any pointers in the right direction. Thanks!


title: wp_nav_menu with WP as pure CMS

text: I'm trying to use WP as a pure backend CMS for my site. I've got a few pages setup in WP e.g. About, Main Page, Sample Page and I can display the content on my own php pages by using `get_page_by_title`. However when I try to use `wp_nav_menu` to generate the navigation elements, the links generated are in the form of `www.example.com/wordpress/?page=2`. I know I can change WP to use nice permalinks to get `www.example.com/wordpress/about` but I'd like to customise it further so that the link would read `www.example.com/about` e.g. skip the wordpress install location. Is this possible and how can I do it?


title: When I change slug, will WordPress create redirect from the old URL?

text: When I change a slug from `post-a` to `post-b`, will WordPress create a redirect from `/post-a` to `/post-b`, like HTTP 301 or something similar? If not, is there a plugin for that?


title: Use WordPress file upload in my plugin - on frontend and on backend?

text: Is there a way to use wp multifile upload system in my plugin?


title: Related Tags not in category

text: I'm using this piece of code to show related posts based on the tag of the post you are viewing. I'd like to modify is a little to exclude the related posts from the loop if they are in the same category of the post you are viewing Reason for this is i already have a loop to show related posts in the same category, so trying to cut out the duplicates.               <?php     $tags = wp_get_post_tags($post->ID);     if ($tags) {       $first_tag = $tags[0]->term_id;       $args=array(         'tag__in' => array($first_tag),         'post__not_in' => array($post->ID),         'showposts'=>5,         'caller_get_posts'=>1        );       $my_query = new WP_Query($args);       if( $my_query->have_posts() ) {         while ($my_query->have_posts()) : $my_query->the_post(); ?>                  <!-- loop here -->                <?php         endwhile;       }wp_reset_query();     }     ?>      Thanks


title: Display ONLY Latest Post From Several Categories

text: I have searched for this solution on here and was not able to find one that worked for me so I apologize if this seems like a redundant question. I have several categories that I want to display ONLY the latest post from in order of date/time (regardless of category) on my index.php page. Please let me know if I can be more specific to help with this answer!


title: Set default featured image for terms of a custom taxonomy

text: I want to set a default featured image for terms of a custom taxonomy. I found this code but it is only good for categories and not for other terms:               <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>          <?php the_post_thumbnail('thumbnail'); ?>          <?php else :?>          <img src="whatever/directory/<?php $category = get_the_category(); echo $category[0]->cat_name; ?>.jpg" />           <?php endif;?>      How can I make this code also work for a custom taxonomy?


title: Post array not printing after post is published?

text: I'm using this function which displays the post array when I click Add new post. After the post has been published I do not see the array of the published post. What's wrong with the code? I've also tried using `save_post` in place of `wp_insert_post`               function print_test( $post_id ) {     $post = get_post($post_id, ARRAY_A);              echo 'this is from the print_test function';         print_r($post);          }     add_action( 'wp_insert_post', 'print_test',99999,1 );


title: Check if variable is set in filter

text: Thanks to your suggestions, I enabled wp_debug and discovered flaws with my plugin. I have a filter for sorting posts by votes. I use it when the `sort` URL parameter is on. `add_filter( 'posts_where', 'votes', 10, 2 );` I used to get `Undefined index: sort` so I modified my function to first check if the variable is set.               function votes( $where, $query )     {       $sort = array_key_exists('sort', $query->query_vars) ? $_GET['sort'] : null;       if ( isset($sort) ) {                     $where .= " AND $sort >= votes";                      }       return $where;     }      This works fine but I'm not confident if it's correct. I'm wondering if there's a better method to do this.


title: Almost Done... Post Format Code

text:
I would REALLY appreciate some help with this, I have been working on it for a while and am so close to done I can taste it. I need each post format excerpt to have the same excerpt code as the default excerpt (used without post formats) which is provided as "Code 1". This MUST contain the excerpt_wrap and exerpt_inside along with the conditional div class. Basically, everything in this code... simply figure out how to integrate it into the second code everywhere it says "CODE GOES HERE"... Code 1:

                                <?php if ( has_post_thumbnail() ) { ?>                      <a href="<?php the_permalink() ?>">                 <?php the_post_thumbnail( 'thmb-index' ); ?>                                       <?php } ?>                      <div class="excerpt_content<?php if ( has_post_thumbnail() ) echo ' with-thumbnail'; ?>">               <a href="<?php the_permalink(); ?>">                        <?php the_title(); ?>                                   By                        <?php the_author_posts_link( ); ?>                        |                        <?php the_time('F j, Y'); ?>                        | <a href="<?php the_permalink(); ?>/#commentlist">                        <?php comments_number( 'No comments', 'One comment', '% comments' ); ?>                                                <?php the_excerpt(); ?>

      Code 2:               <?php get_header(); ?>

                               <?php while (have_posts()) : the_post(); ?>                                                              <?php          if ( has_post_format( 'aside' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'chat' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'gallery' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'image' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'link' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'quote' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'status' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'video' )) {          CODE GOES HERE          }          elseif ( has_post_format( 'audio' )) {          CODE GOES HERE          }          else {          $format = get_post_format();          if ( false === $format ) {           ?>

                                                    <?php if ( has_post_thumbnail() ) { ?>                      <a href="<?php the_permalink() ?>">                      <?php the_post_thumbnail( 'thmb-index' ); ?>                                            <?php } ?>                      <div class="excerpt_content<?php if ( has_post_thumbnail() ) echo ' with-thumbnail'; ?>">               <a href="<?php the_permalink(); ?>">                        <?php the_title(); ?>                                   By                        <?php the_author_posts_link( ); ?>                        |                        <?php the_time('F j, Y'); ?>                        | <a href="<?php the_permalink(); ?>/#commentlist">                        <?php comments_number( 'No comments', 'One comment', '% comments' ); ?>                                                <?php the_excerpt(); ?>

                    <?php } // ending the if ( false === $format ) ...                         } // end else                            ?>          <?php endwhile; ?>

                        <?php next_posts_link('« Older') ?>

                        <?php previous_posts_link ('Newer »') ?>

                      <?php get_sidebar(); ?>

                    <?php get_footer(); ?>


title: Tagit with json and autocomplete

text:
I am using tagit Tagit for my wordpress site for adding tags through front- end. So far the taglist is displaying fine through json (for json I use the json api However, I can not get the autocomplete to work. If a user starts typing on the input field it displays all the tags. But I want to filter the taglist as soon as the user starts typing (if a user types 'mijn' the results should be 'termijn' but also 'mijnserver'.) This far I have to following in my function:                   $value = '';          if ( $post_id ) {         $post_tags = wp_get_post_terms( $post_id, 'post_tag' );         $tagsarray = array();         foreach ($post_tags as $tag) {             $tagsarray[] = $tag->name;         }              $value = implode( ', ', $tagsarray );     }          ?>
Business Tags

         <input type="text" id="test" name="tags" value="<?php echo esc_attr( $value ); ?>" size="40">      The javascript:               jQuery(function($)     {         $("#test").tagit({         fieldName: "tags[]",        singleField: true,         allowSpaces: true,         minLength: 2,         matchContains:true,         removeConfirmation: true,         placeholderText: 'Kernwoord',              tagSource: function( request, response ) {             console.log("1");             $.ajax({                 url: "http://localhost/sbnl/api/get_tag_index/?dev=1",                 data: {term:request.term},                 dataType: "json",                 success: function(data) {                          response($.map(data.tags, function(item) {                         return {                             label: item.title,                             id: item.id                         }                     }));                 }                  });         },              });     });      last bit of the code:
     <?php      If someone could please help me out


title: Unable to sort wp_query by date/time with multiple meta_key s

text:
**4th EDIT 11/17/2011** I spoke too soon. Now I have all the posts showing up but the total events does not seperate the events by day after I moved the endif; and endwhile; I posted the modified code below and below this is the previously modified code. Before the count was correct for each day. If I had two events from different posts on Friday then it would say "2 Events on Friday" but it would only display the content of the most recent post. Now it displays the content of all the posts but if I have two events from different posts on Friday then it say "1 Event Friday" before each post. Here is the code and Thank you.               <?php           $today = date("Y-m-d 00:00");  //set today's date            $todaytext = date("l"); // define $todaytext with written out days            for ($i=0; $i<7; $i++){           $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;           $thedate = date ( 'Y-m-d H:i' , $thedate );           $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;           $thedatetext = date ( 'l' , $thedatetext );           $future = strtotime ( '+24 hours' , strtotime ( $thedate ) ) ;           $future = date ( 'Y-m-d H:i' , $future );            $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),         array(             'key' => 'artist_talk_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'             )     )     );          $event_query = new WP_Query( $args );           if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();              $keys = array('opening_time', 'film_time', 'artist_talk_time');     $times = array();  // I tried putting the new array line here but then I got a repeat of the post for everyday     $custom_field_keys = get_post_custom_keys();     foreach ($custom_field_keys as $custom_field_key) {          if (in_array($custom_field_key, $keys))      {         $custom_field_value = get_post_meta($post->ID, $custom_field_key, true);              if ($custom_field_value >= $thedate && $custom_field_value <= $future) {                  $counttest++;             $times[] = array($custom_field_value, $post->ID, $custom_field_key); // I changed the array here              }         }         }                     if ($counttest >0) {       echo $counttest;            if ($counttest>=2){       echo ' Events ';       } // end if ($totalevents>=2) function            if ($counttest<2){        echo ' Event ';       }       echo $count;       if ($thedate==$today){echo 'Today';}       if ($thedate>$today){       echo $thedatetext;}       echo  '
';            }            $counttest=0;                 asort($times); // I changed the asort to sort here       foreach ($times as $event) { $time_value = $event[0]; $post_id = $event[1]; $time_key = $event[2];  // changed the foreach here          if ($time_key == 'opening_time') { ?>
     <a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>"> <?php echo get_the_post_thumbnail($post_id, 'upcoming_event_sidebar'); ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>"> <?php echo get_the_title($post_id); ?>

Opening

<?php echo get_post_meta($post_id,'event_venue', true);?>

<?php echo get_post_meta($post_id,'opening_time', true);?>

     <?php }          else if ($time_key == 'artist_talk_time') { ?>
     <a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>"> <?php echo get_the_post_thumbnail($post_id, 'upcoming_event_sidebar'); ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>"> <?php echo get_the_title($post_id); ?>

Artist Talk

<?php echo get_post_meta($post_id,'event_venue', true);?>

<?php echo get_post_meta($post_id,'artist_talk_time', true);?>

     <?php }            else if ($time_key == 'film_time') {             ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Film
       <?php       echo get_post_meta($post_id,'film_time', true); echo get_the_content($post_id);       }           }          endwhile;       endif;            rewind_posts();            }       ?>      **End 4th EDIT** **3rd EDIT 11/17/2011** I made the changes that you suggested Marcochiesi but the behavior stays the same. I tried making any other changes that I could wrap my heard around but know luck. What would you try next? Thank you so much for your help. **revised code**                 <?php           $today = date("Y-m-d 00:00");  //set today's date            $todaytext = date("l"); // define $todaytext with written out days            for ($i=0; $i<7; $i++){           $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;           $thedate = date ( 'Y-m-d H:i' , $thedate );           $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;           $thedatetext = date ( 'l' , $thedatetext );           $future = strtotime ( '+24 hours' , strtotime ( $thedate ) ) ;           $future = date ( 'Y-m-d H:i' , $future );            $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),         array(             'key' => 'artist_talk_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'             )     )     );          $event_query = new WP_Query( $args );           if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();              $keys = array('opening_time', 'film_time', 'artist_talk_time');     $times = array();  // I tried putting the new array line here but then I got a repeat of the post for everyday     $custom_field_keys = get_post_custom_keys();     foreach ($custom_field_keys as $custom_field_key) {          if (in_array($custom_field_key, $keys))      {         $custom_field_value = get_post_meta($post->ID, $custom_field_key, true);              if ($custom_field_value >= $thedate && $custom_field_value <= $future) {                  $counttest++;             $times[] = array($custom_field_value, $post->ID, $custom_field_key); // I changed the array here              }         }         }           endwhile;           if ($counttest >0) {       echo $counttest;            if ($counttest>=2){       echo ' Events ';       } // end if ($totalevents>=2) function            if ($counttest<2){        echo ' Event ';       }       echo $count;       if ($thedate==$today){echo 'Today';}       if ($thedate>$today){       echo $thedatetext;}       echo  '
';       }            endif;       $counttest=0;                sort($times); // I changed the asort to sort here      foreach ($times as $event) { $time_value = $event[0]; $post_id = $event[1]; $time_key = $event[2];  // changed the foreach here           if ($time_key == 'opening_time') {         ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Opening
       <?php       echo get_post_meta($post_id,'opening_time', true); echo get_the_content($post_id);             }       else if ($time_key == 'artist_talk_time') {             ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Artist Talk
       <?php       echo get_post_meta($post_id,'artist_talk_time', true); echo get_the_content($post_id);            }       else if ($time_key == 'film_time') {             ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Film
       <?php       echo get_post_meta($post_id,'film_time', true); echo get_the_content($post_id);       }           }            rewind_posts();            }       ?>      **end 3rd EDIT** **2nd EDIT 11/16/2011** Marcochiesi, thanky for the additional help. Now I get the right count of events and they are sorted properly. The problem is that only the most recent post shows any content. If I add a new CPT event then it will show the its title and permalink but if I delete it it goes back to the next most recent post. Do you know what the problem is? Thank you again. It is impossible without your help. **2nd revised code**                 <?php           $today = date("Y-m-d 00:00");  //set today's date            $todaytext = date("l"); // define $todaytext with written out days            for ($i=0; $i<7; $i++){           $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;           $thedate = date ( 'Y-m-d H:i' , $thedate );           $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;           $thedatetext = date ( 'l' , $thedatetext );           $future = strtotime ( '+24 hours' , strtotime ( $thedate ) ) ;           $future = date ( 'Y-m-d H:i' , $future );            $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),         array(             'key' => 'artist_talk_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'             )     )     );          $event_query = new WP_Query( $args );           if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();              $keys = array('opening_time', 'film_time', 'artist_talk_time');     $times = array();     $custom_field_keys = get_post_custom_keys();     foreach ($custom_field_keys as $custom_field_key) {          if (in_array($custom_field_key, $keys))      {         $custom_field_value = get_post_meta($post->ID, $custom_field_key, true);              if ($custom_field_value >= $thedate && $custom_field_value <= $future) {                  $counttest++;                  $times[$custom_field_key] = array($custom_field_value, $post->ID);         }         }         }           endwhile;      if ($counttest >0) {       echo $counttest;            if ($counttest>=2){       echo ' Events ';       } // end if ($totalevents>=2) function            if ($counttest<2){        echo ' Event ';       }       echo $count;       if ($thedate==$today){echo 'Today';}       if ($thedate>$today){       echo $thedatetext;}       echo  '
';       }            endif;        $counttest=0;                asort($times);      foreach ($times as $time_key => $event) {      $time_value = $event[0]; $post_id = $event[1];            if ($time_key == 'opening_time') {         ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Opening
       <?php       echo get_post_meta($post_id,'opening_time', true); echo get_the_content($post_id);            }      else if ($time_key == 'artist_talk_time') {             ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Artist Talk
       <?php       echo get_post_meta($post_id,'artist_talk_time', true); echo get_the_content($post_id);            }       else if ($time_key == 'film_time') {             ?>
<a href="<?php echo get_permalink($post_id) ?>" title="<?php echo get_the_title($post_id); ?>">       <?php echo get_the_title($post_id); ?>

Film
       <?php       echo get_post_meta($post_id,'film_time', true); echo get_the_content($post_id);       }           }            rewind_posts();            }       ?>      **END 2nd EDIT** **EDIT 11/15/2011** After changing the code from marcochiesi (thank you) I was able to stream line my if statements and gain the ability to sort artist_talk_time in front of opening_time if that is what the meta_key said. But now I have duplicate posts coming from multiple days in the sorting. Each CPT can have 3 meta_keys that have a date & time value. Currently I have 3 test CPTs. 1 has an opening_time at 2:00 today (it shows up first) It also has an artist talk time on the next day at 2:00. This also shows up but in both today and tomorrow. This behavior happens with all the posts. What am I doing wrong? **revised code**                <?php           $today = date("Y-m-d 00:00");  //set today's date            $todaytext = date("l");  // define $todaytext with written out days           for ($i=0; $i<7; $i++){           $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;           $thedate = date ( 'Y-m-d H:i' , $thedate );           $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;           $thedatetext = date ( 'l' , $thedatetext );           $future = strtotime ( '+23 hours' , strtotime ( $thedate ) ) ;           $future = date ( 'Y-m-d H:i' , $future );       $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),         array(             'key' => 'artist_talk_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'             )     )     );          $event_query = new WP_Query( $args );           if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();              $keys = array('opening_time', 'film_time', 'artist_talk_time');     $times = array();     $custom_field_keys = get_post_custom_keys();          foreach ($custom_field_keys as $custom_field_key) {          if (in_array($custom_field_key, $keys))      {         $custom_field_value = get_post_meta($post->ID, $custom_field_key, true);              if ($custom_field_value >= $thedate && $custom_field_value <= $future) {                  $counttest++;                  $times[$custom_field_key] = $custom_field_value;         }      }      }           endwhile;      if ($counttest >0) {       echo $counttest;            if ($counttest>=2){       echo ' Events ';       } // end if ($totalevents>=2) function            if ($counttest<2){        echo ' Event ';       }       echo $count;       if ($thedate==$today){echo 'Today';}       if ($thedate>$today){       echo $thedatetext;}       echo  '
';       }            endif;            $counttest=0;            if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();            asort($times);       foreach ($times as $time_key => $time_value) {            if ($time_key == 'opening_time') {         ?>       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
Opening
            <?php       echo get_post_meta($post->ID,'opening_time', true);       the_content();       }       else if ($time_key == 'artist_talk_time') {             ?>       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
Artist Talk
            <?php       echo get_post_meta($post->ID,'artist_talk_time', true);       the_content();       }       else if ($time_key == 'film_time') {             ?>       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
Artist Talk
            <?php       echo get_post_meta($post->ID,'film_time', true);       the_content();       }            }            endwhile;            endif;       rewind_posts();            }       ?>      **END EDIT 11/15/2011 - Original Question Below** Through help on this answers collection I have the code working below that sorts events by date and then lists them and counts them. It does not filter by time. For example, a single CPT 'event' has multiple meta_keys with a yyyy-mm-dd 00:00 entry. Each main event or art opening runs for about a month, but there is also the opening reception and artist talks that have their own meta_keys opening_time and artist_talk_time. I have another page that lists the month long portion of the events. Now I am trying to list the upcoming events in order. The problem is in an individual CPT "event" if the artist_talk_time is 16:00 and the opening_time is after 16:00, the opening_time shows first since it is called first in the loop where I display the_content(). This is not the behavior that I want. All events on a single day, even if in the same CPT should be listed in order by time. I am sure that I am doing this the wrong way and any help is greatly appreciated. Thank you.               <?php           $today = date("Y-m-d 00:00");           $todaytext = date("l");            for ($i=0; $i<7; $i++){           $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;           $thedate = date ( 'Y-m-d H:i' , $thedate );           $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;           $thedatetext = date ( 'l' , $thedatetext );           $future = strtotime ( '+23 hours' , strtotime ( $thedate ) ) ;           $future = date ( 'Y-m-d H:i' , $future );       $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),         array(             'key' => 'artist_talk_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'             )     )     );           $event_query = new WP_Query( $args );                if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();           if ((get_post_meta($post->ID,'opening_time', true)>=$thedate) && (get_post_meta($post->ID,'opening_time', true)<=$future))       { $counttest++;}          if ((get_post_meta($post->ID,'film_time', true)>=$thedate) && (get_post_meta($post->ID,'_time', true)<=$future))       { $counttest++;}          if ((get_post_meta($post->ID,'artist_talk_time', true)>=$thedate) && (get_post_meta($post->ID,'artist_talk_time', true)<=$future))       { $counttest++;}          endwhile;       if ($counttest >0) {       echo $counttest;            if ($counttest>=2){       echo ' Events ';       } // end if ($totalevents>=2) function            if ($counttest<2){        echo ' Event ';       }       echo $count;       if ($thedate==$today){echo 'Today';}       if ($thedate>$today){       echo $thedatetext;}       echo  '
';       }            endif;            $counttest=0;            if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();            if ((get_post_meta($post->ID,'opening_time', true)>=$thedate) && (get_post_meta($post->ID,'opening_time', true)<=$future))       {       ?>       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
Opening Reception
       <?php       echo get_post_meta($post->ID,'opening_time', true);       the_content();            }            if ((get_post_meta($post->ID,'artist_talk_time', true)>=$thedate) && (get_post_meta($post->ID,'artist_talk_time', true)<=$future))       { ?>       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
 Artist Talk
       <?php        echo get_post_meta($post->ID,'artist_talk_time', true);       the_content();            }             endwhile;            endif;       rewind_posts();            }       ?>


title: How to execute code only on posts older than 2 weeks

text: I am trying to modify a plugin to only execute on posts that are older than two weeks. I added the isOldEnough function below to try and do that. What am I missing, here?               function remove_metadata()          {     $isOldEnough = function ()         {             $postDate = strtotime( $post->post_date );             $todaysDate = time();             if($postDate - $todaysDate > 129600) {                 return true;             } else {                 return false;             }         };      if ($isOldEnough)       {             /* Register style css. */             wp_enqueue_style( 'remove-style-meta', plugins_url( 'css/entrymetastyle.css', __FILE__ ), false, '1.0', 'all' );          }     }     add_action('wp_head', 'remove_metadata');      The plugin simply removes the metadata using a couple lines of CSS. Right now it executes the code on all posts, regardless of post_date.


title: How to have two column on my index page?

text: I want two full columns after the header and main menu bar on my index page. Seems simple, but googling and prowling the wordpress.org site hasn't gotten me anywhere. Short explanation + a link to relevant section of TFM to R would be much appreciated.


title: I can't access the pages for my custom taxonomy

text: I'm working on a recipe site that has a custom post type, recipes, with two custom taxonomies for handling recipe categories and tags. The custom post type works and so does the custom taxonomy for the categories, i.e. i can access individual posts and category pages. However, when I try to access a custom taxonomy tag page, I get the wordpress 404 page. I don't really know how to troubleshoot this since wordpress isn't giving me any useful error codes. Any suggestions?


title: How do I use two different images, one as a thumbnail and one as a linked image?

text: I wanted to do an image gallery in a post, where the linked image (a href) was different from the thumbnail's src. Unfortunately, WP seems completely incapable of doing this. If I put the large image in the gallery, I can't specify a custom thumbnail. If I put the thumbnail in the gallery, I can't link the large image since "Link URL" appears to be broken. If I change the "Link URL" and then click "Save All Changes," it ignores whatever changes I make in the "Link URL" text box. Since there appears that there is no way to do this from the front end (which seems ridiculous?), I went looking through my web site's directories in an attempt to find where the blog posts are stored, but they're not on "/wp/" nor "/wp/wp-content", so I'm sort of stumped here!


title: Redirect category to first available child post

text: Is possible to redirect category to first available child post please? Thanks!


title: Replacement for gallery_shortcode function not taking all attributes

text:
I have the following custom function to replace the `gallery_shortcode` function from core. It hooks in at the beginning and works. **The problem** is that I can't get my custom key/values from the gallery shortcode in there. I receive them in the core function, but they don't get passed into my custom function. I can't really investigate what's going wrong or where they get missing, because i don't get any `print_r` output for `$attr` inside my custom function. Any ideas? _Note: I added comments for everything I changed from the core to my custom function._               function modified_post_gallery( $attr )      {         // I can't get any output from the following         echo '
';                  print_r( $attr );          echo '
';         // But: i get the expected output if i place the same line inside the core function:          /root/wp-include/media.php line 759 and get the actual output including all custom key/values.              global $post, $wp_locale;              static $instance = 0;         $instance++;              $output = '';              // We're trusting author input, so let's at least make sure it looks like a valid orderby statement         if ( isset( $attr['orderby'] ) )          {             $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );             if ( ! $attr['orderby'] )                 unset( $attr['orderby'] );         }              // extract result from user input & defaults         extract( shortcode_atts( array(              'order'        => 'ASC'             ,'orderby'      => 'menu_order ID'             ,'id'           => $post->ID             ,'itemtag'      => 'span' // CHANGED             ,'icontag'      => 'span' // CHANGED             ,'captiontag'   => 'span' // CHANGED             ,'columns'      => 3             ,'size'         => 'thumbnail'             ,'include'      => ''             ,'exclude'      => ''             ,'class'        => '' // ADDED             ,'test'         ), $attr ) );              $id = intval( $id );         if ( 'RAND' == $order )             $orderby = 'none';              if ( !empty( $include ) )          {             $include = preg_replace( '/[^0-9,]+/', '', $include );             $_attachments = get_posts( array(                   'include'          => $include                 ,'post_status'      => 'inherit'                 ,'post_type'        => 'attachment'                 ,'post_mime_type'   => 'image'                 ,'order'            => $order                 ,'orderby'          => $orderby              ) );                  $attachments = array();             foreach ( $_attachments as $key => $val )              {                 $attachments[$val->ID] = $_attachments[$key];             }         }          elseif ( !empty( $exclude ) )          {             $exclude = preg_replace( '/[^0-9,]+/', '', $exclude );             $attachments = get_children( array(                   'post_parent'      => $id                 ,'exclude'          => $exclude                 ,'post_status'      => 'inherit'                 ,'post_type'        => 'attachment'                 ,'post_mime_type'   => 'image'                 ,'order'            => $order                 ,'orderby'          => $orderby              ) );         }          else          {             $attachments = get_children( array(                   'post_parent'      => $id                 ,'post_status'      => 'inherit'                 ,'post_type'        => 'attachment'                 ,'post_mime_type'   => 'image'                 ,'order'            => $order                 ,'orderby'          => $orderby              ) );         }              // No attachments, so abort         if ( empty( $attachments ) )             return '';              // RSS/Atom         if ( is_feed() )          {             $output = "\n";             foreach ( $attachments as $att_id => $attachment )                 $output .= wp_get_attachment_link( $att_id, $size, true )."\n";                  return $output;         }              $itemtag = tag_escape( $itemtag );         $captiontag = tag_escape( $captiontag );         $columns = intval( $columns );         $itemwidth = $columns > 0 ? floor( 100/$columns ) : 100;         $float = is_rtl() ? 'right' : 'left';              $selector = 'gallery-'.$instance;              $gallery_div = '';              $size_class = sanitize_html_class( $size );              $gallery_div = '
';              $i = 0;         foreach ( $attachments as $id => $attachment )          {             $class = $columns > 0 && ++$i % $columns == 0 ? ' last' : ''; // ADDED for the single item/image                  $link = isset( $attr['link'] ) && 'file' == $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false );                  $output .= '<'.$itemtag.' class="gallery-item '.$class.'">'; // ADDED class             $output .= '<'.$icontag.' class="gallery-icon">'.$link.'</'.$icontag.'>';             if ( $captiontag && trim($attachment->post_excerpt) )             {                 $output .= '<'.$captiontag.' class="wp-caption-text gallery-caption">';                 $output .= wptexturize( $attachment->post_excerpt );                 $output .= '</'.$captiontag.'>';             }             $output .= '</'.$itemtag.'>';         }         $output .= ''."\n";              return $output;     }     add_filter( 'post_gallery', 'modified_post_gallery', 10, 2 );


title: How to run this SQL query of wp_terms database

text: I have the following tables (only pertinent info included for brevity and clarity) Table Name: wp_term_relationships               object_id    term_taxonomy_id     1266         1341     1266         452     1266         449      Tabloe Name: wp_term_taxonomy               term_taxonomy_id    term_id     1341                1342     452                 453     449                 450      Table Name: wp_terms               term_id      name      slug     1342         792       792     453          396       396     450          394       394      I have a list of the wp_term "names" and I want to get a list of the object_ids (only unique ones) from wp_term_relationships So, my list will be something like: 394, 396, 988, 666 And I would like it to return (based on the above data): 1266 (i.e. Using term_id from wp_terms to get term_taxonomy_id from wp_term_taxonomy and then finally using that value in wp_term_relationships to get the object_id) I am quite new to mySQL and have been reading/experimenting with it all day and can't seem to get it quite right.               SELECT $wpdb->term_relationships.object_id     FROM $wpdb->term_relationships         LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id         LEFT JOIN $wpdb->terms ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id        WHERE name IN (394, 396, 988, 666)       GROUP BY $wpdb->term_relationships.term_taxonomy_id     ORDER BY $wpdb->term_relationships.term_taxonomy_id DESC      I wondered if someone could maybe cast an experienced eye over it and help me see where I'm going wrong? Thank you :-) This is my query so far:


title: Can I bulk register contributors for a new blog

text: I just designed a blog to go with our small classic car club website here in the south of Spain. Before I make it available to club members I need to do something about registration. I have read up on as much as I can find but couldn't find an answer to this: Ideally I would like to be able to pre-register the 60 or so members so that they can post and comment from the outset (some are not very computer literate and registering first might throw them for a loop). I have looked at the user creation part of Dashboard and it would be very laborious to have to do this for every member. Is there a simple way to create, say, contributor rights for all the members? I have their names and email addresses - e.g. in an excel file. Is there any way to cut and paste from, or import a pre-defined list? Thanks for any help...


title: Plugin similar to Taxonomy Drill-Down for custom fields?

text: Is there a plugin available that does for custom fields what Scribu's excellent Taxonomy Drill-Down (formerly called Query Multiple Taxonomies) does for taxonomies?


title: Problem Building a Simple Google Maps Plugin

text:
I'm learning how to build a google maps plugin. (I know that there are plugins that add Google Maps, but I'd like to be able to adapt the code to my needs. And it's fun to learn). Unfortunately, I'm not getting a map after inserting my short code. This is the main php file of the plugin:               <?php     /*     Plugin Name: Lax Google Map Plugin     Plugin URI: http://www.mysite.com     Description: Make Map     Version: 1.0     Author URI: http://www.mysite.com     */               function lax_google_map_init() {         wp_enqueue_script('google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false');     }     add_action('init', 'lax_google_map_init');               function lax_google_map_init_js() {       wp_enqueue_script('lax_google_map_script', plugins_url('js/lax_google_map_script.js', __FILE__), array('google-maps'));         }           add_action('init', 'lax_google_map_init_js');               function lax_google_map_maker($atts,$content=null) {                  $output = '

';          return $output;          }                    add_shortcode('lax-google-map', 'lax_google_map_maker');     ?>      In the javascript file, I've got:               jQuery.noConflict();          jQuery(document).ready(function($) {            var latlng = new google.maps.LatLng(-34.397, 150.644);       var myOptions = {           zoom: 8,           center: latlng,           mapTypeId: google.maps.MapTypeId.ROADMAP         };         var map = new google.maps.Map(document.getElementById("map_canvas"),             myOptions);          });      I'm not getting an error. It doesn't do anything. Any suggestion as to what I'm doing wrong? I want to get a basic map working and then I should be able to add more functionality later. Thank you. -Laxmidi


title: How do I properly format the user_role array?

text: I used a role editor recently and needed to delete a role. After deleting it I noticed that it began to appear as blank in the edit user role drop-down. After a bit of investigating and deleting entries from the database. I renabled more_fields and the blank boxes reappeared. I then did a db search and found multiple entries in wp_options more_fields as `a:12:{i:0;s:13:"administrator";i:1;s:6:"editor";i:2;s:6:"author";i:3;s:11:"contributor";i:4;s:10:"subscriber";i:5;s:11:"distributor";i:6;s:10:"integrator";i:7;s:5:"sales";i:8;s:7:"support";i:9;s:7:"revisor";i:10;s:7:"premier";i:11;s:9:"marketing";}` I've tried adjusting it back to wps default roles like the example below but it causes a 404. `a:5:{i:0;s:13:"administrator";i:1;s:6:"editor";i:2;s:6:"author";i:3;s:11:"contributor";i:4;s:10:"subscriber";}` Do I have my syntax correct or am I missing something else? I've added the database entry to pastebin, you'll notice that the user role array is listed five times. Thanks for the help. http://pastebin.com/RpsFytgc ![enter image description here](http://i.stack.imgur.com/Dkvy0.png)


title: How do I redirect a post url to a custom url?

text: I've created a page that loops posts. Each post acts as a category link so that when you click it brings you to a category archive. My issue is that wordpress somehow overrides my htaccess and redirects me to the single.php post. So ill have a category page called 'Neighborhoods'. Within 'Neighborhoods' I have a post called 'Highland Park'. When I click 'Highland Park' it brings you to the the single.php not the archive.php of 'Highland Park.' Note: I uploaded my wordpress files into a folder called 'pages'. In my htaccess file I have a rewrite where 'neighborhoods/' is 'pages/category/neighborhoods/' Is there a solution? Am I overlooking something? Thanks in advance!


title: How to override WP_DEBUG for Ajax responses?

text: It is highly recommended practice (that I completely agree with) to develop with `WP_DEBUG` enabled. However it is merely inconvenient to see not yet fixed warnings in pages, but in Ajax responses they ruin response completely. I am just starting with Ajax in WP, is there some appropriate hook to suppress errors for Ajax responses only? PS fix everything is not viable option at moment, because it is extremely extensive and complex environment :)


title: Images Being Incorrect Generated Outside Of Wrapper in Wordpress Nivoslider

text: I have the following code generating the images and thumbnails from the featured image of a post in the category Showcase.               <?php         $featured_image = get_the_post_thumbnail( get_the_ID() );         $dom = new DOMDocument();         $dom->loadHTML($featured_image);              $fi_src = $dom->getElementsByTagName('img')->item(0)->getAttribute('src');              $slider = get_the_post_thumbnail( get_the_ID(), 'thumbnail' );         $dom = new DOMDocument();         $dom->loadHTML($slider);          $s_src = $dom->getElementsByTagName('img')->item(0)->getAttribute('src'); ?>          <img src="<?php echo $fi_src; ?>" data-thumb="<?php echo $s_src; ?>" title="" />      However on implementation, and multiple posts. Its throwing the images outside the wrapper http://www.milknhny.co.uk/ Can anyone advise how this can happen?


title: How to share WordPress session and cookies between domain and subdomain?

text: I have missed a lot of time by searching answer to my question. For today I have two WP installations on the one server and one DB but with different prefix. I already shared users data and meta between two blogs and it working fine! But I still can’t setup autologin or single sign on under two blogs. The code below does not work in WP3.8.               define('COOKIE_DOMAIN', '.domain.com'); //replace with the 1st website URL     define('COOKIEPATH', '/');


title: Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms

text:
I am using Isotope to filter posts on the fly from my archive pages. I have a Custom Post Type called "art". On the sidebar, I've created links to yearly archives on my sidebar, i.e. 2014, 2013, 2012... etc. When I am on a yearly archive page, i.e. /art/2012, I want _only the terms which exist_ for _this custom-post-type_ on _this year's archive page_ to appear. For example, if I am on the date archive of 2009, I only have drawings, not paintings, so I only want the category "Drawings" to show, as clicking "Paintings" will yield zero results (hence the redundancy). The code I have currently on my sidebar.php (outside the loop) is a modified version that I found here which simply makes wordpress regurgitate all categories across all post types, which is not what I want:

All
              <?php // Verify if tag/cat is used in archive: http://wordpress.stackexchange.com/a/31981/32287         $categorys = get_categories(                         array(                         'type' => 'art',                         'exclude' => '1,5',                         'hide_empty' => false                         )          );         if ($categorys) {             foreach ($categorys as $category) {                 echo '
';                 if($category->count > 0){ // check cat count                         echo 'slug . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name . '
';                 } else { // if no posts                 }             } // end foreach         } // end if         ?>
      Can anyone help me write a function which will output the terms that only exist for the yearly date archive page of custom post type "Art"? Been googling for days without avail. :(


title: Create a Page via plugin

text: My problem is to show a list of products read from db tables. I know how to read them and I am able to produce the table, but only using a shortcode embedded in a page that I've created via WP. I want the plugin itself create a page with my table inside, and that this page is made available to the WP users via a menu item (not the admin menu). What is the right way?


title: What are the common security flaws I need to look for?

text: As a wannabe WP plugin developper, what are the main security flaws/holes I should look for? I'm about to create a new plugin with a configuration panel (ie input fields and stuff). What should I be concerned about? For example, is data sanitization such a big deal since it's in the /wp-admin/ area? Could someone malicious directly hit my plugin page and send POST requests or something like that? Thank you!


title: Paypal Framework

text: I'm trying to set up a paypal-subscription-based website, where people can sign up if they pay a subscription fee trough Paypal. I'm pretty new to this Paypal IPN system, but I found this plugin which seems to do what I want: http://wordpress.org/extend/plugins/paypal-framework/ Does anyone know what command do I need to send trough the hashCall() function to set up a paypal subscription for the user that's attempting to register? I assume it's something else than `doDirectPayment` and doesn't require all those CC parameters, right?


title: Review site using Wordpress

text: I have my domian viewport.mobi, I want to create mobile review site like http://www.mobileawesomeness.com/ , I think its created in wordpress. Can anyone suggest a free or paid theme available for wordpress. so I can post screenshot of the mobile site and the review, also Open for Comments. Thanks,


title: How to store the value of a custom field dropdown select for post referencing?

text: I'm trying to reference posts to each other. Editors should have a custom field select list of certain post's titles to link the current post with other posts. I got quite far, I think. The select list appears correctly. All titles are there. Now, I'm stuck at the point, where the referred post's ID has to be saved. How do I grab the selected option's value, save it and make it default value? Do I have to wrap everything inside a form function? This is what I have so far:               add_action("admin_init", "admin_init");     add_action('save_post', 'save_reference_id');       /*** add_meta_box ***/     function admin_init(){         // adding a custom field to post type 'case'         add_meta_box("refInfo-meta", "Reference", "meta_options", "case", "side", "high");     }       /*** callback ***/     function meta_options(){       ?>         <form action="<?php bloginfo('url'); ?>" method="get">           <select name="page_id" id="page_id">                <?php           global $post;           // getting all child pages of ID 21           $args = array( 'numberposts' => -1, 'post_type' => 'page', 'post_parent' => 21);           $posts = get_posts($args);                foreach( $posts as $post ) : setup_postdata($post); ?>             <option value="<?php echo $post->ID; ?>"><?php the_title(); ?></option>           <?php endforeach; ?>                </select>         </form>            <?php     }       /*** save_post ***/     function save_reference_id(){       // big question mark     }


title: Custom WP_List_Table: How to create an unapproved row?

text: In this Example, let's assume every item had the attribute `$item['approved']` with values Zero unapproved and One for approved. How can I get the rows of the "unapproved books" to be yellow? (well, it's not about the yellow, but about the WP standard compliant procedure of marking rows as unapproved)