Created
May 19, 2017 19:08
-
-
Save cccamuseme/4749ea110faa0300a7d761a7e3243322 to your computer and use it in GitHub Desktop.
Change color of title based on category
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 | |
// The Query | |
$the_query = new WP_Query( array( 'cat' => '3,4', 'posts_per_page' => 4 ) ); | |
// The Loop | |
if ( $the_query->have_posts() ) { | |
while ( $the_query->have_posts() ) { | |
$the_query->the_post(); | |
echo '<h4><a href="' . get_permalink($recent["ID"]) . '">' . get_the_title() . '</a></h4>'; | |
echo '<div class="post-meta">'; | |
echo the_time('F j, Y | g:i a'); | |
echo '</div>'; | |
echo '<p>' . get_the_excerpt() . '</p>'; | |
} | |
/* Restore original Post Data */ | |
wp_reset_postdata(); | |
} else { | |
// no posts found | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment