pramclub
Member
Posted 5 years ago #
The theme I use is Sharepoint Like, which I downloaded fro Alex King's site (http://alexking.org/projects/wordpress/themes) and the header, footer and sidebar code is all included in the main page template.
I haven’t upgraded to 2.1 yet, but before I do is this the time I should think about splitting the code into separate files? I’ve only been using WP for a month, so I don’t want to take on anything that’s going to cause a zillion problems. I'm experienced with HTML and some CSS, but this is my first experience with php.
TIA
It's easy. Take the sidebar code. Copy and paste it into a file called "sidebar.php". Where the sidebar code was, put this:
<?php get_sidebar(); ?>
Done and done. You can also do this with these:
<?php get_header(); ?>
<?php get_footer(); ?>
to refer to header.php and footer.php, respectively.
These three are special cases in WordPress and so have their own functions to deal with them.
pramclub
Member
Posted 5 years ago #
Thanks Otto - is it better to have separate files for these sections? Many templates seem to be created that way, and I'm not sure if that's a more recent method, which will become a required standard in WP eventually.
"Better" is a relative term. I like having them separate, but some people don't. There can be pros and cons either way.
I'd separate them, but that's just me. I like them separate to keep them clearly defined.