I’m including a file by include_once
:
include_once( trailingslashit( get_stylesheet_directory() ) . '/recaptchalib.php' );
However I get warning from theme check plugin:
INFO: The theme appears to use include or require.
If these are being used to include separate sections of a template from independent files,
then get_template_part() should be used instead.
How can I include the above file using the get_template_part
?
If you take a look at the Codex page for
get_template_part()
, you fill find the following usage:That means you can use the following:
You can use this to include every file in your theme directory.
The template part works like this.
If you have file in main folder then you can do like this:
In this example the file name is
recaptchalib.php
.and if you have file in any other directory then you should called it by
In this example file is in
templates/layouts
and file name isrecaptchalib.php
.