WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Template (3 posts)

  1. jOLT
    Member
    Posted 4 years ago #

    Hello,

    I think this is a relatively simple question, but I couldn't dig up any answers about it.

    To call on the sidebar, we use the following code;

    <?php get_sidebar(); ?>

    I would like to create another sidebar type file that I can call upon in a similar fashion to the sidebar, so I don't have to edit every single template.

    So for example I might have a box on my site that I want to show on every page, but instead of editing every single template it's on, I want to have something like this in the code;

    <?php get_smallbox(); ?>

    Which then links to a php file in my theme directory that works in the same way the sidebar does.

    I assume this is easy to do?

    Hopefully that makes sense!

  2. keesiemeijer
    moderator
    Posted 4 years ago #

    if you put the smallbox.php file in your theme folder you can use this:
    <?php include('smallbox.php');?>

  3. jOLT
    Member
    Posted 4 years ago #

    Yep, that works perfectly.

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.