![]() The WordPress get_template_directory() function Using a relative path (best practice) – the path related to the present working directly(pwd), starting at your current directory and never starts with a “/”.Using a absolute/static path (not recommended) – specifying the location of a file or directory from the root directory(/).There are multiple ways to go about this, such as: When you want to include a PHP file (or image file, HTML file, etc.), it is required to specify a specific path that instructs the webserver, on where the webserver should locate the specific file. Why you should choose a relative path and not an absolute/static path This snippet isn’t so much a “WordPress snippet”, but really just the PHP include function, using WordPress get_template_directoryto get the relative path for the file. ![]() This little “PHP include” guide, will show you how to include a PHP-file in your WordPress theme (using a relative path).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |