• Hello All,
    I would like to know if it is possible to have my latest post be my home page. I know I can display the content and limit the display on the home page to 1 post but that’s not what I want.

    Is it possible to somehow “redirect” whenever someone requests my http://www.example.com would get http://www.example.com/latestpost) (the full post permalink).

    I was looking to maybe replace the <?php the_content(); ?> command in the index.php with a <?php the_latestPostPermalink(); command if something like that exists? Or something else to make my single.php show up rather than the index.php

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • mrmonster

    (@mrmonster)

    I’d like to know this too. So far, I’ve found workarounds that will recreate the latest post page “look” on the homepage (it, with comments and all), but not the actual page with the permalink in the address bar.

    Evandiaz, I found this, which will recreate the single post page experience on the home page:
    http://www.scriptygoddess.com/archives/2007/04/28/wordpress-make-home-page-show-latest-post-in-the-single-post-format/

    But like I said, is there any way to actually _redirect_ to the latest post, the actual permalink page?

    Samuel B

    (@samboll)

    you can do that with a redirect, but you would have to change the redirect every time you posted to get what you want. Not very efficient.

    c & p this file
    http://codex.wordpress.org/User:MichaelH/Redirectify
    save as redirectify.php
    upload it to your plugins folder
    activate it
    go to post or page editor
    below post – in custom field area – put
    redirect
    in value field – input your home url
    save post

    now any calls to home url will redirect to that post

    mrmonster

    (@mrmonster)

    Thanks, does that mean that you would also need to delete that home url value from the _previous_ post?

    You’re right, though, it’s not very efficient, though I don’t post too often, so it’ll do the job. To do it right would probably require a function that would check on the database for the latest post. I have something like this running on a Nucleus blog that I’m thinking of porting to WP. Someone over there posted some code that had this effect and I seem to recall that it actually went to check to see what the latest post was.

    Samuel B

    (@samboll)

    Thanks, does that mean that you would also need to delete that home url value from the _previous_ post?

    yes

    mrmonster

    (@mrmonster)

    Well, I asked the same question in the comments of that post over at Scriptygoddess.com I mentioned earlier, and the site owner offered up some code. Replace the contents of your main index file with this, and it should work (it did for me!):

    <?php
    require('./wp-blog-header.php');
    if (have_posts()) : the_post();
    header("location: ".get_permalink());
    exit;
    endif;
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can I Redirect “Home” to Latest Post Permalink?’ is closed to new replies.