Created
December 19, 2016 08:02
-
-
Save yaulaannl/f45a905513441f9f2af77aecab0a4fd4 to your computer and use it in GitHub Desktop.
Wordpress custom post query example
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 $loop = new WP_Query( array( 'post_type' => 'tutorial', 'orderby' => 'post_id', 'order' => 'DSC','posts_per_page' => -1 ) ); ?> | |
<?php if ( $loop->have_posts() ) : ?> | |
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?> | |
<div class="row tutorial-list"> | |
<a href="<?php echo esc_url(get_permalink()); ?>" > | |
<span class="link-spanner"></span> | |
</a> | |
<div class="col-sm-3"> | |
<h4><?php the_field('type'); ?></h4> | |
</div> | |
<div class="col-sm-6"> | |
<h4><?php the_field('list_title'); ?></h4> | |
</div> | |
<div class="col-sm-3"> | |
<h4><?php the_field('lesson_number'); ?> Lessons</h4> | |
</div><!-- column 4--> | |
</div> <!-- row --> | |
<?php endwhile; ?> | |
<?php wp_reset_query(); ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment