Output loop leveraged shortcode twice on one page

Not sure I understand what you are doing with your shortcode, but I think you need to run rewind_posts() to move the loop counter back to the beginning for the second “execution.” Example here: https://codex.wordpress.org/Function_Reference/rewind_posts further explanation here: https://stackoverflow.com/questions/23729847/wordpress-difference-between-rewind-posts-wp-reset-postdata-and-wp-reset-q

Detect if current page is front page within custom query

Marius, I have been in this situation before as well. Haven’t found a good solution though. Answer provided by Laxmana won’t work as the $isFrontPageOrSearch wont be accessible inside the template-part file. Although using the approach provided by Laxmana, you could be using PHP include(locate_template(‘your-template-name.php’));, instead of using get_template_part function. Then the variable would be … Read more

Exclude posts from main loop based on meta value

Dave, your code seems good except a couple things in it, so please try it: function exclude_featured_post( $query ) { if ( is_front_page() && $query->is_main_query() ) { $meta_query = $query->get(‘meta_query’) ? $query->get(‘meta_query’) : array(); // append yours $meta_query[] = array( ‘key’ => ‘featured_post’, // please make sure that key is correct ‘value’ => ‘1’, ‘compare’ … Read more