List Custom Post Type anywhere


/ Published in: PHP
Save to your folder(s)

Useful for adding Custom Post types to navigation this will list all custom post type posts


Copy this code and paste it in your HTML
  1. <?php query_posts( array( 'post_type' => 'Beers', 'showposts' => 10 ) );
  2. if ( have_posts() ) : while ( have_posts() ) : the_post();
  3. ?>
  4. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  5.  
  6. <?php endwhile; endif; wp_reset_query(); ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.