How to sort posts (3 posts)

  1. d1maf3ar
    Posted 2 years ago #

    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?

  2. Jeffrey van Rossum
    Posted 2 years ago #

    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.

  3. d1maf3ar
    Posted 2 years ago #

    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".

Topic Closed

This topic has been closed to new replies.

About this Topic