you’ll need to create a new page called home, then create a new template for that page and include a custom loop that queries the database for your custom post type and apply that template to your new home page. then in settings -> reading, select your home page as a static front page.
if none of that made sense to you then you may be facing a fair old mountain to climb!
Thread Starter
Robert
(@robg48)
Hey Jack – thanks for the response! And it’s all a mountain 🙂
I get most of it…but it’s not just the front page…I have themes I use that display “the top 10…the most viewed…the highest rated…” etc…and it seems those are not getting recognized by WP because they’re custom post types.
yeah, in order for wordpress to recognise them you have to tell it to go look for them, the custom post type is created and added to the database but until you actually call the database and ask for the content nothing happens.
make a backup of your site just as you’ll be making tweaks to files. also, if you’re not using a child theme, now’s a perfect time to set one up!
take your parent theme’s page.php file and copy it over to your child theme (i hope you’re using a child theme!) and rename it page-(insert your custom post type name here).php and change the header (the bit in the /** **/ at the top of the file) to read
/*
Template Name: (call it what you want)
*/
next, apply this template to the page you’re using for the home page and save your changes.
next up, you need to create a custom loop to call the database and then add in some php to show the results on the front end.
<?php $args = array('post_type' => 'name_of_post_type');
$query = new WP_Query($args);
while( $query->have_posts() : $query->the_post() );
?>
html goes here...
<?php echo types_render_field( 'field_name', array( 'output' => 'raw' ) ); ?>
end of your html...
<?php endwhile; ?>
it’s a bit of a steep curve but it’s worth it with the cool stuff you can do with custom post types. keep referring to the types by toolset website and the wordpress codex for more information on how to get this done.
Thread Starter
Robert
(@robg48)
Hi Jack,
Thanks for the info – doesn’t look too hard 😉
I appreciate the time!
Rob
no worries, good luck and enjoy playing about with it 😀