Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • joecat

    (@joecat)

    I have a question and hopefully an answer to LeeEldridge’s question.
    (Though I see the post is over 1 month old – I hope it is solved already.)

    Made two edits to page-static.php
    Added template name
    Renamed get_sidebar to get_sidebar2

    Just changing the function call from get_sidebar to get_sidebar2 is not enough. You get the error because the function get_sidebar2 does not exist – you’ll need to create the function. An easier way is to rename your second sidebar template to sidebar-2.php and then use <?php get_sidebar(’2’); ?>. (This makes use of WordPress’s template naming conventions.)

    My Question:
    Do you also need to register the new widget areas in function.php?
    I did everything above, but a different widget area does not show up in my wp-admin page.

    Thread Starter joecat

    (@joecat)

    Thanks Shane,

    That’s exactly what I needed. I’m finally starting to understand the use of various templates and I can see that there is definitely a few ways to do things – for example just using the index.php but using if statements to select the behavior depending on which page you are displaying. Like you said, it’s preference!

    Karen

    Thread Starter joecat

    (@joecat)

    OK, it seems it wasn’t too clear in my original post. My problem was that my news page was not displaying posts and I didn’t know how to do it.

    I want the posts to appear on 2 separate pages – on the front page as excerpts, and then in full on a News page.

    I had been working on the a couple of days and I think writing out my question clarified my thinking and I got it to work like this.

    I modified index.php to show only excerpts.
    In page.php, I added the conditional if (is_page(‘news’)) and then if it was, I displayed the posts.

    The downside is that I hardcoded the intro content on my homepage into index.php.

    Is there a way to to not hard code it?

    I was thinking this:
    1. Create a page called Home, where you can write the intro content.
    2. In the code that displays the menu bar, exclude the home page, so that it does not show up twice.
    3. Edit page.php to add a loop to display the excerpts if the page is “Home”

    The down side to this now is that your “Home page” is <base_url>/home and I would have to point my base url to this page.

    Both methods seem a little ‘hacky’ to me.
    How have other people solved this problem?

Viewing 3 replies - 1 through 3 (of 3 total)