WordPress.org

Ready to get started?Download WordPress

Forums

How to display all posts within a custom post type? (2 posts)

  1. kimmi_baby
    Member
    Posted 1 year ago #

    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?

  2. vtxyzzy
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic