WordPress.org

Ready to get started?Download WordPress

Forums

changing the template for Blog pages/pagination (5 posts)

  1. scormeny
    Member
    Posted 4 years ago #

    I hope I'm missing something obvious here...

    I have a site in progress at http://managebest.net/gpr . This is a site that is primarily a static site advertising a PR business.

    The front page and all the "pages" of the site use the page.php template.

    I want the "Blog" page, which lists the five most recent blog entries and lets someone go to "Older Entries" and "Newer Entries," to be in a different template.

    Right now, I'm using a blog-page.php template that I created myself that is associated with the page titled Blog (it's the last item in the navigation at the top of the page), and it does let me include excerpts of the five most recent blog entries.

    However, it does not show previous and next links, even with the appropriate (I think) previous and next coding in the template (to wit):

    <div class="alignleft"><?php next_posts_link(' Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries') ?></div>

    Is there a way to make next_posts_link and previous_posts_link work in a page template? Or should I instead redirect to http://managebest.net/gpr/page/1 , which uses the index.php template and where the navigation seems to be working?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Get rid of the blog-page.php template and let the Blog page default to index.php.

  3. scormeny
    Member
    Posted 4 years ago #

    And then in order to link to that page with my list of blog entries, esmi, do I force a link to http://www.mydomain.com/page/1 for the "Blog" link in my navigation? Or is there some better way to link to the Blog page if it's not the front page of the site?

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Don't make any other changes initially. Just see how it works without a custom template first. If the Next/Previous links start working correctly, you can then look at customising the index.php template file if you want a different kind of post display. The link in your navigation menu will still work.

  5. scormeny
    Member
    Posted 4 years ago #

    No, your suggestion doesn't work. When I enter http://mydomain.com/index.php , I end up at the front page of the site, which is a page, not the blog entries. I think you and I must not be talking about the same thing -- as I stated in my initial message in this thread, the front page of the web site is NOT the blog page, it's a static page.

    What I've done instead is that I am using http://mydomain.com/page/1 as the blog page on my site. And I've put a redirect in my .htaccess file to make http://mydomain.com/blog redirect to http://mydomain.com/page/1 so that my client can share an elegant, non-confusing URL to the front page of her blog.

    The site is now live, and no longer at the URL in my first message -- you can see it at http://bit.ly/doGdzC

    This is an issue for me on other sites for clients as well -- it would be great to find a fix.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.