About the Project
WP Custom Post Order is a scoring system I built on a client’s request. It sorts a blog’s published posts by a score. The score combines the number of times a post was favorited, a popularity constant set in the admin, and the post’s age.
The client’s site had thousands of posts, so the sort had to stay correct as favorites and dates changed. The favorites feature comes from the open-source WP Favorite Posts plugin, which I extended with the scoring logic and an integration with the theme’s post loop.
Problem
The blog had thousands of posts, and the default order showed old posts as often as new ones. The client wanted new posts to appear first, with popular posts ranked above the rest, and the weights adjustable without changing code.
Role
Solo developer. I designed the scoring algorithm with the client, wrote the scoring functions, added the admin settings for the constants, integrated the ordering with the theme’s archive loop, and tested the result on a staging site with 2,500 posts.
Stack
Outcome
FAQ
How is the order decided?
Each post gets a score: stored maximum score, plus the favorites count times a popularity constant, plus a date constant times the number of days since publication. Newer posts score higher, and popular posts rise.
Who controls the weights?
The admin sets the popularity and date constants in the WP Favorite Posts settings.
Do readers need accounts?
No. Guests save favorites in cookies. Logged-in users save them in their user data.
Which WordPress versions?
The base plugin, WP Favorite Posts, was tested up to WordPress 3.2.1.