• Resolved pedjas

    (@pedjas)


    I have a page that contains QueryLoop to show all posts sorted from newest to oldest.

    When posts are displayed on archive page, sticky posts are shown at the top, regarding of post date. I can live with that, but…

    If there are lot of posts so Archive is shown paged, on each page, sticky posts are on the top and then rest comes. This is quite annoying. When users lists pages he sees all the same post again and again.

    As I said, it would be OK if sticky post are displayed only on the first page but I would prefer to have option to simply ignore sticky flag and show posts sorted by date only.

    QueryLoop has option to shows sticky posts, not to show them and only to shows them. There is no option to ignore sticky state.

    Is there a way I can accomplish this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s odd that you get stickies on every page. They are only supposed to be on the first page (first paragraph after the jump).

    Since things are not as I expect, the following may not work. The appearance of stickies can usually be managed through the “ignore_sticky_posts” query var. This suggestion does involve some custom coding. “ignore_sticky_posts” can be set or altered through the “pre_get_posts” action. For example, if the “paged” query var (the requested page number) is greater than 1, set “ignore_sticky_posts” to true.

    One of the challenges in doing something like this is ensuring the logic is only applied where you want it and not where you don’t. But if you like the same behavior everywhere, it greatly simplifies things. You’d still need to verify it’s for a main query, it’s not an admin request, and the query is for “post” post type.

    Thread Starter pedjas

    (@pedjas)

    I had some plugin that for some reason forced showing sticky post on each and every loop. I got rid of it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to set Query Loop to ignore sticky flag?’ is closed to new replies.