• The theme I use is Sharepoint Like, which I downloaded fro Alex King’s site (https://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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    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.

    Thread Starter pramclub

    (@pramclub)

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    “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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Splitting sidebar code from template’ is closed to new replies.