Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
So based in the information you’ve given me in the comments the following gist should work as you have described with your current setup. https://gist.github.com/aj-adl/fab2cefd1450cbf24a5c You provide it with a region, and it will get all posts from a region, loop through and build an array of producers, then do a subquery and loop for … Read more
The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more
Perhaps check to see within the first loop if its paged or not based on the value you set for the ‘posts per page’ arguments. If not paged show the results via your template, if it is paged, then do nothing… //First Loop if ( $query1->have_posts() ) { while ( $query1->have_posts() ) { $query1->the_post();?> <?php … Read more
There are no hooks in the load sequence triggered by get_template_part() that will help you. get_template_part() locate_template load_template And locate_template() is hard-coded to look at theme files. I hate to write “you can’t do that” answers, but I honestly don’t see a way to override what file get_template_part() loads.
To start this off, you should not be using query_posts for custom queries. Directly from the codex Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of … Read more
A simple approach could be to use a global array in which you will store posts that are selected in the featured query. You could set this array in your functions.php or index.php : $featured_post_array = array(); Then in your featured.php file first call the global array somewhere in the beginning: global $featured_post_array; and inside … Read more
wp_query display posts based on day
That way won’t work as you have found out it will grab just the 4 posts from the loop. To do this you need to do a search of each post type, something like below will work: $terms = array(‘post’, ‘mixes’, ‘artists’, ‘releases’); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ foreach ( … Read more
You could just make an easy counter – Untested though. <?php else : ?> <?php global $wp_query; ?> <?php $ads = 0; ?> <?php if ($ads < 3 && (($wp_query->current_post + 1) % 5 == 0 )): ?> <div class=”box”> <adsense code> </div> <?php $ads++; ?> <?php endif; ?>