WordPress.org

Ready to get started?Download WordPress

Forums

How do I display Posts to a specific PHP page? (3 posts)

  1. charles_i
    Member
    Posted 5 years ago #

    I have created a posts page called blog.php and a page in Pages called blog.html - I have added
    /*
    Template Name: Blog
    */
    to the top of blog.php and selected "Blog" as my Posts Page in the Dashboard - but the posts still default to index.php - how can I get blog.html to use blog.php as my Blog home page?

    Thanks
    Charles

  2. charles_i
    Member
    Posted 5 years ago #

    After a lot of experimentation naming and renaming php pages and seeing what loads I have determined that...

    ...the only way to assign a Page created in Pages to display posts is to turn Set Posts page OFF (- select -), otherwise it will use the Posts will use the hierarchy. Assigning a named page in Set Posts page will fall back to using index.php, page.php or single.php instead of a page created in Pages.

  3. charles_i
    Member
    Posted 5 years ago #

    Furthermore you can't use a name like blog or WP will default to it's own template and give weird results i.e. even when I renamed single.php single3.php it defaulted to that file and when I removed single3.php I discovered WP bypassed my blog.php file for its own template - as soon as I named the file something else it worked.

Topic Closed

This topic has been closed to new replies.

About this Topic