Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

What should I do if my theme does not have a page.php file? But instead it has content-XXXX.php files?

Trying to create custom UI Post Type on the amibition theme by themeforest. Thank you

1 Answer

If there are no files in your theme called page.php or even page-XXXX.php, then chances are there's a lot of conditional stuff happening in the index.php file. If you look at the WordPress theme hierarchy, you'll see that static pages (like, say, /about/) have a specificity order that would go (left to right) page-about.php, which, if absent for the page the user is accessing, falls back to page.php, which if absent falls back to singular.php, which if absent falls back to index.php (far right of chart, it's the fallback template file for everything on your site).

content-XXXX.php files are named that way to indicate that they are partial include files. The theme developer would include them in another template file (I'm guessing in index.php in your case) like this:

<?php get_template_part('content', 'XXXX'); ?>

(Here's the docs on get_template_part.) Does that help you figure out what you need to do?