Wordpress: different templates for different types of posts
December 2, 2023 7:26 PM   Subscribe

I am working on building a website in Wordpress, as hosted by my webhost. I want to have a few different types of recurring content, each with their own default post format, and I don't know how to build this in Wordpress.

I'm a new-newbie at using WordPress and while my technical skills are generally good, I'm finding it difficult to get a handle on the complexities of WordPress and all the different editors and plug-ins and templates and how they inter-relate.

In an ideal world, this is the sort of thing I would be able to do:

Decide I want to create a new post that is, say, a music review.
I select an option to add a post and get asked what type, or I select an option to add a post of that type.
I get a template to fill in, that includes uploading album cover art, a title block that includes Artist, Album Name, and Year of Release, and a link offsite, and a text block that includes the review.
I save the new post, and it is added to my site, and shows up automatically on a page that includes only music reviews and is formatted specifically for showing album covers.

Decide I want to create a new post that is, say, a recipe card. As above, select that post type to create in some way and get a template to fill in. This template is obviously very different from above, with different fields and layouts, including a recipe category like 'breakfast' or 'dessert'.
I save the new post and it is added to my site, and shows up automatically on a page that includes only recipes and is formatted specifically for displaying recipes by category.

There are other post types I would like to create but the requirements are similar - I want a different template for each type, and I want separate overview/index pages for each type, as well. There are a million things that seem like they should do this built into the Wordpress but none of them seem to actually do this, or at least I am using them wrong. I have downloaded some plugins that seems like they are supposed to do this based on the descriptions but they also don't seem to do this or at least I am using them wrong.

The tutorials I can find are either too basic 'here's how you create a post and write things' or too specific 'here's how you can custom code a new template page in PHP' -- I need something in the middle, but I'm not having luck searching it out.
posted by jacquilynne to Computers & Internet (3 answers total)
 
Would you be okay using the Advanced Custom Fields plugin? Basically, you make custom post types with the CPT UI plugin, you make field groups for each post type in Advanced Custom Fields, and then you make copies of your theme's single.php (such as single-recipe.php) and replace the_content() with your fields you defined. ACF has lots of help online. Much of your coding is going to be the get_field and the_field methods.

If you want to minimize coding, and your theme allows it, Elementor Pro lets you make custom post type templates and it hooks your ACF fields into them for you. Elementor has some overview articles for this like https://elementor.com/blog/wordpress-custom-fields/
posted by michaelh at 9:27 PM on December 2, 2023 [3 favorites]


I haven't used Advanced Custom Fields, but I have used Pods.io and it is basically what you want. I think the two are equivalent.

With Pods, you create a new post type—recipes, reviews, etc—which will appear in your admin sidebar alongside posts, pages, etc. You'll need to know a little bit of HTML to write a stub template that defines how the post type is displayed, and CSS to style it. You can have different stub templates that you invoke in different contexts.

Getting all your different post types to appear in one stream (if that's your goal) might take some fooling around. I haven't tried to do that. You'll probably be dealing with queries; I've found that using a shortcode plugin like Display Posts is easier than messing around with the theme files.

I'd recommend setting up a test site to play around with this stuff before putting it into production.
posted by adamrice at 9:14 AM on December 3, 2023 [1 favorite]


Can be done with Elementor as well.
posted by terrapin at 7:48 AM on December 4, 2023


« Older My cat has itchy bumps and I want to help   |   How to stop relatives from seeing sites I visit... Newer »

You are not logged in, either login or create an account to post comments