Return to Snippet

Revision: 45044
at April 22, 2011 18:07 by zealmurapa


Initial Code
//when 'blog' is the custom post type
 <?php $args = array( 'post_type' => 'blog', 'posts_per_page' => 1);
		$loop = new WP_Query( $args ); ?>
		<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
		<?php endwhile; ?>

Initial URL

                                

Initial Description
Query any Post Type anywhere

Initial Title
Query any Post Type anywhere

Initial Tags
post, query

Initial Language
PHP