- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Apologies for all the questions, but I am new to WordPress (not new to CMS though).
I have a page with three columns in a custom template. I have already used the sidebar.php for one column but would really like to place one other column in an includes file.
I tried creating pagesidebar.php and sidebar2.php, but each time I get a fatal error when I call it from the page.php file. I am using the following to call it:
<?php pagesidebar.php(); ?>
Are there limits or guidelines to creating “includes” files?
I would appreciate some help on this.
Thanks.
If you want to include a file with WordPress you would use:
<?php get_template_part('inc/pagesidebar'); ?>
The file pagesidebar.php
would reside in the inc
folder in your theme folder.
theme/
theme/inc/
theme/inc/pagesidebar.php
Note you do not need to provide .php
with above function.
Read more here: http://codex.wordpress.org/Function_Reference/get_template_part
Alen, very helpful. That works and I presume that it can still accept all the normal WP functions and parameters as a regular file?
Thank you.