WordPress.org

Ready to get started?Download WordPress

Forums

Display single post view by default instead of index (1 post)

  1. 123jonny
    Member
    Posted 4 years ago #

    Disclaimer: I can follow and edit *some* php, so hopefully what I'm trying to do isn't outta my reach.

    Instead of a user hitting my domain and seeing the typical list view of the posts (index.php), I'd like to push them directly into the most recent post, in the single page view (single.php). The REASON I'd like to do this is because I intend to apply custom styling (via a custom field) to certain posts at times.

    My current approach was this... I have the custom CSS being detected just fine using a custom field and some extra PHP in the header to look for that field. I then limited the number of posts displayed at a time to 1. Next, I tried "forcing" the index.php to display as the single.php essentially by duplicating the code from single into the index. ...Well, it displays and navigates just fine, but it's still seeing things in list view instead of the single page view, and it's not detecting the custom style/field. Looking at the URLs in this current approach, I can see that it's not displaying the permalink page for each post as I intended, but rather treating them as pages from the post list (URLs read like http://www.domain.com/pages/2/ instead of http://www.domain.com/2009/test-post).

    Hope this makes sense, and perhaps someone can provide some clarity! If I am approaching this completely backwards, please enlighten me! It was the only approach I could see off the top of my head, and I've found little to no additional info on executing this.

    Thanks in advance,
    Jonny

Topic Closed

This topic has been closed to new replies.

About this Topic