Created
October 24, 2017 19:45
-
-
Save yuriitaran/10af354fb347aae3816f9532649f684a to your computer and use it in GitHub Desktop.
WP_Query to display content from custom post type object
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 = new WP_Query( array( 'post_type' => 'slider', 'order' => 'ASC' ) ); ?> | |
<?php if ( $the_query->have_posts() ) : ?> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<img src="<?php the_field('slide_image'); ?>" alt="<?php the_field('slide_title'); ?>" /> | |
<?php the_field('slide_title'); ?> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment