0
votes

I'm just new in wordpress, I just wanted to ask if it's a bad practice if I'll create page template for every custom post types? I mean if I have CPT [custom post type] with different content, like my first CPT has images, my 2nd cpt has image and text, my last CPT, has slider, text and description.

Because I wanted to create page template for every type of CPT's I have. Is it a bad practice? Or are there efficient and effective ways to do such things?

Your answers are highly appreciated. Thanks!

2

2 Answers

0
votes

It's better not to do that, not only because it's a server load, but also because you'll get crazy if you have an issue. Instead, use conditionals in the same page. You can read about it at WP Codex: Conditional Tags : Taxonomies and then pay attention to the is_tax and has_term tags.

This way, you can use is_tag or has_term depending on your approach, like this

if( has_term( 'jazz', 'genre' ) ) {
// do something
}
0
votes

You can use taxonomy to deal with such problem. Use taxonomy to filter contents according to your requirements. Use register_taxonomy() to register a taxonomy for CPT.