Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/njedesig/public_html/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
Display CPT's using template file not being used | NJE Design

Display CPT’s using template file not being used

Warning: count(): Parameter must be an array or an object that implements Countable in /home/njedesig/public_html/wp/wp-content/plugins/microkids-related-posts/microkids-related-posts.php on line 645

When using custom template file, (for example – tmpl-programs.php), to display custom post types (programs) in a theme, there are some common behavior that can cause problems.

When our page that uses a custom template file, archive.php file is used instead, which isn’t what we want. Alternately, we can create a file with the name archive-{post_type}.php to display our CTP’s.

Using a plugin like what the file, has been super helpful when trying to figure out these common issues like what file is being used.

Also, going to review the WordPress file hierarchy may help solve this.

Check for our CPT declaration, and make sure that has_archive is set to false in our CPT plugin.

Another thing that is easy to forget is not saving your permalinks afterwards.


by Norm Euker