Created
June 27, 2021 10:31
-
-
Save ajaydsouza/73e276d0f1702e518e801c9ce1034223 to your computer and use it in GitHub Desktop.
Top_Ten_Query Examples
This file contains hidden or 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 Top_Ten_Query( $args ); | |
// The Loop. | |
if ( $the_query->have_posts() ) { | |
echo '<ul>'; | |
while ( $the_query->have_posts() ) { | |
$the_query->the_post(); | |
echo '<li>' . get_the_title() . '</li>'; | |
} | |
echo '</ul>'; | |
} else { | |
// no posts found. | |
} | |
/* Restore original Post Data */ | |
wp_reset_postdata(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment