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_post
needs to be checked if it is the front page.
<?php
query_posts('post_type=Beaudesert-Class');
while ( have_posts() ) : the_post ){
if ( is_front_page(the_post) ) {
}
else {
}
}
?>
Also do let us know what error message you are getting with your current code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.