Created
February 5, 2019 14:25
-
-
Save metamn/53a59bd09b95dea1ef6008917b8750ed to your computer and use it in GitHub Desktop.
A simple WordPress post list
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 | |
/** | |
* Displays a list of posts | |
* | |
* @package Pointhacks | |
*/ | |
$post_list_title = get_query_var( 'post-list-title', 'Post list' ); | |
$post_list_klass = get_query_var( 'post-list-klass', 'post-list--default' ); | |
$post_list_posts = get_query_var( 'post-list-posts', null ); | |
$post_list_post_format = get_query_var( 'post-list-post-format', '' ); | |
if ( empty( $post_list_posts ) ) { | |
return; | |
} | |
?> | |
<section class="post-list <?php echo esc_attr( $post_list_klass ); ?>"> | |
<h3 class="post-list-title"> | |
<span class="text"><?php echo esc_attr( $post_list_title ); ?></span> | |
</h3> | |
<div class="post-list-items"> | |
<?php | |
foreach ( $post_list_posts as $post ) { | |
get_template_part( 'template-parts/post/post', $post_list_post_format ); | |
} | |
?> | |
<div class="dfp-holder" id="div-gpt-ad-1516334663117-2"></div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment