Retrieving category pages from subcategory returns empty sets
Retrieving category pages from subcategory returns empty sets
Retrieving category pages from subcategory returns empty sets
But if the single post page is cached in Varnish, wouldn’t the count stay the same? Yes, if the whole page is cached then the PHP will never get run to update the view count. You’d need an ESI block to call an uncached URL that will increment the view count. Or even an Ajax … Read more
If you read the code (in version 4.5.2 on line 164-173) you will see that orderby can be an array of values, coupled with order. So you could modify $args like this: $args = array( ‘orderby’ => array( array (‘sticky’ => ‘DESC’), array (‘registered’ => ‘DESC’)), ‘fields’ => ‘all_with_meta’, ); Note that I know nothing … Read more
If you index $related_posts by position along with $ad_posts, you can probably splice/insert them in at the same position… eg. function wpse_210493_apply_advertising_position(&$posts, $return = false) { $ad_posts = array(); $content_posts = array(); $related_post = array(); // Seperate $posts into “Ads” and “Content” arrays based on whether or not they have ‘rw_adversiting_position’ meta-data foreach ($posts as … Read more
I don’t know what rwmb_meta() does. But if rwmb_meta(‘tbf_scheduledatetime’) returns array, then try something like this: … $images = rwmb_meta( ‘tbf_scheduleimage’, ‘type=image&size=full’); $dates = rwmb_meta(‘tbf_scheduledatetime’); var_dump( $dates ); … You’ll probably want to loop thru $dates and repeat the post data for each element in $dates.
Your actual question is basically when to run a custom query and when to make use of the main query. Lets break it down in three parts PART ONE When to run a custom query (This is not a definitive list) To create custom content sliders To create a featured content area in a page … Read more
As milo stated, I need to use the post_class function to use the post_class filter. By adding <?php post_class(); ?> to the div in my loop I was then able to successfully modify the post class. Below is my full code containing the post_class filter and the post_class function. Reference: https://codex.wordpress.org/Function_Reference/post_class <?php //Call in the … Read more
It’s a bad use of Query you may look at this post In this case use a secondary query with your own instance of WP Query. query_posts() is not recommanded here cause it overrides the main query. <?php $args = array( ‘post_type’ => ‘instrument’, ‘post_status’ => ‘publish’, ‘ignore_sticky_posts’ => 1, ); $my_query = new WP_Query( … Read more
You have this code: elseif (17 < $count && $count <= 27 && $paged === 1) : if ($count === 10) echo ‘DIV/CONTENT BEFORE THE NEXT 10 POST GOES HERE’; The first conditional fails when 10 === $count and so the second conditional can never succeed. As your while loop executes (in a structure that … Read more
You may need to add this to your query_posts() call ‘order’ => ‘ASC’ so it should look like this: query_posts( array( ‘post__in’ => $top_ideas, ‘orderby’ => ‘post__in’, ‘order’ => ‘ASC’ ) ); Hope this helps!