I recently began building a WordPress site that doesn’t actually have a homepage. When visited, you are presented with a single, random post. I’ve done this using the following code on index.php.
query_posts( 'posts_per_page=1&orderby=rand' );
This works for displaying a random post when visiting the site, but isn’t working well for SEO purposes. Instead of using the meta title and meta description for the single post, I get the general meta info (Site name and Site Description).
What I’m looking for is a way to display the posts on the homepage using single.php so each post will have the correct meta info for the single post.
I tried creating a custom page template using the same code as I did for index.php and setting it as my static homepage, but for some reason I can’t get it to work. I have tried researching this issue, but haven’t been able to find a solution.
Does anyone have any suggestions on how to do this? I can provide more information if need be.
- The topic ‘Display Random Single Post As Static Homepage’ is closed to new replies.