WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List Posts from Custom Post Types anywhere (3 posts)

  1. Philip
    Member
    Posted 3 years ago #

    hi my friends,

    i try to find how i can call a numbers of posts from a custom post type category in the sidebar or other theme templates outside the loop.

    i try to build something like the latest posts widget(that comes pre-build) but to include the custom post type posts.

    is that possible?

    thanks a lot,
    Philip

  2. dogshindleg
    Member
    Posted 3 years ago #

    <?php
      query_posts( array( 'post_type' => 'custom_post_type_name', 'showposts' => 10 ) );
      if ( have_posts() ) : while ( have_posts() ) : the_post();
    ?>
    
      <h3><?php the_title(); ?></h3>
    
    <?php endwhile; endif; wp_reset_query(); ?>
  3. Philip
    Member
    Posted 3 years ago #

    thanks a lot dogshindleg

Topic Closed

This topic has been closed to new replies.

About this Topic