-
-
Save billerickson/79180e21d715999f1577472c81d8557f to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Display posts about spain | |
* | |
*/ | |
function be_display_spain_posts() { | |
$loop = new WP_Query( array( | |
'posts_per_page' => 5, | |
'category_name' => 'spain', | |
) ); | |
if( $loop->have_posts() ): | |
echo '<h3>Recent posts about Spain</h3>'; | |
echo '<ul>'; | |
while( $loop->have_posts() ): $loop->the_post(); | |
echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>'; | |
endwhile; | |
echo '</ul>'; | |
endif; | |
wp_reset_postdata(); | |
} | |
add_action( 'genesis_after_entry', 'be_display_spain_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment