WordPress.org

Forums

Page Templates (6 posts)

  1. vickyh
    Member
    Posted 8 years ago #

    I'm setting up my first wordpress site. I've taken a 2 column theme and modified with my own graphics etc. I've used a couple of widgets in the sidebar to display the most recent posts and meta stuff.

    I've created a few different pages: a home page, news page, projects page and contact us page. I've used the new option to choose the correct page for the home page, and the blog itself to appear on the news page.

    However, I'd like the sidebar on the news/blog pages to contain different things to the rest of the other pages. I'd like to be able to add the monthly archive and the categories lists in the sidebar.

    How do I go about doing this? Have I got to create a new page template which had a new sidebar in it?

    Thanks

  2. moshu
    Member
    Posted 8 years ago #

    Probably, yes.
    And/or you should use conditional tags:
    http://codex.wordpress.org/Conditional_Tags
    although I have no idea how the conditionals can be combined with the widgets (I don't use them).

  3. obscure
    Member
    Posted 8 years ago #

    I did it by creating a new side bar and putting that into the page template in place of the normal side bar (which I left in the single post template and the main index template). The default side bar is included using the command
    <?php get_sidebar(); ?>
    To replace it with your own content you need to alter the command to
    <?php include ('pagesidebar.php'); ?>

    You can see the difference between the two at
    http://www.obscure.co.uk/index.php and
    http://www.obscure.co.uk/blog/

  4. VisualBlip
    Member
    Posted 7 years ago #

    Hold on -- I know this is an old old posting, but it's worth a try.

    Obscure, it reads as if you created a new side bar which could be picked up by the page template. That's where I got lost. When I try to put the pagesidebar in, I lose all formatting on the page and the sidebars.

    How, please, do you create the sidebar you're trying to call up?

    Thanks!

    Brian

  5. khethridge
    Member
    Posted 7 years ago #

    I'm trying to do the same thing. I'm using the Cutline theme, and I've created two new sidebar files. I want the new sidebars to run on my Pages (as opposed to Posts). In my Page Template, I've changed the <?php include...> code to the new files.

    But...when I view my pages, they are no different from the rest of the site.

    Any ideas?

  6. moshu
    Member
    Posted 7 years ago #

    You must be doing something wrong.
    Is the newsidebar.php (or whatever it's name is) in the same folder as the rest of the template files, i.e. in the theme folder?
    What is exactly the line you are using to include it? And did you replace the get_sidebar with your include?

Topic Closed

This topic has been closed to new replies.

About this Topic