• Resolved Nico Gauthier-Pin

    (@nlaspf)


    I’m using home.php to do a static home page that shows the latest post alongside some other stuff. What I want to do next is create a “blog” page, basically an archive that shows all posts. I noticed that when using pretty permalinks, a link to /archives will show this archive. The only problem is that pagination does not work there.

    I tried using custom queries and I tried using page templates, but I always get the same pagination problem. I searched the forums multiple times and I still can’t find a way to do something as simple as this. Is there any way to do this? I really would rather not use a plugin. It’d be easier if I can code it into the theme.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Dalton Rooney

    (@daltonrooney)

    Hi there,
    If I’m understanding you correctly, you want a blog somewhere underneath your static homepage, right? This is built into WordPress. You need to create two blank pages, one for home, and one for the blog. The home page will use a special template that you create just for it. Your blog page should just use the standard template, which is index.php.

    Then go to the Options menu and click the Reading tab, and select “Front Page displays a static page”. You want the home page to be the page with the special template, and the blog page to be the page with the standard template.

    That’s how this site is built:

    https://www.storycorps.net.

    The blog is https://www.storycorps.net/listen

    Good luck.

    moshu

    (@moshu)

    Oh, and remove the “home.php” from your theme – no need for it since the static frontpage option has been introduced!

    Thread Starter Nico Gauthier-Pin

    (@nlaspf)

    daltonrooney:

    I tried that, but a page template that includes a loop won’t work unless I do a custom query, and then the pagination doesn’t work.

    Is that site you linked to yours? How exactly did you manage to make it work??

    EDIT: No wait, I think it works… let me test some more.

    EDIT 2: Yup, it works! Thanks :).

    EDIT 3: Moshu: I see what you mean. I liked using home.php, it was easier for my clients to install the theme (less settings to deal with), but I guess I’ll have to stick to this method.

    Thread Starter Nico Gauthier-Pin

    (@nlaspf)

    This brings up another question. I made a Page called “Archives” and set for it a template that’s a copy of index.php. Now how do I reference this new Archives Page with conditional tags? is_page(‘Archives’) doesn’t work, nor does is_archive().

    moshu

    (@moshu)

    And what is template’s filename?

    Thread Starter Nico Gauthier-Pin

    (@nlaspf)

    The file is called archive_template.php, and the template name is Archive Template.

    moshu

    (@moshu)

    is_archive – should NOT work.

    Why is_page(‘Archives’) doesn’t work… it’s a mystery – unless there is a conflict with something in the nice permalink settings or another Page.
    What do you want to do with this Page? Better: what is it supposed to do?

    Thread Starter Nico Gauthier-Pin

    (@nlaspf)

    I know is_archive() shouldn’t work, but it was set already.

    The way this site is set up, the home page shows the lastest post, with some text on the sidebar. For the archive pages, I want to show categories, archives, etc, on the side as well. It works for category or date archives, but not for the Archives Page I made.

    What I’m using is if(is_archive() || is_single() || is_page(‘Archives’))

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Static home page AND blog page’ is closed to new replies.