$locate = locate_template( 'widgets/the-post-widget.php' );

I am using the above path and method to include a file in functions.php, but that is not happening.

The file doesn't seem to include. Am I doing a mistake?


locate_template just returns the filename of the template. If you want to load the template, set the second argument to true:

locate_template( 'widgets/the-post-widget.php', true );

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.