0

What is the best way to

  1. Show my "best 5 posts" in the front page of my site (www.example.com). The only way I have found to do this is by assigning a specific category to these post and show the category page. I do not want to introduce a new category for many reasons. But I could manually create the page or php file with the best posts if it is the only way.

  2. At the same time, have a "latest posts" page (probably the index.php (?)) that will appear in www.example.com/blog

What is the best way to achieve this without introducing a new category and how should the pages or php files should be called?

  • 1
    What constitutes "best" here? Most comments? Most views? etc – Christine Cooper Oct 27 '15 at 8:08
  • 1
    Define "Best" please. – Sisir Oct 27 '15 at 8:21
  • I mean 5 post which I will choose as the best in my opinion. – IXN Nov 21 '15 at 10:57
1

If you can live with manually deciding what your best posts are, Sticky Posts would be the way I´d choose.

The Codex already has code for the 5 latest sticky posts:

/* Sort Sticky Posts, newest at the top */
rsort( $sticky );

/* Get top 5 Sticky Posts */
$sticky = array_slice( $sticky, 0, 5 );

/* Query Sticky Posts */
$query = new WP_Query( array( 'post__in' => $sticky, 'ignore_sticky_posts' => 1 ) );
?>
| improve this answer | |
  • And then exclude sticky posts from the "latest posts" page? And how should each php file be named? – IXN Oct 27 '15 at 8:32
  • That would be the way to go, yes. – flomei Oct 27 '15 at 10:48
  • Regarding the "latest posts page". Well, you could use a Custom Page Template with a blank page which takes care of handling and displaying the 5 latest posts. You would then also have complete control over the design and everything else for that page. Name it "home" and set it to be displayed as your frontpage. Alternatively use a frontpage.php to take care of this. Many ways to go... – flomei Oct 27 '15 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.