Advanced ordering of query_posts

I don’t think this is doable in a single WP API query. You just don’t sort whole set with single logic, you have logic changing halfway. I don’t think even SQL can express this. It is hard to advise without seeing specific circumstances (such as counts, pagination involved and so on), but my first thought … Read more

Pretty urls for custom pagination

You can handle this with WordPress’s internal rewrites system by adding a rewrite endpoint: function wpd_cpage_endpoint() { add_rewrite_endpoint( ‘cpage’, EP_PERMALINK ); } add_action( ‘init’, ‘wpd_cpage_endpoint’ ); This will add extra rewrite rules enabling /cpage/n/ on the end of permalinks. You can then fetch the value on those requests with get_query_var( ‘cpage’ ). EDIT- This is … Read more