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)
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
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.
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.
Use buffer to simply do that with ob_start() & ob_get_clean(). function custom_summary($atts) { extract(shortcode_atts(array( “category” => “”, “posts” => “” ), $atts)); ob_start(); $my_query = new WP_Query(“category_name=$category&posts_per_page=$posts”); while ($my_query->have_posts()) : $my_query->the_post(); // Do all the things. endwhile; wp_reset_postdata(); return ob_get_clean(); } add_shortcode(‘summary’, ‘custom_summary’);
Heh… may I ask you what is the point of this? Because one would think that it’s to save bandwidth and shorten the time the page loads. So why would you always want to load all three of them? The display: none will NOT prevent the images from being loaded into the DOM. They will … Read more
I have created this function in bp-custom.php page. function filtering_activity_default( $query ) { if ( empty( $query ) && empty( $_POST ) ) { $query = ‘action=activity_update,joined_group’; } return $query; } add_filter( ‘bp_ajax_querystring’, ‘filtering_activity_default’, 999 ); This is working for me as expected.
solution here as function: function testchildren () { global $post; $childtest = get_pages(‘child_of=”.$post->ID); if( count( $childtest ) != 0 ) { return false; } else { return true; } } and implementation as markup: <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2> <?php if ( … Read more
This webpage has a redirect loop issue with SSL page
You can easily achieve this by using a multiple loop, or a loop inside a loop. Let’s assume you have your normal page template with the standard WordPress loop, outputting your wrapper <div class=”page”> and the title: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”page”> <div class=”title”> <?php the_title(); ?> </div> <!– … Read more