php – Does wordpress templates always in files or in database?

Question

But there is no content directory in template directory.

Actually, with the following:

  • get_template_part( 'templates/content', 'header-private' );
  • get_template_part( 'templates/content', 'header-public' );

WordPress will search in the templates folder for content-header-private.php or content-header-public.php, and if found, it is loaded. Else, WordPress will attempt to load the content.php file instead.

So WordPress (or get_template_part()) will not search in a folder named content, and instead WordPress will search for PHP files where the name begins with content-. And if none found, then content.php is loaded, if it exists.

Check out the get_template_part() documentation for more details about (using) the function.

0
Avijit Palit 4 months 2022-04-01T00:04:11-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse