Support » Fixing WordPress » Set latest portfolio post as home page

  • lisamattocks

    (@lisamattocks)


    Does anyone know if it is possible to set the home page to be the latest portfolio post.

    e.g I would like this to show today/now
    /portfolio/day-one/

    and then for example tonight at 12pm I would like this page /portfolio/firstnight/ to become the home page.

    I would then like to time another 80 posts to do this over 40 days and 40 nights. The newest post always being on the home page.

    I know how to set the time for the post but stupidly didn’t consider that I wouldn’t be able to set the portfolio posts to be the home page.

    Thanks so much for any help.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on how your site’s front page is set in settings. As a blog listing or a “static” front page. With the former, you can alter the query through the “pre_get_posts” action to just get the latest portfolio instead of the usual list of blogs.

    It looks like however that your home page is the static sort (static pages don’t have to be static). In that case you need custom template that makes the query (see WP_Query) for the latest portfolio post and outputs the result. If you name this template front-page.php and place it in your theme folder, it will be used for the home page output no matter which WP page is chosen as the front page.

    When your theme updates though, the file will be removed or overwritten. To keep custom work like this safe, create a child theme.

Viewing 1 replies (of 1 total)
  • The topic ‘Set latest portfolio post as home page’ is closed to new replies.