This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Tagged: 

Sticky posts?

  • Creator
    Topic
  • #13876
    royeyal
    Participant

    Hi there
    Is there a way to make post lists, i.e. in the Builder, not to ignore sticky posts?
    Some of my clients want to pin posts using layouts, but they can’t.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #13889
    Jason Bobich
    Keymaster

    Hi,

    You would need to use the paginated Post List, opposed to the non-paginated Post List element. When you use the non-paginated post list, we’re using get_posts(), which to my knowledge doesn’t take into account sticky posts.

    http://ageekandhisblog.com/wordpress-get_posts-show-sticky-posts-first/

    Here’s an example I setup. In this layout there’s a standard post list followed by a paginated post list. The post titled “Cheap cars can photograph well” is a sticky post. You can see it’s pinned to the top only on the second paginated post list.

    http://www.demoblvd.com/themes/jumpstart/test-2/

    #13891
    royeyal
    Participant

    Thanks for the lengthy explanation.

    Well, I’m already using a Paginated Post List…

    I’m a bit confused… If the post titled “Cheap cars can photograph well” is a sticky post, why isn’t it first? It’s the second post on the demo.

    So, how can I program the Paginated Post List element not to ignore sticky posts?
    Should I just use a widget with custom query for those cases?

    Thanks!

    #13893
    Jason Bobich
    Keymaster

    I’m a bit confused… If the post titled “Cheap cars can photograph well” is a sticky post, why isn’t it first? It’s the second post on the demo.

    Look a little closer there. On that link I provided, there are two post lists, one after another. The first one is a non-paginated post list. That one doesn’t reflect the sticky post. Then, scroll down to the dashed divider line where the second, paginated post list starts. — There you will see that “Cheap cars can photograph well” is the first post. My point was to show you the two side by side.

    So, what I’m getting at is that the paginated post list should work to display sticky posts first.

    So, how can I program the Paginated Post List element not to ignore sticky posts?

    It should already be working. So, let’s try to troubleshoot and figure out more specifically what you’re doing in your layout. Do you have another query somewhere else on the page? Does your post list contain custom query? What options have you selected for how it’s queried? i.e. from a category? etc?

    #13902
    royeyal
    Participant

    I see.
    Didn’t know that get_posts ignores sticky posts, and using array_merge and array_slice is a bit of an overkill 🙂

    But still – I’m
    and it ignored the sticky posts altogether.

    I’ve found out that, while using “Post List (paginated)” on a layout in the Builder, ticking a parent category, or all relevant categories, failed to use the sticky post. But ticking “All Categories” fixed the problem.

    #13905
    Jason Bobich
    Keymaster

    Yeah, so I think these are just little different quirks with WordPress queries. If you filter by a category, I think WordPress WP_Query just doesn’t recognize the sticky posts. It’s not really anything to do with our layout builder specifically. How we’re setting up the queries is pretty basic stuff, you know? If my understanding is correct, sticky posts are designed to be for the front page of posts in your classic blog type of setup.

    And actually reading the codex page for sticky posts, it says that:

    If checked, the post will be placed at the top of the front page of posts, keeping it there until new posts are published.

    From: http://codex.wordpress.org/Sticky_Posts

    It’s interesting now reading that and click around. So, on the Jump Start live demo, I’ve got that “Cheap cars can photograph well” as a sticky post. That and the post “The city is powering down for the night” are both in the same category. If you look at the front page of posts (just standard WordPress blog homepage), you can see how the sticky post comes first:

    http://www.demoblvd.com/themes/jumpstart/

    But when you click through to the standard WordPress archive for the category of those two posts (no Jump Start queries involved at all), you can see how the posts are now in chronological order, ignoring the sticky post:

    http://www.demoblvd.com/themes/jumpstart/category/parent-category-ii/

    #13911
    royeyal
    Participant

    Hmmm… I’ve using WordPress for years now, and only now I’ve realized all that.

    Thank you for the thorough investigation! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.