WordPress.org

Support

Support » How-To and Troubleshooting » How to sort posts

How to sort posts

  • Hello!
    My problem here is how to sort posts within one category with a twist. So my site is listing out posts, but i need to stick some of them in front for good. Like i have 3 posts that keep infront of other posts. And if i add a new post, it will be right behind these three that i have there for good. How can i solve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think your trying to make some posts “sticky”. You can make a post “sticky” by selecting its option under “Publish” >> “Public” >> “”Visibility”.

    Hope this helps.

    Actually, i left out some details. These posts are products. and i have a pager. Also, i have a search and when i use sticky post, it will display the sticky one wrong. currently i have a setup like this:

    $args = array(
    ‘paged’ => $paged,
    ‘posts_per_page’ => 16,
    ‘cat’ => 26,
    ‘gender’ => get_query_var(‘gender’),
    ‘age’ => get_query_var(‘age’),
    ‘location’ => get_query_var(‘location’),
    ‘color’ => $color,
    ‘meta_key’ => ‘sticky_order’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘ASC’,
    );
    i have to write 1 in every product that i want to make sticky. it kinda works, but it lists newly added posts last that doesnt have sticky “1”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to sort posts’ is closed to new replies.