Forums

custom home page plus blog address page (4 posts)

  1. ozgeekmum
    Member
    Posted 3 years ago #

    We are planning a blog using wordpress as a CMS. The requirements are:

    1. Home page contains a fixed "About" page PLUS links to the last five blog posts.

    2. On the top menu, a separate link to the usual Blog format.

    a1. Running the latest version of WP, so experimented with using a static page as the home page. That happily displayed the About page, but what would be the best way of getting the extra php to run at the bottom of that page, to include links and extracts of the last 5 blog posts? Does it require a plugin to run extra php on the page? Will I be able to format it the way we'd like?

    a2. Is there a URL I could use to link directly to the normal blog format, given that I have already hijacked the home page with the About page?
    - Experimented using permalink variations - eg mysite.com/blog/month/post-name, hoping that i could link to mysite.com/blog, but that didn't work - got page not found.
    - Experimented using a custom template on a page. So created a page called mysite.com/blog/. Copied the code from index.php and called it blogpage.php. It is using it - I added comments. But it still just displays the content of the /blog/ page, rather than executing the loop.

    Any suggestions?

  2. Charles Frees-Melvin
    Member
    Posted 3 years ago #

    I would create a page template http://codex.wordpress.org/Pages#Page_Templates

    And add a "loop" to it and format it to meat your needs.

  3. ozgeekmum
    Member
    Posted 3 years ago #

    hi thee17,

    Yes I had created a new page template, called blog.
    Copied the index.php template, so that it has the identical LOOP.

    I then created a page called /blog/.
    I updated the /blog/ page to use the template called blog.

    But whereas I would have expected it to display all the blog posts on /blog/, it simply displays the sentence I had at the top of the /blog/ page.

    I've added comments to my blog page template, to prove that it got inside the loop.
    But the loop is only executing once.
    It's only displaying the content from the /blog/ page.
    Not retrieving and displaying the posts.

    Could there be some global variable that is restricting posts from displaying on a page?

  4. ozgeekmum
    Member
    Posted 3 years ago #

    Dóh.

    Worked out what the second drop-down field was for, on Settings/Reading.

    If you've nominated that the front page is something else, you then need to nominate which page is the posts page.

    simpsons moment.

    Now to work out how to put the last 5 posts at the bottom of the home page.

Topic Closed

This topic has been closed to new replies.

About this Topic