Created
May 17, 2018 11:45
-
-
Save odil-io/9cb48d3fb2f76eea6561c5b875cebb4b to your computer and use it in GitHub Desktop.
WordPress: List Posts
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 $args = array('post_type' => 'posttype', 'post__not_in' => array($post->ID), ); ?> | |
<?php $query = new wp_query( $args ); ?> | |
<?php if($query->have_posts()): ?> | |
<?php while( $query->have_posts() ) : ?> | |
<?php $query->the_post(); ?> | |
// All Post relative stuff here | |
<?php the_title(); ?> | |
<?php echo esc_url( get_post_permalink() ); ?> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); ?> | |
<?php wp_reset_query(); ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment