Last active
August 29, 2015 14:01
-
-
Save sharpmachine/a0a50ec6c2a37aabc3a8 to your computer and use it in GitHub Desktop.
Query Custom Post Types
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 $args = array( 'post_type' => 'lastest_updates', 'showposts' => 1); ?> | |
| <?php $latest_updates = new WP_Query( $args ); ?> | |
| <?php if ( $latest_updates->have_posts() ) : ?> | |
| <?php while ( $latest_updates->have_posts() ) : $latest_updates->the_post(); ?> | |
| <?php the_short_title(35); ?> <a href="<?php the_permalink(); ?>" class="read-more">Read More →</a> | |
| <?php endwhile; ?> | |
| <?php wp_reset_postdata(); ?> | |
| <?php else: ?> | |
| <?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment