Last active
September 20, 2019 16:42
-
-
Save kaseybon/7680189 to your computer and use it in GitHub Desktop.
Wordpress Mullet Loop: Place this loop in the index.php. Gives the option to pull in a custom content template for the most recent blog post in the blog feed e.g. Show full blog post for most recent post while only showing excerpts for older posts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (have_posts()) : ?> | |
<?php $count = 0; ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php $count++; ?> | |
<!-- Check for the first blog post in the loop && makes sure it the first page of results && makes sure it is the blog --> | |
<?php if ($count == 1 && $paged == 0 && is_home()) : ?> | |
<!-- Most recent blog post with custom template will display above older entries - Requires a content-featured.php or whatever you want to name your file or replace with code --> | |
<?php get_template_part( 'content', 'featured' ); ?> | |
<?php else : ?> | |
<!-- This will loop through the rest of the blog posts - Requires a content.php or replace with code --> | |
<?php get_template_part( 'content' ); ?> | |
<?php endif; ?> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<!-- Content that will display if no posts are available - Requires a content-none.php or replace with code --> | |
<?php get_template_part( 'content', 'none' ); ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment