$wp_query issue when trying to create a virtual page

I found this and it works. The big difference is that it checks if $post count == 0 and the creates the virtual page which will then allow all the other queries to function as normal. <?php /* Plugin Name: Virtual Page Plugin URI: http://davejesch.com Description: Create a virtual page with content Author: Dave Jesch … Read more

Query child’s child categories

Ok then, I actually was getting the subcats with the wrong method. in $parent_cat = get_cat_ID( $cat_name ); $cat_name wasn’t a name but un slug. First mistake. So I corrected with $parent_cat = get_category_by_slug( $cat_slug ); The final code is : // Get the parent cat thanks to the page’s cat slug $parent_cat = get_category_by_slug( … Read more

wordpress nested loop

Do I see that right, that you are doing a WP_Query for every single post, you want to retrieve? That is highly inefficient, you can use the post__in argument supplied by WP_Query. (http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters) foreach ( $urls as $url ) { //echo $url[“mymeta_url”]; foreach ( $url[‘mymeta_slider’] as $u ) { //echo “$u<br> “; shows post id … Read more

wordpress query from multiple post id

Your first example also needs the orderby parameter set, otherwise it defaults to standard date order: $my_query = new WP_Query( array( ‘post_type’ => ‘slider’, ‘post__in’ => $posts, ‘orderby’ => ‘post__in’ ) );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)