Last active
December 28, 2015 00:09
-
-
Save kadavre/7411353 to your computer and use it in GitHub Desktop.
Majority of bloggers display posts in more or less them same way on the home pages of their blogs. This is understandable since WordPress does not feature a default option to define how posts should be displayed. Fortunately, you can surmount this problem by using custom fields. To define posts in your home page, you can use either the full post…
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()) : | |
while (have_posts()) : the_post(); | |
$customField = get_post_custom_values("full"); | |
if (isset($customField[0])) { | |
//Custom field is set, display a full post | |
the_title(); | |
the_content(); | |
}else{ | |
// No custom field set, let's display an excerpt | |
the_title(); | |
the_excerpt(); | |
endwhile; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment