Custom archive pages without "the loop"

Is there a way that I could control the rendering of an archive page that uses my own loop? I'd like to group the posts by a custom taxonomy, then sort them by date.


wpautop() when shortcode attributes are on new lines break args array

I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines - to make it more readable to content editors:               [component         attr1 ="value1"         attr2 ="value of the second one"         attr3 ="another"         attr4 ="value"         ...         attrN ="valueN"]      The reason behind this requirement is that a few attributes might be quite verbose in content. Unfortunately, `wpautop()` adds some nasty extra markup that breaks the `$atts` array like this (using php `print_r($atts)`):               Array ( [0] => attr1 [1] => ="value1"     /> [3] => attr2 = [4] => "value [5] => of [6] => the [7] => second [8] => one"     /> [10] => "" //...and more like this)      I've tried with the attributes **inline** :               [component attr1 ="value1" attr2 ="value of the second one" ="value"... attrN ="valueN"]      and the output is as expected:               Array ( [attr1] => value1 [attr2] => value of the second one [attr3] => //...and so on)      is there any way to have the attributes intented and avoid that extra markup that breaks the `$args` array? the function that I use to register the shortcode `[component]` extracts the values like this:               function component_func( $atts, $content = null ) {     extract( shortcode_atts( array(         'attr1' => 'attr1',         'attr2' => 'attr2',         'attr3' => 'attr3',         ), $atts ) );         // more code     }      I then use those extracted variables to populate another array


Multiple loops for plugin

Ok I'm using the plugin "The Cart Press" and I am trying to understand how multiple loops work when using a custom post type. If I do a regular query for posts it just gives me back my blog posts and not my TCP products. When displaying products regularly they use the same loop functions as blog posts and so I'm wondering what is happening differently to cause these products to be loaded. I have used a portfolio plugin in the past called "Simple Portfolio" which has a custom function called simple_portfolio_get_projects() which just gives me an array of projects and I would like to be able to do the same with TCP products.


Whats the point of returning a value in AUTO_SAVE

> **Possible Duplicate:**   >  Return $post_id when DOING_AUTOSAVE?               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return $post_id;     }      I always see this in custom made themes, but is it really necessary to return a value if you're trying to get auto save to not do anything? why not just leave it empty or return false.


Custom media upload content for inserting custom post shortcode

I’m working on a plugin that creates custom post type “portfolio” along with shortcode to insert in any page or post. The shortcode is: `[portfolio option1=“1” option2=“0” option3=“1” ]` And it works just fine, it shows all custom posts via custom `WP_query`. But I want to go further. Create a custom button next to `upload media` for generating a portfolio shortcode output, where user can select which post to include and define all options. So the output would be: `[portfolio option1=“1” option2=“0” option3=“1” ids=“12,311,432,443,” ]` This is the code for a button I found in wp’s media.php:               add_action( 'media_buttons', array( $this, 'media_buttons' ) );          public function media_buttons($editor_id = 'content') {         $post = get_post();         if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )             $post = $GLOBALS['post_ID'];              wp_enqueue_media( array(             'post' => $post             ) );         $img = ' ';              echo '' . $img . __( 'Add Portfolio' ) . '';     }      And it does what does. But, now, what it the best way to modify the content of created window? Here’s a picture of how I see it, it’s better that any description: ![enter image description here](http://i.stack.imgur.com/XgJED.png) How potentially complicated and tricky this would be to accomplish? I do not know what direction should I look to, is that even possible? Please advise any suggestions where should I start digging for solution. P.S.: Or maybe I'm wrong in the first place and should consider using ThickBox? But I want to the keep native look of the media upload popup. Cheers! **EDIT:** Well, maybe a much better solution would be to use native gallery shortcode pattern. It not difficult to add a new menu item in the media upload window, as it explained for example here. So the final vision is something like this: ![enter image description here](http://i.stack.imgur.com/09O5e.jpg) ![enter image description here](http://i.stack.imgur.com/rbWaK.png) It must be done with Backbone.js I believe? But the main question, can it manipulate custom posts instead of images?


meta_query: using BETWEEN with floats and/or casting to DECIMAL

Each post has a lat/lng value attached to it via postmeta. I'm trying to grab all posts within a bounding lat/lng value. Here's the `get_posts` query:               $posts = get_posts(array(         'posts_per_page' => 100,         'post_type' => 'place',         'post_status' => 'publish',         'meta_query' => array(             array(                 'key' => 'places_lat',                 'value' => array($lat_min, $lat_max),                 'compare' => 'BETWEEN',                 //'type' => 'DECIMAL',             ),             array(                 'key' => 'places_lng',                 'value' => array($lng_min, $lng_max),                 'compare' => 'BETWEEN',                 //'type' => 'DECIMAL',             ),         ),     ));      Since postmeta values are stored as strings, I figured I should be casting to `DECIMAL`, but it just seems to trim the decimal value from the string due to the lack of `DECIMAL` arguments/precision parameters. I did notice the query treats the floats within the `value` array as strings, which could also be another point of failure. Running the compiled query without the quotes around each floating value works as expected. I'll be using `get_permalink()` on each post. I can run a custom query outside of `get_posts` (via `$wpdb->get_results()`) to properly grab the posts within the bounding box, then loop through the posts and `get_permalink`, but it ends up firing an additional database query per post to build the permalink - not an ideal solution! Any ideas?


How do I programatically remove Menus?

I know that each menu item is simply post present in `nav_menu_item` post type. It has has ID and can be removed with `wp_delete_post()` but posts deleted this way don't remove menus present under [Appearance > Menus]. Only menu items are removed. For instance I have "My Menu" under [Appearance > Menus] that has the following items: page-1, page-2, category-3. I can remove menu items with `wp_delete_post()` but "My Menu" (group for those items) remains intact. How can I programatically remove all defined Menus (and menu items)?


How do I switch my Wordpress to point to Parked Domain?

Bought some hosting with BlueHost, and when I signed up, I carelessly choose 'DekhoForum' as my domain name. I proceeded to setup a website with Wordpress 3.1 at the root folder of that address. Realised that my company had already reserved some domain names with a different provider, that were more suitable. So we got those domains forwarded to the BlueHost nameservers. So. I now have a parked domain for dekho.com.au as shown in my cPanel: ![BlueHost](http://i.stack.imgur.com/npKhe.png) If I hit the parked domain, it does take me to my Wordpress install. However, when I click on subsequent links, it will take me to URLs like:   _dekhoforum.com/page=1_   I would prefer it to retain:   _dekho.com.au/page=1_ How do I fix this? Seeing as I am still in the early stages of my development, I would like to iron this issue out from the beginning to avoid any headaches further down the track. I am not sure if this is something I should be changing under the Wordpress settings or something from within my BlueHost cPanel?


WordPress as a data-store?

I would like to use WordPress to not only run my site, but also to manage users, handle authentication, and read/write content via a client application, but I would like to avoid writing everything from scratch on the PHP-side, as I don't know PHP that well. Is there a "Services" plugin similar to that in Drupal, or something else that can give me easy access to using WordPress as a data-store for a client application? Thanks much in advance for all of your assistance!


Caching for logged in user and Ajax update

I would want to serve the homepage with a cached version of the page for both logged in and new users. And then to use Ajax to update the content appropriately, for example if the user had already vote up a post, the relevant button would be different than otherwise. As I am new to wordpress, I wonder is there any way or appropriate plugins to achieve this goal. Alternatively can I use Ajax to update only some part of the page, e.g. Post meta on the present page?


Customizing gallery shortcode in 3.5

I'm trying to customize the gallery shortcode using the new gallery system in 3.5 and I'm having a bit of trouble and can't figure out where I'm going wrong. This is what I've got at the moment **(in functions.php)** :               include( 'lib/theme-setup.php' );     include( 'lib/load-scripts.php' );          add_filter( 'post_gallery', 'my_custom_gallery', 10, 2 );     function my_custom_gallery( $output, $attr) {         global $post;              // 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'] );         endif;              extract(shortcode_atts(array(             'order'      => 'ASC',             'orderby'    => 'menu_order ID',             'id'         => $post->ID,             'columns'    => 0,             'size'       => 'medium',             'include'    => ''         ), $attr));              $id = intval($id);              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];             }         } else {             $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );         }              if ( empty($attachments) )             return '';              if ( is_feed() ) {             $output = "\n";             foreach ( $attachments as $att_id => $attachment )                 $output .= wp_get_attachment_link($att_id, $size, true) . "\n";             return $output;         }              $output .= '
';         $i = 1;              foreach ( $attachments as $id => $attachment ) :                  $attimg = wp_get_attachment_image( $id, $size );             $atturl = wp_get_attachment_image_src( $id, $size );             $output .= '';             $i++;              endforeach;              $output .= '
';              return $output;     }      Then I just have a simple custom page template that displays the gallery referencing 'the_content()' within the loop to output the gallery shortcode:               if (have_posts()) : while (have_posts()) : the_post();          the_content();      endwhile; endif;      The images show up, but for some reason the javascript functionality for the gallery does not work using it this way. The problem has to be with the shortcode because oddly enough, if I take out the loop in the custom page template and just add a function to retrieve the attachments of the page instead of using the shortcode, the javascript works and loads fine. The problem with this though, is that it pulls in all the images attached to that page, and I just want the ones that are in the gallery for that particular page which the gallery shortcode accomplishes. I really like the new gallery interface for 3.5 and would love to be able to implement this functionality for my galleries. Any advice on what might be causing this?


How to disable Page Attributes dropdown in wp-admin

As discussed at WordPress admin screen very slow / timing out when editing or adding a new page/custom post I am having a similar issue on a WP site containing 7,784 pages. Edit screens are slow loading due to the rendering of all 7k pages in the source code for the Page Attributes dropdown menu. Besides editing core, there must be a better way to deal with this. Seems like a flaw to render all pages on the edit screen. Feedback from others with high volume/traffic WP sites much appreciated!


How would I get a list of posts from a custom post type

I know the query method that you would use, that's not what I want. I could query the post type, then do the if statement with the while statement and go from there, but I am trying to populate a drop down with post titles. Thus I need an object. What I have, which isn't working - there should be two posts in this object but their isnt, it comes back NULL, is:               $args = array('post_type' => 'carousel', 'suppress_filters' => 0, 'numberposts' => -1, 'order' => 'ASC');     $content_block = get_post($args);          var_dump($content_block) // NULL      What would I do to get all the posts of the type `carousel`? which I know for a fact has 2 posts in it. I can go to `site.com/carousel/ctitle` to see `ctitle`'s content. But when I try the above I get `NULL`


Encode URL picked up by Digg Digg

I have found the following JavaScript to encode. It's just I don't know where to plug it into Digg Digg plugin.               encodeURIComponent(location.href)      How can I customize / modify Digg Digg plugin (Facebook share) so it will picked up URL by encoding first ?


Remove the deleted users avatar from list

## Problem Hi everyone, I have a bit of a problem. I have a function that outputs the avatars of users that follow me . It works great, but if the user is deleted the avatars remain visible as a blank image box with a broken hyperlink missing the users username. Is there any way to get rid of the deleted users avatar from the list? ## Function               function get_status_following($userid, $count = 0){          $followers = get_the_author_meta('following', $userid);          /** if no followers at the moment */     if( !is_array($followers)){         $return = "";     } else {              $return = '
' . "\n";         foreach( $followers as $folow){                  $return .= "
";                 $return .= '';                     if( get_the_author_meta( 'user_custom_avatar', $folow ) != "" ) {                         $return .= '';                     } else {                         $return .= get_avatar( get_the_author_meta( 'user_email', $folow ), '40' );                     }                 $return .= '';             $return .= "
";              }         $return .= '
' . "\n";     }          echo $return;          }      ## Outputing the function in a page               <?php printf( __(' %1$s', 'bo'), count_following($curauth->ID) ); ?>     <?php get_status_following($curauth->ID); ?>      Thank You for the help in advance


Multiple Taxonomy in URL/Query - No Custom Post Type

I have Volume and Issue as separate Taxonomies and all Posts have a Volume and Issue assigned. These posts are of post_type=post, not a custom post type. I linked to and queried for the Volume Taxonomy quite easily . However, I'm stuck when I need to make a URL and query for all posts which belong to Volume-X and Issue-X. I'd love for the url which lists all posts in Issue-X to be example.com/volume-1/issue-1 (i use _volume-1_ taxonomy term and _issue-1_ taxonomy term to perform a query) but cannot figure out how to do this. The query is not an issue, I can do a tax_query with 2 taxonomies, I just cant figure out how to rewrite my url to the appropriate place/page to do the query. How would I accomplish a url structure of example.com/volume-1/issue-1/ or example.com/volume1/issue/1 and have it list posts which have a taxonomy term of volume-1 and issue-1? Again, these posts are regular wordpress posts, not custom_posts. Hopefully, an answer would allow for pagination as well? i've been struggling with this for a week or so, really need to put this one to bed :(               function add_custom_taxonomies() {               // Add new "Locations" taxonomy to Posts     register_taxonomy('volume', 'post', array(     // Hierarchical taxonomy (like categories)     'hierarchical' => false,     // This array of options controls the labels displayed in the WordPress Admin UI     'labels' => array(     'name' => _x( 'Volume', 'taxonomy general name' ),     'singular_name' => _x( 'Volume', 'taxonomy singular name' ),     'search_items' =>  __( 'Search Issues' ),     'all_items' => __( 'All Issues' ),     'parent_item' => __( 'Parent Volume' ),     'parent_item_colon' => __( 'Parent Volume:' ),     'edit_item' => __( 'Edit Volume' ),     'update_item' => __( 'Update Volume' ),     'add_new_item' => __( 'Add New Volume' ),     'new_item_name' => __( 'New Volume Name' ),     'menu_name' => __( 'Volume' ),     ),     // Control the slugs used for this taxonomy     'rewrite' => array(     'slug' => 'volume', // This controls the base slug that will display before each term     'with_front' => false, // Don't display the category base before "/locations/"     'hierarchical' => false      ),     ));          register_taxonomy('issue', 'post', array(     // Hierarchical taxonomy (like categories)     'hierarchical' => false,     // This array of options controls the labels displayed in the WordPress Admin UI     'labels' => array(     'name' => _x( 'Issue', 'taxonomy general name' ),     'singular_name' => _x( 'Issue', 'taxonomy singular name' ),     'search_items' =>  __( 'Search Issues' ),     'all_items' => __( 'All Issues' ),     'parent_item' => __( 'Parent Issue' ),     'parent_item_colon' => __( 'Parent Issue:' ),     'edit_item' => __( 'Edit Issue' ),     'update_item' => __( 'Update Issue' ),     'add_new_item' => __( 'Add Issue Volume' ),     'new_item_name' => __( 'New Issue Name' ),     'menu_name' => __( 'Issue' ),     ),     // Control the slugs used for this taxonomy     'rewrite' => array( 'slug' => 'issue', 'with_front' => false )               ));      } add_action( 'init', 'add_custom_taxonomies', 0 );


Determining Slug Before and After Edit

If I were to edit a post or a page, how would I determine what the slug was before the edit, and again afterwards to compare them and see if it was changed? Also, would the same method work for any Custom Post Types created, or is that done differently?


Smart post format loop problems

Hi i'm trying to adopt the `get_template_part()` method for looping post formats as in:               if ( have_posts() ) :         while ( have_posts() ) : the_post();             if( ! get_post_format() ) {                 get_template_part( 'format', 'standard' );             } else {                 get_template_part( 'format', get_post_format() );             }         endwhile;     endif;      The theme i'm developing from see files has an `index.php` file with the following calls               <?php     /**      * @package WordPress      * @subpackage WP-Skeleton      */              get_header();  //the Header              get_template_part( 'menu', 'index' ); //the  menu + logo/site title               get_template_part( 'loop', 'index' ); //the Loop                get_template_part( 'sidebar', 'index' ); //the Sidebar               get_footer(); //the Footer           ?>      loop.php is the main loop. I'm not sure if I have to modify the index.php or loop.php files. I realise I have to create `format-audio.php`, `format-video.php` etc. for my various formats. Whenever I try to get this going I get a continous loop of my posts. Any help explaining this would be appreciated. Many thanks


Custom shortcode that writes to file

I'm trying to maybe do too much in a shortcode call. Here's the code I have:                       //[rand]     function randnumber_func( $atts ){      $digits = 4;      $randnumber = rand(pow(10, $digits-1), pow(10, $digits)-1);      $space = "\r\n";      $myFile = "offer_codes.txt";         $fh = fopen($myFile, 'a+') or die("can't open file");         $stringData = date("F j, Y, g:i a") . " - " . $randnumber;         fwrite($fh, $stringData.$space);         fclose($fh);      return $randnumber;     }     add_shortcode( 'rand', 'randnumber_func' );      I want to create a random 4 digit number and have it printed to the page. I also want to take that random number, append the date to it, and have that written to a text file. It works in PHP, but not when I call it via a shortcode. Is something it Wordpress stripping it out or do I have it written incorrectly for the shortcode function?


List Categories (wp_terms) and count posts

I have a problem (of course) and I'll go straight to the point: I need to list all the custom categories and count the posts for each category eg.   * Category 1 (xx posts)   * Category 2 (yy posts)    * etc.. I tried a couple of queries but with no luck. All these categories are stored in the wp_terms table, how do I list them since I've seen that there isn't, apparently, any elations between wp_terms and the posts?   Worthless to say that i've tried wp_list_categories but it shows just "Uncategorized" since the website I'm using, uses custom post rather than "default" categores. Thanks in advance!


"Duplicate" Posts Appearing Since 3.1.2 Update

I've encountered some issues on a clients site since upgrading to WP 3.1.2, and have this evening updated to version 3.1.3, only to find that the problems still persist. http://www.harmonyreins.com.au The website is for a local animal shelter, and each post represents a different animal that lives at the shelter. There are a number of categories that specifically relate to the type of animal, such as dogs, cats, horse as well as a "recently adopted" and an "old friends" category. Those last two categories were excluded from the full post list (under 'Meet The Gang' in the navigation) using the following code:               <?php query_posts($query_string . '&cat=-10,-12'); ?>      The upgrade to WordPress 3.1.2 (or the accompanying database update, I'm not sure which) made this code redundant, and the excluded posts began appearing in the 'Meet The Gang' section. I enquired about the issue on WordPress.org, and the following fix was suggested: > Chris, > > Replace the following in your theme's index.php >   >   >     <?php query_posts($query_string . '&cat=-10,-12'); ?> >     <?php if (have_posts()) : ?> >     <?php while (have_posts()) : the_post(); ?> >   > > with >   >   >     <?php query_posts('cat=-10,-12'); ?> >     <?php if ( have_posts() ) : while  ( have_posts() ) : the_post(); ?> >   > > and you should be good. Unfortunately this resulted in another issue, displaying the posts from page one of the list on page two also (you can see what I mean if you go to the site). I've tried multiple pagination plugins with no success. Regardless of what page you're on, only the first ten animals are displayed. My client has been really good regarding this issue, but it's been going on for weeks now, and I really need to get it solved. Hoping someone can help me out. :-)


FB like adds WordPress install screen text to the wall

I have a site for a client that is behaving very strangely. You can view the site here http://cruisephotofactory.com When you click the like button in the sidebar instead of using the open graph values the site gives, FB posts the text from the WordPress install screen. This text is 100% not on the site anywhere and anyway the only time it appears is during install, when obviously the FB button was not yet installed or active. I have the same site, same code, same theme, same everything installed on a second domain http://cruisephotofactory.it and here I would expect the same thing to happen, only it doesn't. instead it seems to post the wp object on the FB wall. If I clone the site to a different domain on a different server, everything works fine the problem only seems to be happening on these 2 domains. I am sure it has to be something blindingly obvious I am missing and I am going to feel really stupid when its pointed out, but blasted if I can figure out how 2 different, repeatable outcomes are happening with the same code and how its getting the install text in the first place!


CDN: Origin server URL, WordPress Core files installed in sub-directory

I've just purchased a plan with MaxCDN to deliver my content through CDN, but i've got a small issue before i create a pull-zone. I moved my WordPress core files out of my root and into a sub-directory. These are my current settings: WordPress address URL: `http://example.com/wordpress` Site address URL: `http://example.com` The question is whether i should have my Origin Server URL and custom CDN domain name according to my WordPress address or site address. Here is the tutorial I'm currently following, in case you need to view the MaxCDN dashboard. Thanks in advance.


Code for Category, Tags, Archive URLs

Working on an SEO plugin and stuck on something I thought would be simple. Looking for code to generate just the URLs for categories, tags, search, and date archives when on that archive set. So if on category ABC there's the URL to www.domain.com/category/abc/ Was hoping it was something simple like this for the categories part:               echo get_category_link($cat->term_id);          or          echo get_category_link($category->term_id);      but apparently not. The general code works if I add a specific category               echo get_category_link(123);      The plugin adds code to the head via wp_head() The plugin (if I ever finish it) will be a replacement for so called SEO plugins that use noindex and nofollow to 'sculpt' PR/protect link benefit. Noindex wastes link benefit, nofollow deletes link benefit so they shouldn't be used. David


'Global' settings page for multisite plugin

I'm working on a plugin that will be installed in a multisite instance. How do I create a single settings page that is visible at the "Network admin" level only - most of the guides i've seen relate to a standard blog level plugin. Any links to information would be useful, otherwise I'll just end up going through sitewide tags to see how it's being done there. [Update] Looks like sitewide_tags uses `add_site_option`, `get_site_option` and `update_site_option`, and these functions use wp_sitemeta. However, from what I can see, there's no support for register_setting, add_setting, etc, so you have to get and set your options manually.


Wordpress Custom Post Types with a page as a parent?

I have a lot of custom type items in my new WP project, and for navigation reasons, I want to make the parent to some of them a Wordpress page. The problem is that apparently, Wordpress does not let you establish parent-child relationships between items with different post type. Is there anyway to override this? I am using Wordpress 3.1


How to display all custom fields associated with a post type?

What is the best way to display/dump **all** custom fields associated with a post? It doesn't have to be pretty, I just need to verify what is being saved in what field array for debugging. Thanks!


woocommerce - How Can I add author metadata for a product?

Hi I am using woocommerce with Mystile Theme for a book store. How Can I add author taxonomy for a product? I need to set an author for every book I am selling and possibly to search trough, author, categories, product names and tags.


Display posts between two particular dates

I have this code for display posts between two particular dates:               $s = '2011-10-23';     $e = '2011-11-17';          function filter_where($where = '') {             $where .= ' AND post_date >= $s AND post_date <= $e';         return $where;       }     add_filter('posts_where', 'filter_where');     query_posts($query_string);      But that's not work until change to this:               function filter_where($where = '') {             $where .= ' AND post_date >= '2011-10-23' AND post_date <= '2011-11-17'';         return $where;       }     add_filter('posts_where', 'filter_where');     query_posts($query_string);      What's wrong in first code?


Best way for a plugin to define a custom post type archive template?

I'm working on a plugin which registers a new post type, and I want to be able to define a default loop for the archive page. I've been trying to brainstorm the best way to do this, and I keep coming up short. Basically, what I need to do is this: My post type should display in archive pages as title, excerpt, and custom field only. I also need to run certain filters on the archive page. I've been asking users to create their own archive-{myposttype}.php file, but that is a little over the heads of casual site owners. So, thoughts I have had include:   * Creating my own template file that I load on the template_redirect hook... probably out, as there's really no way to generate the correct markup for a given theme.   * Trying to save a new file on plugin activation by some crazy regex processing of existing template files... I think that it might be possible, but I feel like I must be doing something wrong.   * Asking users to choose an existing page to hold the archive for my custom post type, then using the_content filter to output my archive... which is very doable, but then I have to hack the query a good deal, and I end up breaking the is_query conditionals and so on... This question may be too subjective to provide a good answer to, but I'd like to hear any thoughts on it.


Use Author Ids or Names to echo different output inside loop

Is there a way to use the author ids (or names) to echo different output for different authors (in this case author id 7 and author admin? I tried the following but it didn't work.                   ?php if (get_the_author_meta(7)) {echo '<a href="<?php the_permalink(); ?>" >';           echo'<?php echo get_post_meta($post->ID, "Thumbnail", true);?>'; echo '';} else {         echo '<a href="<?php the_permalink(); ?>" ><img src="<?php echo get_post_meta($post->ID, "Thumbnail", true);?>"/>';  } ?><?php  ?>


Is it possible to create a post using a metabox?

I am trying to create a post (well, in the end, multiple posts) from a metabox using the 'save_post' hook. I executed the script once, creating 3900 or so new posts before I crawled into posts.php and discovered that wp_insert_post() calls the 'save_post' hook. Does anyone have a creative solution around this to create the post without doing a direct db insert (the less hacky the solution is the better). # Code               add_action( 'add_meta_boxes', 'my_metabox_init' );     add_action( 'save_post', 'my_metabox_save' );     function my_metabox_init()     {         add_meta_box(             'my-metabox',             'My Metabox',             'my_metabox_render'             'post',             'normal',             'core'         );         //enquque scripts and styles     }     function my_metabox_render() {         //generate datasets     }     function my_metabox_save() {         //data authenticity check         //process & sanitize data              //create posts         for( $i=0; $i<$count; $i++ ) {             $args = array(                 'post_status' => 'pending',                 'post_title'  => $_POST['post_title'][$i],                 'post_type'   => 'custom_post_type',             );             foreach( $category_array[$i] as $category ) {                 $args['tax_input']['custom-taxonomy'][] = $category;             }             if( $_POST['id_of_previously_created_post'][$i] != '' ) {                 $args['ID'] = $_POST['id_of_previously_created_post'][$i];                 unset( $args['post_status'] );             }             $new_post_id = wp_insert_post( $args );         }     }      Thanks!


How to group non-hierarchical tags?

Similiar to category drop down box for a list of terms with the same parent, I want to make such a drop down for a list of tags with the same group name( or some other conditions that works). Seems WP doesn't provide a way to use term group, any other way to make the drop down ?


Unwanted Links and Spam Wordpress Pages and Posts

In webmaster tools I have a number of crawling errors of the Google spider. for example http://mydomain.com/my-page/de/roulette.html They say they cannot crawl to this page.. but what kind of page is this ? what is /de there ? I checked the link and my site says the page doesn't exist. Then i just noticed that my "Akismet" is not activated... So i will activate it now and how can i remove that extra link in my site?


custom post type or taxonomy, which approach is better?

I have a custom post type where i need a field called country along with its flag. Now i am divided in between two choices: [1] to create a custom post type called country with title(name of country) and featured image(flag) ... or [ 2]. to register a taxonomy called country and add a custom field in the taxonomy called flag with type image(using plugin like taxonomy manager) I would like to use your expertise to make this important decision which one would be a better practice and more convenient and efficient as well. thanks in advance!


Wordpress “Categories to tag converter” not working on imported Blogger posts

I just imported a blog from blogger to wordpress recently. The blog consisted of about 3500 tags in total. On importing them into wordpress, they were converted to categories for some reason. I have installed and the **categories to converter** plugin by wordpress that allows you to convert them to tags. On the converter page, i have checked all the categories (using the **check all** button) then clicked on the **convert to tag** button. However, after waiting for the conversion to take place, the page refreshes and goes back to exactly how it was before i clicked on the button, i.e, nothing is converted. Tried it several times and even uninstalled and re- installed the plugin, but no luck. Was wondering if someone else has had the same problem and resolved in. I'd appreciate any help Many thanks in advance.


Deleting a custom field field

Is there a way to delete a custom field (in the sense of complete removal from WP database) without using a plugin?


Get the <!--more--> link text

How I can get the link text is using WordPress? By default is something like:               Read More →      buy I want to get that value in a variable because some WordPress installation can have that value customized (using filter the_content_more_link) or in another language. In resumen: what I need is to get from WordPress the text (the HTML code) that WordPress uses to replace the when display a Post Content.


how can i hide category?

Please help me I am new baby in wordpress, how can i hide that 'course or call' category from the page.. i have var dump the variable which is passing as parameter to query_post                       $args = jr_filter_form();             var_dump($args);             query_posts($args);      ![enter image description here](http://i.stack.imgur.com/6y4CR.png) this category is having tag_ID="65" in its url , which i have seen in wordpress dashboard, job category page please help me a little thanks


Enqueue AWS Script

I am working on the integration of an Amazon Webstore (Amazon Checkout) on a WordPress site using Amazon Documentation here. Has been a while since I worked with enqueueing external JScripts. I need to load two scripts from Amazon. I added some code to functions.php, but I seem to have made a mistake and I keep on getting errors such as:               TypeError: 'undefined' is not a function (evaluating '$(jQuery(document).find("#globalParameters"))').       On merchant_cart.js:5 Here is the code:                   function img_scripts_with_jquery()     {         // Register the script like this for a theme:         wp_register_script( 'aws-cba', 'https://images-na.ssl-images-amazon.com/images/G/01/cba/js/common/cba_shared.js',  array( 'jquery' ));              // For either a plugin or a theme, you can then enqueue the script:         wp_enqueue_script( 'aws-cba' );         //second script             wp_register_script( 'aws-merchant-cart', 'https://images-na.ssl-images-amazon.com/images/G/01/cba/js/shoppingcart/merchant_cart.js',  array( 'jquery' ));              // For either a plugin or a theme, you can then enqueue the script:         wp_enqueue_script( 'aws-merchant-cart' );     }     add_action( 'wp_enqueue_scripts', 'img_scripts_with_jquery' );      What coding mistake am I making here? is the enqueueing of these two external scripts in need of jQuery OK? **Update** Loading scripts in footer makes things better, but when I added the button to load the cart I still got the same error. Current script is now:               /Enqueue AWS Scripts          function img_scripts_with_jquery()     {         // Register the First Script:         wp_register_script( 'aws-cba', 'https://images-na.ssl-images-amazon.com/images/G/01/cba/js/common/cba_shared.js',  array( 'jquery' ),'version', true );              // Enqueue it:         wp_enqueue_script( 'aws-cba' );         //Register Second Script             wp_register_script( 'aws-merchant-cart', 'https://images-na.ssl-images-amazon.com/images/G/01/cba/js/shoppingcart/merchant_cart.js',  array( 'jquery' ), 'version', true);              // Enqueue this one too:         wp_enqueue_script( 'aws-merchant-cart' );     }     add_action( 'wp_enqueue_scripts', 'img_scripts_with_jquery' );      **Update II** Firebug described the error as follows:               TypeError: $ is not a function     https://images-na.ssl-images-amazon.com/images/G/01/cba/js/shoppingcart/merchant_cart.js?ver=version     Line 5      Seems like a jQuery conflict..


Custom Post Type Link from Plugin

I'm currently working on a plugin that creates a custom post type. The issue I'm strugging with at the moment is that the custom post type is created fine, but when I go to add a new post I receive an "Invalid Post Type" error. The ui is hidden and I'm trying to link to it from add_submenu_page. I need assistance for how to properly link it. Here is what I have in the submenu declaration:               add_submenu_page( 'restaurant-orders', 'Menu Management', 'Menu Management', 'manage_options', 'edit.php?post_type=menu-item');      My post type:               function restaurant_menu_items() {              $labels = array(             'name' => __('Restaurant Menu Items', 'post type general name'),             'singular_name' => __('Restaurant Menu Item', 'post type singular name'),             'add_new' => __('Add New', 'product page'),             'add_new_item' => __('Add New Menu Item'),             'edit_item' => __('Edit Menu Item'),             'new_item' => __('New Menu Item'),             'view_item' => __('View Menu Item'),             'search_items' => __('Search Menu Items'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => false,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail'),           );               register_post_type( 'menu-item' , $args );     }      I can add a new post if I show the ui and do it the conventional way. However I do not want it this way, the post menu has to be under the plugin menu. Thanks!


How to filter the taxonomy terms based on another taxonomy term

I have created a custom Post Type called "Tour" which Holds up-to five Taxonomies called "destination", "Types", "Month of Travel", "Year of Travel" and "Led by". Now I brought them as drop-down category using "wp_dropdown_categories" - (each of the taxonomy were listed as drop down). and search term works fine in the combinations (if exist). for example:: I am searching for "destination" as "Bangalore" and "Month of travel" as "June" combination works as post were chosen on particular terms. ~ it's perfect. But, when there is no post chosen for a category / no search combination avail... It triggers "No post available". ~ its a common things in word press. So I prefer to filter the TAXONOMIES based on the Previous TAXONOMIES (Its little confusing while relating them). Here is the main concept: If I choose the "destination" as "Bangalore" I need the "Type" to be filtered based on the destination. that is Bangalore can have only two types "A type and B Type" rest of the type should be ignored. - (Once again all the five thing comes as Taxonomies). I want something like this![enter image description here](http://i.stack.imgur.com/UxhAV.jpg) if post_type=tour&tour_destination=bangalore filter the other taxonomies with relevant terms? Help me ~ thanks in advance dev


Don't submit post if post title exists

I am using the `User Submitted Posts` plugin which I love. The only problem with this plugin is that it does not check for **duplicate post titles** and outputs a post with the same title, even if it already exists. **So I want to know: how can I check if someone clicks on the submit button, if a post with the same title exists and give them a`404 error`**? Is this even possible? PS: it would be even better that if the post with the same title exists, the submitted would be a comment beneath that post, but I guess that's utopia. I already tried                   if (is_null(get_page_by_title( $content['title'], OBJECT, 'post'))) {          // Do your stuff in this case (no post with the same title)          }          else {          // Do not create post          }      and               jQuery(document).ready(function($){     var titleArray = $('.row-title');     for (i=0;i<titleArray.length;i++) {             var thisTitle = $(titleArray[i]).text();             for (j=0;j<titleArray.length;j++) {                 if (thisTitle == $(titleArray[j]).text() && i < j ){                     $('input',$(titleArray[j]).parent().parent().parent()).attr('checked', true);                 }             }         }     });      But it did not do what I wanted.


Posts with at least 3 tags of a list of tags

There is a set of tags against which posts that have at least 3 of those tags should be matched. Say there is the tags {foo, bar, chocolate, mango, hammock, leaf} I would like to find all posts with at least 3 of these tags. For example, a post with tags {foo, mango, vannilla, nuts, leaf} will match it because it has {foo, mango, leaf}, so at least 3 tags from the needed set of tags. So it would be in the list of the matched posts. Is there a simple way to do that, without doing multiple loops through all the posts ?


Wordpress : Cannot Get User id after login success in file wp_login.php

I have a problem when I want to get user id WordPress after login in file `wp_login.php`, I tried to insert some code in this file, after line `wp_safe_redirect($redirect_to);` in login case. I must get user id after login to update my custom WordPress table.               session_start();     require( dirname(__FILE__) . '/wp-load.php' );     global $wpdb;          $session_id     = session_id();      $current_user   = wp_get_current_user();     $id_user        = $current_user->ID;          $wpdb->query(          $wpdb->prepare("UPDATE wp_shortlist SET id_user='$id_user' WHERE id_session='$session_id' ")     );      any idea to get user id after login in file `wp_login.php`?


Wordpress admin panel is blank

When i logged in wordpress admin, the dashboard looks a blank page. Only left side navigations are visible. What might be the problem? Can any one me give solution or idea?


How do I export my WordPress blog as a book?

I want to export some or all of the posts of a blog into a format that makes sense to a publisher (traditional or self-publisher(e.g.: Lulu.com)) (MS Word, RTF, PDF, epub, something else). What tools are available to accomplish this?


Max number of multisites

Does anyone know of any max number of WP multisites or performance issues with having many? Thanks!


How to let users choose posts order in categories?

Hi to all I'm running a wordpress based website and I need to let the users choose how to show the posts inside categories pages. I would like to have a button inside a category page that can be clicked so the reader can choose if he wants to see posts ordered by date or from A to Z or from Z to A. Is there anyone who can tell me how to achieve this? Please explain it like if you are speaking to your 12 years son :-) I google a lot about this and I've never found nothing that I can copy/paste into my code or that I can modify. I can't understand how to do this... any solution?


Use wp_list_categories to list parent categories from actual term

I currently have a taxonomy called wpsc_product_category. Under that taxonomy I have several terms used as sub-categories, and finally each sub-category has a number of products. I'm trying to use wp_list_categories to show an ul starting from the parent category of the current product your are viewing. ¿Is this possible?               <?php              $taxonomy     = 'wpsc_product_category';     $orderby      = 'name';      $show_count   = 0;      // 1 for yes, 0 for no     $pad_counts   = 0;      // 1 for yes, 0 for no     $hierarchical = 1;      // 1 for yes, 0 for no     $title        = '';     $child_of     = $actualcategoryparentid          $args = array(       'taxonomy'     => $taxonomy,       'orderby'      => $orderby,       'show_count'   => $show_count,       'pad_counts'   => $pad_counts,       'hierarchical' => $hierarchical,       'title_li'     => $title       'child_of'     => $child_of     );     ?>          <ul>     <?php wp_list_categories( $args ); ?>     </ul>      I thought of something like this, but I don't know how to retrieve $actualcategoryparentid. Any ideas? Thanks!


Help integrating Custom post type meta field with custom profile fields

I have a custom post type for "locations" and I need to have "users" log in and be able to pick a location that is within a certain distance from them. I have added some spots to the profile using update_contact_methods() to get an address etc, and the location custom post type I am using the Custom- Metaboxes-and-Fields-for-WordPress to add specific fields for address information etc. I am simply not sure of how to achieve what I need to and am hoping for some input. I need to get it working quickly so I am more concerned with at least a proof- of-concept approach then the most performant. My initial thought was to use Google Maps API distance matrix, https://developers.google.com/maps/documentation/javascript/distancematrix but I am not sure if that is a good way to go... A thought was to have a page that is clickable once user is logged in, that would, upon navigating to it, would need to iterate through each "location" custom post and compare its address as destination and the logged in users address (pulled from profile) as origin, and discard the post if > (greater than) x hours. Does that make sense? I would really appreciate any help you all may have to give, I have confused myself into a corner. Thank you!


Shortcode: display list of created shortcode in popup

I want to create a popup shortcode in admin panel. I already create the shortcode button and a popup on button click. I want to display in the popup (not in the shortcode button), all my custom shortcodes that I have created in a dropdown list. I really don't know how to get my shortcodes name with a loop like this for example:               <tbody>     <select id="shortcode-generator-select">     <option value="raw"></option>     <?php foreach( $shortcode as $shortcode ) : ?>     <option value="<?php echo $shortcode['name']; ?>"><?php echo $shortcode['title']; ?>    </option>     <?php endforeach; ?>     </select>     </tbody>       I just want to understand what is the way to create a popup shortcode generator.


All blog posts are not showing up

This post may already exists but I just missed it in how I searched for it. Here goes. I have recently changed my blog back to the Genesis Framework. I am using the Nameless child theme. These are my issues:   1. The only way the front page shows up correctly is for me to select "Show latest posts" in the Settings---->Reading section   2. Only my posts are showing up and not those of the other authors. I created a page called "Blog" and entered the code below, but it still only shows my posts. My template file:               <?php     /*     Template Name: Blog     */     get_header();          $args = array(         'post_type' => 'any', #all post types         'posts_per_page' => 10 #get 10 posts     );     $query = new WP_Query( $args );     if($query->have_posts()):       while($query->have_posts()):         $query->the_post();         the_title(); #display the title       endwhile;     endif;          get_footer();      In the author box I see where different authors can be chosen by the post, but I need all posts by all authors showing up in the listing. Any help would be greatly appreciated. Here is a link to my site, if that helps: http://fullfigureplus.com


Proper way to add a button to the top menu of the media library?

I want to add a simple button to the Media Library top menu (say, to the right of the bulk actions / filters dropdowns. I have scoured the WordPress codex for a proper way to do this and have found nothing useful. So before I start attacking this problem with Javascript, I wanted to ask the community if there's a proper WordPress API way of doing this - along the lines of `manage_media_columns` and `manage_media_custom_column`. Thanks everyone!


I have a plugin which throws the error "Warning: Variable passed to each() is not an array or object in /...../wp-content/plugins/page-scroll-to-id/malihu- pagescroll2id.php on line 174" and at line 174, it says               `   while(list($var, $val)=each($pl_instances)){                     add_settings_section(                         $this->db_prefix.'settings_section'.$this->index,                         null,                         '__return_false', // instead of null to avoid wp <3.4.1 warnings (https://core.trac.wordpress.org/ticket/21630)                         $this->plugin_slug                     );`      The plugin is not modified, i did google on the error, but found nothing. I am new to php. so don't know much what's going in the code that is showing error.


How to add data from wordpress tables to new database tables you have created

I'm just learning this database stuff and so I am a bit confused and was hoping someone could push me in the right direction. I have managed to create users in the wp_tables I have created in my database. ![enter image description here](http://i.stack.imgur.com/0lLCY.png) Here are my specific questions.   1. What I am wondering is how do I link the hm_tables with data from the wp_tables. Wouldn't I need to insert a foreign key (i.e email address from wp_users) into the hm_tables. Because, otherwise I won't know which hm_account is linked to which wp_user? Is this dumb? And if so, HOW?   2. Also, I have become familiar with using WPDB commands, but when playing around with the hm_tables can I use $wpdb or do I need to use straight SQL commands.  Can you please give explicit instructions or examples as I get very lost at this early stage. I have read around but can't seem to find something that explains this at a level I can understand (which at this stage is quite low).


Get custom posts with certain ids in a custom loop using a shortcode

So I'm using custom loop and shortcode to insert it in any page. Like this:               function register_custom_shortcode($atts){              extract(shortcode_atts(array(             'ids' => '', // this is what I need             ), $atts));              $cutom_loop = new WP_Query( array(              'post_type' => 'cutom_post',             'orderby' => 'menu_order',             'order' => 'ASC'             ) );              ob_start();                   while ( $cutom_loop->have_posts() ) : $cutom_loop->the_post(); ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(''); ?>>              // post thumb, title and so on              </article>              <?php endwhile;                   wp_reset_postdata();         $content = ob_get_contents();         ob_end_clean();         return $content;     }          add_shortcode( 'custom_loop', 'register_custom_shortcode' );      How shoud I handle this ids to have shortcode like this: `[custom_loop ids="112,93,34,91"]`? **EDIT:** Ok, if i add `'post__in' => array(189,173)` to new WP_Query it will output only this two posts, but still can't figure out how to grab this ids from shortcode.


How do you store options with a:n:{{}} syntax in wp_options?

I'm checking out how a particular plugin works and noticed that it stores its data for option_value in wp_options in this array format... **a:2:{i:20;a:2:{s:8:"original";s:15:"20.original.jpg";s:9:"thumbnail";s:12:"20.thumb.jpg";}i:8;a:2:{s:8:"original";s:14:"8.original.png";s:9:"thumbnail";s:11:"8.thumb.png";}}** I like this method, since it only uses a single row to hold my custom data, uninstall cleanup is easy. Is there a standard way to do a get/set operation on a custom field that results in this syntax? Update: Thanks to Denis and the others who've added responses. Here's an excellent tutorial on this method in case anyone else has this question > http://striderweb.com/nerdaphernalia/2008/07/consolidate-options- with-arrays/


How to exclude content (and other returned values) from WP_query()?

Does a method exist that can return a simple array of the pages in the site that are published? I only want the name and the slug returned, not the full content or other default values. I've tried WP_query(), get_posts(), get_pages() and query_posts() but they all return the post/page content. I'm only looking to get the post name and slug returned. If there's no lighter method, I can use one of these. Just want to make sure. Any help, much appreciated.


Where is the logic that defines the excerpt?

I'm trying to learn HOW to learn about WordPress by following its source code etc. I'm really stumped at the_excerpt(). Documentation states that the_excerpt uses get_the_excerpt(), and will return either the (manual) excerpt, or will use the first 55 characters of the_content. I'm interested in the logic that looks first for the manual excerpt and then decides whether it needs to go in and extract a substring from the post content. But I can't find it. In post-template.php, we see the_excerpt() and get_the_excerpt() defined. the_excerpt() does nothing more than echo out get_the_excerpt():               249 function the_excerpt() {     250         echo apply_filters('the_excerpt', get_the_excerpt());     251 }      get_the_excerpt() seems to do nothing more than grab the post_excerpt column from the wp_post table:               261 function get_the_excerpt( $deprecated = '' ) {     262         if ( !empty( $deprecated ) )     263                 _deprecated_argument( __FUNCTION__, '2.3' );     264      265         global $post;     266         $output = $post->post_excerpt;     267         if ( post_password_required($post) ) {     268                 $output = __('There is no excerpt because this is a protected post.');     269                 return $output;     270         }     271      272         return apply_filters('get_the_excerpt', $output);     273 }      I don't see where the logic to grab $post->post_content resides. Is it in the filters? I can't see those filters defined anywhere, but this may be because I just don't know where to look. A cursory glance at Adam Brown's source code search site doesn't seem to be turning up any definitions either. Can someone help me pick up the thread and figure this out? Remember, I'm more interested in how to figure it out than I am in the actual answer. I appreciate everyone's input. Tom


How to open a lightbox form from a navigation menu item

I want to add a custom menu item to the main navigation menu, On clicking this item I want to open a lightbox form. I have the form-shortcode ready to be placed but on a page but I don't know how to do this in the main navigation menu, i have used cforms-II for the form and lightbox form to display it in lightbox modal. please help. i'm using wordpress 3.5 Note: I may need to change my theme in recent future so I would like the solution to programtically do this.Thanks. Edit: I'm trying to use the following code: `add_filter()` to add menu item, and for light box form i have this code:               add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );          function my_custom_menu_item ( $items, $args ) {         if (is_single() && $args->theme_location == 'primary') {             $items .= '
Show whatever
';         }         return $items;     }          [formlightbox_call title="Get free quote" class="4"]here[/formlightbox_call]     [formlightbox_obj id="4" style="padding: 10px; width:350px"][contact-form-7 id="848" title="Contact form 1"][/formlightbox_obj]


Adding short codes from a page's content on header and hiding the same from page's content

I have created a page and added the following shortcode from wp-orbit-slider                [orbit-slider category="test"]       I want the contents of                [orbit-slider category="test"]       be displayed on the header part, instead of on the content area part, which the wordpress usually does . I tried adding the the short code on header.php and it works, but the same content will be duplicated on the content area also. I need to avoid this. How can this be achieved ?


Add button to TinyMCE bar without creating a plugin

I'm trying to add a custom button or two to the TinyMCE rich text editor. The tutorials I've seen so far are either outdated or explain how to do it with a custom plugin. How can I do this without creating a plugin, perhaps in the `functions.php` file instead? To be specific, I want to add a "h2" button that will add in a `<h2></h2>` into the body.


Updating a live theme safely?

Apologies for the general question, but I spent some time looking for an answer and couldn't find anything. I often find myself in a situation where I need to make tweaks to a live site based on a client's feedback after going live, so I'm wondering the best way to quickly make changes on the live site without disruption. Presumably it's possible to duplicate the live theme, rename it in style.css so that it's considered a 'new' theme yet still uses the same database etc. and then work on that? The question is, how would I view that new theme and then switch to it once all updates are done? One day, I'll need to get my head around GIT as from what I've heard that would solve this kind of problem in a very safe way.


Register widget only page is a singular of custom post type

I've made a custom post type, with a few accompanying widgets, and I was wondering if it is possible to show (some of) these widgets only if you're on a specific page. Currently I've got               function widget($args, $instance)     {         global $post;         $links = unserialize(get_post_meta( $post->ID, 'links', true ));              if(!is_singular( 'press_articles' ) || $links == false) {             unregister_widget( 'Point72_Press_Article_Links_Widget' );             return false;         }              // widget stuff     }      But, that doesn't seem to completely remove it, and with that I mean, it removes the widget in the right places, but the positions for the widgets stay even if it's not empty. So, is there anyway to either remove the empty positions, or not show it at all outside a custom post type?


Warnings in nav-menu when visiting query pages

Using query-wrangler, similar to drupal's views, I created some query pages. When I visit these pages, in the top-navigation-menu there is this warning:               Warning: in_array() expects parameter 2 to be array, null given in /.../wp-includes/nav-menu-template.php on line 425      The line cited by the warning is inside the ancestral post object wich I fully report here:               // ancestral post object     (         'post_type' == $parent_item->type &&         ! empty( $queried_object->post_type ) &&         is_post_type_hierarchical( $queried_object->post_type ) &&         in_array( $parent_item->object_id, $queried_object->ancestors ) &&         $parent_item->object != $queried_object->ID     ) ||      Line 425 is the one starting with `in_array(` The top-navigation-menu items are not related with the query pages. Are simple pages, some of them childpages. I really don't know how to fix this warning, because I don't understand to what is related.


Check if taxonomy is attached to at least one post in a post-type

To check if at least one post in post-type `products` has the `led` term I usually do this:               $query = array('numberposts' => 1, 'post_type' => array('products'), 'television' => 'led');     $products = get_posts($query);          if ($products) {     echo 'At least one post has the term led';     } else {     echo 'No post with the term led';     }      Is there a better way?


how can i display all youtube videos from a users youtube account

I want to display all recently uploaded youtube videos from my youtube account as a widget on the right side of the page. Just like how technobuffalo.com has done. Is there such a plugin that will do this? ps: as for what I've tried, i have searched on wordpresses plugin pages and all i see are plugins that allow me to add a short code for the video as a post. But this isnt what i want. I just want to display all recently uploaded videos automatically on the right side just like technobuffalo.


archive-{post_type}.php is defaulting to category.php vs. archive.php on category searches

I am using `archive-{post_type}.php` for queries of a custom post type. I want the system to use `archive.php` for category searches but it is defaulting to `category.php` which I am using for category searches (different categories) for regular posts. Does anyone have an idea of what could be going wrong?


Create thumbs only when a post is sticky or any other way?

I have a slider and I want to create thumb of specific sizes for my slider but only when the post post is sticky or if there is any other way so it won't create all these sizes I set for the slider for all the posts?


How can I show errors in the "Add Media" iframe?

I've added a custom field to the "Add Media" form using `add_filter('attachment_fields_to_edit', ...)` and I'm validating the existence of it when saving the attachment fields using `add_filter('attachment_fields_to_save', ...)` but I can't figure out how to get the form to show the error and prevent any further actions. Basically I want the error to show below the input field when the user presses "Insert into Post," "Save All Changes," or "Use as featured image," and I don't want the subsequent action to be executed. How can I accomplish this? Thanks in advance.


Multiple post types for BuddyBlog plugin

Hello can anybody help me to return "multiple" Custom Post Types in this snippet? I would like to use 3-5 other custom post types and I can't get it work. The snippet above for ONE custom post type works, the snippet below for multiple custom post types doesn't.               add_filter( 'buddyblog_get_post_type', 'buddyblog_my_post_type' );     function buddyblog_my_post_type( $post_type ) {         return 'portfolio';     }      I have tried this and several other snippets without a success:               add_filter( 'buddyblog_get_post_type', 'buddyblog_my_post_type' );     function buddyblog_my_post_type( $array ) {         $array = array( 'post','portfolio' );         return $array;     }


AJAX issue - Uncaught SyntaxError when processing Zip File

I'm creating an application that will allow a user to fill out a form and then have a customized zip file downloaded for them upon submit. I'm utilizing AJAX to accomplish this task.                   Build.prototype.ajaxHandler = function(method, values) {             jQuery.ajax({                 type: 'POST',                 url: WP_LOCALIZED['url'],                 data: {                     action:     'request_handler',                     method:     method,                     data:       values                 }, success: function(data) {                     var response = jQuery.parseJSON(data);                     console.log(response);                      }, error: function(XMLHttpRequest, textStatus, errorThrown) {                     console.log(XMLHttpRequest, textStatus, errorThrown);                 }             });         };      Whenever I try to return basic data with my ajax handler I am able to successfully return without issue, but when I try to process my zip file method I consistently get `Uncaught SyntaxError: Unexpected token <` even though the `zip_file()` method is not actually returning any data back to the javascript method.               /**      * AJAX handler      *       * @return {json}      * @since 1.0      */     public function request_handler()     {              $post = $_POST;         $data = $post['data'];              // If this wasn't here it would return my $data variable         $this->zip_file();              die(json_encode($data));     }      I've also tested the `zip_file()` method on its own by placing it in the `init()` function and it runs just as I would expect it to without issue.               /**      * Create Zip File      *       * @return void      * @since 1.0      */         public function zip_file()     {         $zip = new ZipArchive;              if($zip->open('test.zip', ZipArchive::CREATE) === TRUE) {             if($zip->addEmptyDir($this->_plugin_path . 'assets/temp_files')) {                 // Do stuff             }             $zip->close();         }              header('Content-Type: application/zip');         header('Content-disposition: attachment; filename=filename.zip');         header('Content-Length: ' . filesize($zip));         readfile($zip);     }      Interestingly the same thing happens if I replace the `$this->zip_file()` call with just a basic `echo` statement. Except instead of telling me the `Unexpected token` is `<` it says `e` instead. I think I'm misunderstanding something fundamental about the way these two interact together, but so far have not been able to locate any information on what that may be. Any help would be appreciated.


use advance custom field inside query post command

I can't find a solutions in internet or advance custom field website docs about this. I hope wordpress genius can help me. I use http://wordpress.org/extend/plugins/advanced-custom-fields/ for themes options/function. I want to show category post in homepage using category name. here is my code:

<?php the_field('cat_1'); ?>

         <?php query_posts('category_name=<?php the_field('cat_1_name'); ?>','showposts=5'); ?>         <?php if (have_posts()): while (have_posts()) : the_post(); ?>
             <li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                      <?php endwhile; ?>         <?php else: ?>

<?php _e( 'Sorry, nothing to display.', 'fileketchup' ); ?>

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

<a href="<?php echo home_url(); ?>/<?php the_field('view_cat1'); ?>">View more

           Please check `<?php query_posts('category_name=<?php the_field('cat_1_name'); ?>','showposts=5'); ?>` this... Here I use advance custom field meta insert of category name.. but its show error... How I solve this?? If I use **('category_name=blog','showposts=5')** then its works.


Why is WordPress redirecting users to random posts after commenting?

After commenting on one of my posts, WordPress redirects me to another random post. Only after, when checking the previous post, I can see that my comment was posted. Still, why is WordPress sending me to a random post after commenting? Here's my comments.php file and here's my website (please don't publish it anywhere else, as I'm launching it tomorrow). Feel free to test the comments, though. I'll clear then before I launch it. Any suggestions? PS: I'm using no plugins and the bug doesn't work on other themes. Also, I'm using pretty `/%postname%/` permalinks.


Is a no RSS plugin setup supposed to work?

I'm using WP 3.1.2 as provided by Awardspace, a free hosting service. I haven't made any configuration regarding RSS but it seems to work on Google Reader. However, pictures and flash elements won't appear. Is this normal? Should I get a plugin then? Thanks in advance - Victor.


Wordpress multisite causing Error 101 (net::ERR_CONNECTION_RESET): Unknown error

> **Possible Duplicate:**   >  WordPress upgrade now receiving Error 101 (net::ERR_CONNECTION_RESET): > Unknown error We have just installed WordPress 3.0.1 and everything worked fine. However, as soon as we started to install the multisite functionality by following this tutorial, things started to go wrong. At the end of step 5, the tutorial has you update your wp-config.php file and .htaccess file. Once we made the reccommended changes to these files, uploaded them back to the server and tried to re-log in, none of the pages would serve up anymore. We now get the following error for ALL pages in the blog:               Error 101 (net::ERR_CONNECTION_RESET): Unknown error.      Any ideas? Here are the code changes we made (following the sub-folder setup): wp-config.php               define( 'MULTISITE', true );     define( 'SUBDOMAIN_INSTALL', false );     $base = '/';     define( 'DOMAIN_CURRENT_SITE', 'oursite.com' );     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );      .htaccces file (in wordpress root directory)               # BEGIN WordPress     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     # END WordPress


Wordpress sub-posts and permalinks

I'm thinking about one problem... There is a set of regular posts. Just posts in categories. I need to add for some of them a sort of subposts, posts which will be related to parent-post. This issue can be solved by adding meta_box to edit post page. (any better ideas?) Another problem is about permalink of this sub-post. If parent-post have permalink like this http://blabla.com/simple-post/ then i need sub-post with permalink like this http://blabla.com/simple-post/little-sub-post/ How can i deal with this?


Multiple Loops Breaking Pages

I'm new to WordPress, and I'm having an issue with "The Loop." I have a sidebar on the left side of a page that's supposed to show recent posts from two categories. In the middle of the page, there should be content for that specific page. In the right column, there should be posts for a specific category. Here's the problem: When I set up the left column, the middle column shows the posts content instead of the pages. See http://opachicago.com/wp/ if that doesn't make sense. Here's my Loop codes: Left Column (which should show Latest Posts):               <?php query_posts('category_name=News and Events, Uncategorized&showposts=5'); ?>     <?php if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>
<?php the_time('M j') ?>: <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php endwhile; ?>     <?php endif; ?>      Middle Column (which should show Page content):               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>         <?php the_content(); ?>     <?php endwhile; ?>


Resizing old post thumbnail images

In my `functions.php` I have defined the following:               add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size( 475, 475, true );      I have used the **Regenerate Thumbnails** plugin to regenerate the thumbnails. When calling `<?php the_post_thumbnail(); ?>`, the images do not look cropped. When checking my uploads folder I do not see any thumbnails set for 475x475. Thoughts?


Extending Class in Custom-Metaboxes-and-Fields-for-WordPress

Custom-Metaboxes-and-Fields-for-WordPress is a great custom meta box script as it is, and even allows for adding new field types within their code. However, I want to create a new field type similar to the address field example they show, but uses the file field in it as well. In other words a field grouping, with a file upload. I can't seem to get this to work as the new field group saves the data in an array ( serialized data ) and the file upload saves the data in an array as well. One won't allow the other for some reason. I will continue to tinker with this, but if anyone knows how to do this, please let me know. Thanks!


Read More link scrolling page

I'm creating a theme, and I want to prevent the page from being scrolled when a user clicks 'Read More' and the code given in the Wordpress Codex is not helping me at all. My `functions.php` is exactly the same as the snippet in the Codex and the relevant line of my `index.php` is: `<div class="content"><p><?php the_content(__('Read More')); ?></p></div>` Edit: I have a new, weird bug: the content of the Codex snippet is being shown as raw HTML in my blog and admin pages.


WordPress plugin overloading with tmp tables

I have asked at the plugin's (WordPress Popular Posts) support a few days ago, since no response hope to get some insight or help here. Thanks. Hesitant to tweak settings like `max_heap_table_size` & `tmp_table_size` because kind of (naively?) hoping that such a popular plugin has a way of managing load. On a rather popular site on a VPS the host is asking us to investigate constant, frequent tmp writes that is increasing server load. Any ideas on how to manage / decrease these? Example:               Copying to tmp table | SELECT p.ID AS 'id', p.post_title AS 'title', p.post_date AS 'date', p.post_author AS 'uid' , ( IFNULL(v.pageviews, 0)/(IF ( DATEDIFF('2013-02-25 12:07:23', MIN(v.day)) > 0, DATEDIFF('2013-02-25 12:07:23', MIN(v.day)), 1) )) AS 'avg_views' FROM XXXXXX_posts p LEFT JOIN (SELECT id, SUM(pageviews) AS 'pageviews', day FROM (SELECT id, pageviews, day FROM XXXXXX_popularpostsdatacache WHERE day > DATE_SUB('2013-02-25 12:07:23', INTERVAL 1 WEEK) ORDER BY day) sv GROUP BY id) v ON p.ID = v.id WHERE p.post_status = 'publish' AND p.post_password = '' AND p.post_type IN('post','page') GROUP BY p.ID HAVING avg_views > 0.0000 ORDER BY avg_views DESC LIMIT 5 |


wp_query orderby random do not repeat infinite scroll - one loop

I have found a lot of documentation on solving this issue with multiple loops, I'm finding it hard to see a solution for one custom loop. Problem: I'm using infinite scroll to load in the next page of posts to the homepage. The posts need to be shown in a random order so I need to store which posts have been shown and then exclude them the second time the query is hit.               <?php $my_query = new WP_Query(array('post__not_in'=> $do_not_duplicate,                              'orderby' => 'rand',                             'category_name' => 'projects',                              'posts_per_page' => 20,                              'paged' => $paged));     while ($my_query->have_posts()) : $my_query->the_post();     $do_not_duplicate = $post->ID; ?>          <?php get_template_part( 'entry' ); ?>     <?php endwhile; ?>      I have built this from http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action \- however the approach there is to use `$do_not_duplicate` in the second loop. Perhaps I need to shuffle this around a bit, store the posts shown in another way, a cookie? Any guidance appreciated.


Showing all the posts in one page?

There are over 200 posts tagged with the keyword "Apple." Each tag page -- example.com/tag/apple/page/2/ -- shows 10 posts. So there are 20 tag pages. Is it possible to show all these 200 post (links) in one page? I don't want to show any of the excerpt -- just consolidate all those 200 links in one page. Appreciate your help!


Are WordPress Heartbeat API 'beats' staggered or do they occur simultaneously for all users?

The WordPress Heartbeat API uses admin-ajax.php to run AJAX calls. If User X leaves their browser open, many calls will be made to the server, with each call happening when there is a 'beat'. Now if User Y leaves their browser open, many more calls will be made to the server, with each of these calls happening when there is a 'beat'. It's possible a large website will also have User A, User B and User C all do the same. **My question:** Considering lots of users might access a website simultaneously, are WordPress Heartbeat API 'beats' staggered (the 'beat' for User X happens a few seconds before the 'beat' for User Y) or does a 'beat' occur at exactly the same time for all users? If 'beats' aren't staggered, my concern is a very heavy load on the server at the point when a 'beat' occurs.


I am trying to install a site that a larger organization sent me, where do I start?

I have the zip file with everything in it, but there's just not a simple way to "run"? What all do I need? Do I need my own server or should they have their own?


Remove the deleted user comment

## Problem I have a user based site, so when user **deletes** his profile somehow his/her comments stay visible. There is no name and blank avatar with the comment. Is there any way to delete the comments of a user if the user deletes his/her profile and how? Is there a function of somehow? This really is a strange problem.


Plugins missing in front end but appear in backend FTP

So, I'm working with the Advanced Access Manager and then the W3 Total Cache plugins and all of a sudden WHOOPS, there's a problem. First last night: After setting up W3 Total Cache, and then playing with it a bit, I broke the site. I couldn't go to my wp-admin page to login. All it would do was complain about lines in the pluggable.php & wp-login.php. Now today: So I'm back at it after a good break hoping to be able to fix it with fresh eyes. Great! The pluggable.php error has been fixed. Now in the process of trying to install w3 total cache again, it's randomly complaining about some lines in wp-login.php so I replace my newer wp-login.php file with an older one from a back up and it's fine, however now after some testing and renaming the plugin folder in FTP something different and then back to plugins it's not actually activating ANY plugins and I have no active plugins in my wordpress plugins section...but they are all there in my FTP. The older wp-login.phph file is of the same site, same login admin credentials and same login info. So now why, as an administrator, I can see any plugins on the front end when they are ALL there in the FTP back end? Any suggestion as to how to go about this?


Plugin recommendation - posting to Social Networking sites

I know there are a lot of Social Networking plugins around, so I thought I'd ask for some recommendations. When writing a new post in the admin area (standard post type), I'd like the option to post it (the excerpt and a link, for instance) to my Facebook and Twitter accounts. I'm not referring to buttons on the front-end for my users to share on their profiles. Does such a plugin exist?


Number of posts per page setting is not working?

OK, here's my prob. I have static homepage and a separate posts page on my wordpress site. I have defined the two in the admin panel. Now, I have also set the max number of posts to be displayed to 5(in settings> reading), but all the posts(10+) are still being displayed on the blog page. I'm also displaying the latest 3 posts on the static homepage using a custom query. i.e               $wp_query = new WP_Query( array( 'posts_per_page' =>3));          <results loop code>      But this list also is displaying more than 3 posts.It seems wordpress is ignoring the posts_per_page limit I set whether I do it at the admin panel or through code. What the hell is going on? This is my 1st time using wordpress for developing a site. Is this a common problem for noobs? **EDIT:** I just stripped the static homepage bare and left a basic code block that simply fetches titles of the posts. More than 3 posts are still being returned. Here is the actual(and only) code currently in the homepage:
            <?php $wp_query = new WP_Query( array( 'posts_per_page' => 3) );?>            <?php if ( $wp_query->have_posts() ) : ?>
         <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
           <a href="<?php the_permalink() ?>"><?php the_title(); ?>
         <?php endwhile;?>
       <?php endif; ?>


Serious social interaction

I have an old blog... 25 posts on wp 2.6. good content, valuable information, right to the point. I am about to update the blog and the posts. Make the posts more up-to-date (there are some 3 years old, and still new!) and repost it to media sites and create a buzz around this really good information. So the question is... What, if you build a new site TODAY (wp 3.3) and have good content to post... over the years... what will be your strategy/plugin/toolbox to get the info OUT THERE... I have tried wordbooker (to publish on facebook) which is always broken... and really bad to use... I have heard of dlvr.it, which seems promising. Twitter feed auto publish and anything and everything. I would like to know the basic plugin toolset to get the info into the social media and rate good on : http://marketing.grader.com/ I would like to know your experience, your success, your fails... and the good news is, I will apply it RIGHT NOW


pages meta box - get_categories dropdown

I created a meta box with a dropdown list which consists of all existing categories. The administrator of the page should be able to choose one of the categories out of the dropdown list which will be saved by the save/update page function of wordpress.               <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>       <option value=""><?php echo esc_attr(__('Select Event')); ?></option>       <?php        $categories=  get_categories('child_of=10');        foreach ($categories as $category) {         $option = '<option value="/category/archives/'.$category->category_nicename.'">';         $option .= $category->cat_name;         $option .= ' ('.$category->category_count.')';         $option .= '</option>';         echo $option;       }      ?>     </select>      I have absolutely no idea how to work with the selected list item without redirecting to another page like "action=bla.php"?! In the past I worked with simple imput fields which can be saved by the update/save page function but how can this be done with a dropdown list? Here's the complete code:               <?php     /*     Plugin Name: myname » Membership     Plugin URI: http://www.myname.com     Description: Das membership Plugin.     Author: myname     Version: 2     Author URI: http://www.myname.com     */          add_action( 'add_meta_boxes', 'membership_meta_box_add' );          function membership_meta_box_add() {     /*       * add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args );      * id = unique identifier for css or javascript      * title = displayed at the top of the meta box      * callback = function which renders the meta box      * page = will be displayed on "post", "page" or "some_custom_post_type"      * context = where to place the box: "normal" (below the editor), "side" and "advanced" (column of post editor but further down)      * priority = from top to bottom: "high", "default", "low"      * callback_args = will the disregard by us      */              add_meta_box( 'myname_membership_box_id', 'myname Membership Einstellungen', 'membership_meta_box_cb', 'page', 'normal', 'high' );      }          function membership_meta_box_cb($post) {                // $post is already set, and contains an object: the WordPress post         $values = get_post_custom( $post->ID );              /***************************************************          *              Einlesen der bereits gespeicherten Variablen          ***************************************************/              $membership_premium_category = isset( $values['membership_premium_category'] ) ? esc_attr($values['membership_premium_category'][0]) : '';                // We'll use this nonce field later on when saving.         wp_nonce_field( 'membership_meta_box_ms_nonce', 'meta_box_ms_nonce' );              /***************************************************          *              Konfiguration der Stylesheets          ***************************************************/        ?>                       <?         /***************************************************          *              Aufbau der Eingabefelder          ***************************************************/            ?>
Hier finden Sie alle verfügbaren Einstellungsmöglichkeiten für die Membership Site.

Kategorie für Membership Artikel

dev: "membership_premium_category"
                 <input type="text" class="membership-box-field" name="membership_premium_category" id="membership_premium_category" value="<?php echo $membership_premium_category; ?>" />
Bitte tragen Sie hier den Namen (nicht Slug/Titelform) der obersten Kategorie aller Premium Artikel ein. Diese Eingabe ist notwendig.

                       <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>              <option value=""><?php echo esc_attr(__('Select Event')); ?></option>              <?php              $categories=  get_categories('child_of=10');              foreach ($categories as $category) {                 $option = '<option value="/category/archives/'.$category->category_nicename.'">';                 $option .= $category->cat_name;                 $option .= ' ('.$category->category_count.')';                 $option .= '</option>';                 echo $option;             }             ?>         </select>                   <?php     }               /***************************************************          *              Speicherfunktion des Plugins          ***************************************************/          add_action( 'save_post', 'membership_meta_box_save' );          function membership_meta_box_save( $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_ms_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_ms_nonce'], 'membership_meta_box_ms_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post' ) ) return;                // now we can actually save the data           $allowed = array('a' => array( 'href' => array()),                                 'object' => '',                                 'iframe' => array( 'width' => array(), 'height' => array(), 'src' => array(), 'frameborder' => array(), 'allowfullscreen' => array())           );                /***************************************************          *              Speicherung der einzelnen oben definierten Felder          ***************************************************/              // Make sure your data is set before trying to save it         if( isset( $_POST['membership_premium_category'] ) )             update_post_meta( $post_id, 'membership_premium_category', wp_kses( $_POST['membership_premium_category'] ) );     }      ?>


Custom Post Type Category List & Post Count

I'm looking for Cutom Post Type Category List & Post Count. Here is my code..                           <?php                 $taxonomy = 'project-tags';                 $tax_terms = get_terms($taxonomy);                 ?>                      <?php                 foreach ($tax_terms as $tax_term) {                 echo '
' . 'name ) . '" ' . '>' . $tax_term->name.''. $show_count. '
';                 }?>       This code works perfect for getting categories under my custom post type. But How do I get number of post count per category ?


How to Replace YouTube Videos with a "Click to Play" Thumbnail?

I use a lot of embedded videos (via `oembed`) on my blog, and that can slow down page loads. Is there a way to automatically replace YouTube (and other) videos with a thumbnail (preferably the post's featured image). And then replace the thumbnail with the video iframe when clicked?


How can I sort posts ascending by post title for a specific post type, but on a category archive template? My schema involves a "video" custom post type and multiple subcategories of the aforementioned post type. I am using the Custom Content Type Manager plugin. How can I implement this?


Fetch array with $wpdb

I am trying to convert this code to use the $wpdb.               $data = array();          $query = "SELECT * FROM videos";     $query_exec = mysql_query($query) or die();          while($row = mysql_fetch_array($query_exec)) {         if ( $row['video'] == "http://youtu.be/".end(explode('http://youtu.be/',$row['video'])) ) {                 $data[$row['id']] = end(explode('http://youtu.be/', $row['video']));             } else {                 $data[$row['id']] = end(explode('?v=', $row['video']));             }            }      So I did:               $query = $wpdb->get_results("SELECT * FROM videos");      But how can I fetch the array? Thank you in advance for the help.


If contributor has published 2 or more posts then show otherwise hide

If the contributor has already published two or more posts I show a maximum of 5 of them in the post-single.php using this code               <?php echo do_shortcode('[latestbyauthor show="5"]'); ?>      I have a text that introduces the code (other posts by the same author) This works fine if the contributor really has published 2 or more article but totally uselless if he has just one post. What I'm looking is a way to hide the text before the code by checking the total number of posts published, if 1 then hide and if 2 then show. Is it possible? Thanks!


Sharing Buttons not Working - Sharing Settings

I'm trying to add a "share this" button to my site. I am having an issue configure this because when I go to settings -> sharing I get the image below![enter image description here](http://i.stack.imgur.com/CXS2W.png) Update: Here is my inspector error console:![enter image description here](http://i.stack.imgur.com/nNQJ5.png)               Uncaught SyntaxError: Unexpected token < /?ver=2:1     Uncaught SyntaxError: Unexpected token < /?ver=3:1     JQMIGRATE: Logging is active s0.wp.com/:9823


Show menu on page with all sub-pages and sub-sub-pages of that page

I am trying to create a menu, with sub-pages and sub-sub-pages of a current page. I want the menu to work as a dropdown, where the sub-sub-pages for a sub-pages are shown when the user clicks the sub-page, and hidden again if the user clicks on the sub-page a second time. So it is important that the sub-pages in the menu are not links. I need to show the same menu, no matter how deep in the sub pages the user is at. Can anyone help? :)


WordPress Custom Fields (Checkboxes with multiple values)

I am currently using a custom post type, with a custom field that is a checkbox. There are multiple values in the checkbox including: Laptop, New, No-Marketing-text and several more. If No-marketing-text is the only one selected, it has no problem with doing what I want it to do. If multiple checkboxes are selected, it only looks at the first one that is selected. What should I change to make it work even if multiple checkboxes are selected?               <?php                //REMOVES BACK TO TOP BUTTON FOR PROGRAMS THAT HAVE NO MARKETING BLURB - JUNE 27, 2013 - Brandon Carson              if("No-marketing-text" == get_post_meta($post->ID, 'program_flags', true)){                      echo "";                  }else{                 echo "
";                      the_content();                  echo "Back to Top
";                       }              ?>


WordPress - Retrieve a Page if it's a direct descendant of another Page

I have this piece of code that works great: it retrieves a particular page from my WordPress database so I can wrap custom code around it in a template. In the instance below it grabs the page called Showreel:                       <?php             $page = get_page_by_title('Showreel');             ?>                       <?php                  $my_id = $page;                  $post_id = get_post($my_id, ARRAY_A);                  $title = $post_id['post_title'];                  $content = $post_id['post_content'];             ?>
<?php echo $title;?>
                                    <?php                  echo $content             ?>      However, I have conundrum - I have some pages that do not have unique names. How can I retrieve a page only if it is a direct descendant of a certain parent e.g. I would like to retrieve a page under Showreel called _The Ruth Rendell Mysteries_. My initial thought was that the code below would work, but it doesn't.                       <?php             $page = get_page_by_title('Showreel->The Ruth Rendell Mysteries');             ?>


Capability to read/edit page in wp-admin only for administrators

I want to create a page which is only for editable and readable (within wp- admin) for administrators. To restrict other users to edit any page (and not only the own ones) is not the solution as I want them to have this capability. I am using the plugin called "Access" by wp-types.


One time login on 2 different Wordpress sites

Im trying to figure out how to login one time to mydomain.com and being automatically loged in to mydomain.com/blog . I have figured out how to share tables (so that the same users on my main site, are also on the blog site) through MyPHPAdmin. I was hoping in this manner, I wouldn't have to use WPMU. Any advice, or links would be GREATLY appreciated. Im currently using version 3.8.1


Cannot use existing image as a featured image since 3.8.1 update

Since the 3.8.1 update i have been unable to use an existing image in my media galley as a featured image thumbnail on my blog. I have to manually download, change the name, and re-upload the file in order to use it as a featured image. Is this some type of corruption in the database? I'm going a bit bonkers trying to find the solution. Any help much appreciated. Thanks


wp pagenavi not working with category id

Can someone let me know i am using wp pagenavi wordpress plugin http://renegadehealth.com/blog/?cat=6708 When i click on the next button at the bottom the following link comes:- http://renegadehealth.com/blog/blog/index.php?cat=6708&paged=2 an extra "blog/blog/" is being added


WPDB update is not working for tables with large number of columns

I am using a form to update a cutom WP datatable. The update function is working fine for all the table except one which have 14columns. I can delete the rows but can't edit any entries. For edit I am using:               $wpdb->update($mysql_table_name, $formdata, array($id_key => $id_val));      For delete:               $wpdb->delete($mysql_table_name, array($id_key => $id_val));


Get post related on category

it's a catalog website for different product. I need a function that will get the category of the selected product, and get all the product from that category Let see an example. A table, is in wood category and kitchen. So when display table, under the table i like all the other kitchen product listed as well as all the other wood product... it good for cross selling !... how do i do that ?


Add custom taxonomy to title tag

I'm using Yoast's WordPress SEO plugin for a variety of websites. In setting title tag templates with his `%%category%%` syntax, I've figured out that you can reference custom fields by using `%%cf_<custom_field_name>%%`. What I haven't been able to figure out is how to reference custom taxonomies. Within a custom post type, I have a category that I want to reference (i.e. `customcategory`). If I try adding `%%customcategory%%`, it doesn't work. Does anyone know if this is possible with the WordPress SEO plugin or point me in the right direction if I need to add a function to work with the plugin?


Woocommerce product page is not showing custom css

I am using woocommerce plugin for wordpress to make an eCommerce website. It is working fine with little bit customization. As I have configured shop page as the default product page so that in that page every product can be seen and a user can buy product from that page. But now I want to use some highlights image for special discount on that item and I just placed all that item just over the products page by posting images in that page. But in order to style that images I used WordPress Page Specific CSS Plugin to write some custom css, but it is strange that in that particular page custom css is not working. Can somebody tell me why this is happening and how to solve this? Any help and suggestions are welcome :)