WordPress.org

Support

Support » How-To and Troubleshooting » How to display all posts within a custom post type?

How to display all posts within a custom post type?

  • Hi,

    I have a page called classes. I have a custom post type set up to add all the classes. I would like this custom post type and all it’s posts to be displayed on the classes page. I have found that I can use:

    <?php query_posts( 'post_type=Beaudesert-Class'); ?>
          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
            <?php if ( is_front_page() ) { ?>
            <?php } else { ?>
            <?php } ?>

    My problem is that it overrides everything on the classes page like the title and the text. I would like the custom post type content to appear below the classes text and title.

    I would like it to be set like this:

    Classes title
    intro to classes

    Custom post type post title
    custom post type text

    Custom post type post title
    custom post type text

    Can anyone help me with this?

Viewing 1 replies (of 1 total)
  • You need to precede the code you posted with a Loop that displays the content of the current page before issuing the query for the class posts.

    The exact code you use will depend on your theme. You should be able to get the code from one of the other PHP files in your theme.

Viewing 1 replies (of 1 total)
  • The topic ‘How to display all posts within a custom post type?’ is closed to new replies.
Skip to toolbar