I’ve created a custom post type for classes at a gym. I have a page called classes which has a title and a brief description.
I would like to display the custom post type below it. I would like to display all posts within the custom post type.
This is the layout I would like:
Title – Classes
Brief Text.
Custom Post type post – title
custom post type post – text
Custom post type post – title
custom post type post – text
At the moment I’m using the following:
<?php query_posts( 'post_type=Beaudesert-Class'); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php if ( is_front_page() ) { ?>
<?php } else { ?>
<?php } ?>
This only displays one of the posts and I can no longer display the title and the content of the classes page.
Can anyone help me with this?
I think that you have a syntax error when you try looping over the posts. Depending on how you’ve written your code,
the_postneeds to be checked if it is the front page.Also do let us know what error message you are getting with your current code.