• Hello,
    I found out that the Twenty Twenty-Two home page is perfectly capable of displaying all existing posts from different categories with great pagination support. Which is great !
    So : first and foremost, many thanks to the author(s) for this free theme !

    However, there is ONE post (of over 100) which has been set sticky. It happens to have been the very first post on the site, so it sits rightfully at the end of the pages of posts… but it is not displayed at the top of the first post page, as I was expecting it to be ! (Loop setup to include sticky posts)
    Previously the same site was running an older theme (Libretto) which displayed this sticky post at the very top of the home page. So, somehow the data structure seems correct, and it seems it is Twenty Twenty-Two which fails to pop the post at the top.
    Is there anything that I can do to fix this behaviour ?

    (Low pressure topic : I found out a better way to showcase this post on the front page anyway. Still reporting the behaviour, because someone might find it useful if there is a known fix. Or me later on in the lifecycle of the site!)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The Query Loop has an option to “Inherit query from template”. There is another option to display Sticky posts – only, include, or exclude. I am getting my stickies up top and everything following by using two query loops in the default Home page that displays all blog posts.

    In the Home template:
    This page is not filtered. The first query loop has Inherit Query unchecked, and Sticky Posts set to Include. The second query loop has Inherit Query unchecked, and Sticky Posts set to EXclude. So there are two loops, one for stickies, and the next for all others.

    The following would then be the way to create an archive page with stickies on top, using two query loops. However, don’t do this yet – see below.

    In the Archive template: This is filtered. The first query loop has Inherit Query checked, and Sticky Posts set to Include. The second query loop has Inherit Query checked, and Sticky Posts set to EXclude. So again, there are two loops, one for stickies, and the next for all others. This “should” do the job.

    But it looks like there is a bug, where an existing query causes the sticky selector to be ignored. So, where Inherit Query is checked, it doesn’t matter if Sticky Posts is set to Include, Exclude, or Only – stickies and non-stickies are both always shown. The correct selection is shown in the template editor, but not when rendering an archive page from the front-end.

    I hope this helps to explain the problem described in the OP, and that it helps others to craft some solutions now and in the future.

    Moderator Kathryn Presner

    (@zoonini)

    Hi @palijn

    I found out that the Twenty Twenty-Two home page is perfectly capable of displaying all existing posts from different categories with great pagination support. Which is great !
    So : first and foremost, many thanks to the author(s) for this free theme !

    Glad you’re liking the capabilities of Twenty Twenty-Two and Full Site Editing!

    However, there is ONE post (of over 100) which has been set sticky. It happens to have been the very first post on the site, so it sits rightfully at the end of the pages of posts… but it is not displayed at the top of the first post page, as I was expecting it to be ! (Loop setup to include sticky posts)

    I tried to replicate this on a test site. In the Home template (assuming you have your posts set to be displayed on the homepage, do you?) I toggled off the “Inherit query from template” option in the Query Loop block, and that caused my sticky post to be displayed at the top of the other posts, as expected. (With this option toggle on, the sticky post is not displayed at the top.)

    Editor beta Self hosted Test WordPress and Slack happ org com meetup questions A8C

    Could you give this a try and let me know if that gets your sticky post displaying at the top?

    If your posts are not on the homepage, you could make the same tweak to the Query Loop block in the Index template, instead of the Home template.

    @starbuck – thanks for your input as well! In my testing, I’m only using one Query Loop, so your issue may be different than this one, what do you think? You are welcome to report the two-Query Loop issue as a bug in Trac:
    https://core.trac.www.ads-software.com/

    @zoonini Unless I’m really sure, I tend to wait for confirmation that there is an issue before posting to Trac. I’m hoping you could try the following with your single-loop test environment?

    With Inherit Query off, see if the Sticky selector does what’s expected: Only, Include, Exclude. It should all work as expected.
    Then with Inherit Query on, do the same.

    My observation was as noted:

    But it looks like there is a bug, where an existing query causes the sticky selector to be ignored. So, where Inherit Query is checked, it doesn’t matter if Sticky Posts is set to Include, Exclude, or Only – stickies and non-stickies are both always shown. The correct selection is shown in the template editor, but not when rendering an archive page from the front-end.

    That also implies that in a test we need to publish and view the page from the site to see if it differs from the editor.

    Thanks!

    • This reply was modified 2 years, 3 months ago by Tony G.
    Moderator Kathryn Presner

    (@zoonini)

    @starbuck – thanks for the clarification on steps to replicate. I was indeed able to replicate the issue with “Inherit Query” active: sticky posts were never displayed on the front end, even when set to “Include” or “Only.”

    I found this bug report in the Gutenberg repo, which seems to address the issue – what do you think?

    https://github.com/WordPress/gutenberg/issues/38979

    Looks like a related Pull Request was just merged yesterday, which should be included in the next version of Gutenberg, and later brought into Core:

    https://github.com/WordPress/gutenberg/pull/40656

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sticky post not being shown at top of the post loop’ is closed to new replies.