On the home.php, which is in the same folder where style.css is kept I am try to call a template:

<?php get_template_part( 'template-parts/content', 'home-default' ); ?>
  1. template-parts is a folder which is in the root folder same where we have style.css, like

- theme-directory
  -- template-parts
     --- content-home-default.php
  -- style.css
  -- home.php
  1. Template is: content-home-default.php in template-parts, which is in the root folder

But this is not able to fetch this template. I am a beginner so perhaps doing some nonsensical mistake. Can someone please guide me.

  • Your path seems to be correct. Make sure that whatever you are writing here is exactly same in your theme/plugin. If the folder template-parts is correct than I am unable to find any issue. I hope you are not doing this → '/template-parts/content' – The WP Intermediate Feb 11 '18 at 10:49
  • 1
    What did you mean by template-parts is a folder in style.css? home.php is used to list blog posts. Are you sure that home.php is being called? – obiPlabon Feb 11 '18 at 10:51
  • I believe she meant to says same as the root folder where style.css is kept. – The WP Intermediate Feb 11 '18 at 10:53
  • 1
    Are you sure you're viewing home.php on the front-end? Do other changes to the template appear? – Jacob Peattie Feb 11 '18 at 11:04
  • 1
    Yes, when I bring it in root folder and write this: <?php get_template_part( 'content', 'home-default' ); ?> then it works. but I wanted to organize things better. – wordpressgirl Feb 11 '18 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.