modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)
modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)
modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)
Okay, after a research of a matter, i came to the conclusion. My post types would either be the category posts with no data (parent containers) or a child posts – standard articles. My template will check if the post does have any children – if not – it will display the post itself, and … Read more
You need to apply the do_shortcode to the content itself. Example below: function test_func( $atts, $content ) { extract( shortcode_atts( array( ‘foo’ => ‘no foo’, ‘baz’ => ‘default baz’ ), $atts ) ); return “<div class=”test”>”.do_shortcode($content).”</div>’; } add_shortcode( ‘test’, ‘test_func’ ); So in other words you need to care about the shortcode that print the … Read more
Suppress the_content filter in a nested loop
If I assign a featured image to any post in question then it does show the correct image. I just don’t understand why every post after the first twelve are using another posts featured image. I think the problem is that you do not reset $image if the current post doesn’t have a featured thumbnail. … Read more
Something like this if you want to call mytemplate.php: get_template_part( ‘template’); Or something like this if you want to call content-mytemplate.php: get_template_part( ‘content’, ‘mytemplate’ ); I hope that this will help you.
The typical definition of static page is plain text file, typed by hand or generated by software either. By definition static pages cannot have back-end powered dynamic functionality. There are quite a few approaches to integrating WP (or anything really) with static page, typical being: convert static page to dynamic completely – turn it into … Read more
query_posts() should not be used in general and especially when dealing with pagination. You need to be making adjustments before template is reached, usually via pre-get-posts hook, on which there is plenty of material on site.
When query iterates it holds the number of current post (zero-based) in current_post property: echo $wp_query->current_post % 2 ? ‘cat1’ : ‘catA’;
How to get multiple loop in category.php, my scripts becomes madness