[Resolved] Sticky posts: issue + how-to style as featured post

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Sticky posts: issue + how-to style as featured post

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28944
    P
    Participant

    Dear Team,

    I’m running WPSP Pro (1.1.3 + Pro 1.0.0) and GP Premium (1.12.3) on a client’s website. For the News section, we use a WPSP list to select and present blog posts from specific categories. We’re using a 3col format, posts ordered by date, with “Pagination” and “Ajax pagination” active, “Featured Post” selected and “Ignore sticky post” not selected, without selecting or excluding any post IDs. Further, we are not using any extra code snippet in theme.php for this particular list.

    We would like to have a sticky post at the top of the list and have it styled as the featured posts (ie double-width card), in a way that the client can manage it via the normal WP options (no php/css editing, simply select which post is sticky). I reviewed existing posts, and it seems this is not possible “out of the box” given how the plugin and WP queries work. While trying a few things, the following issue and questions came up:

    Issue: the post marked as Sticky post does not go to the top of the list, even after we: 1) disable the “Featured Post” option and re-save the list, AND 2) save the relevant post twice, after unticking and ticking the sticky option, AND 3) clean the cached pages. For now, we resorted to changing the publishing date, which is not ideal. What can i do further, to keep the sticky post at the beginning of the list (even with newer posts) and every following post ordered from newest to oldest?

    Question 1: Is this combination of sticky and featured indeed not possible with WPSP and is this maybe in the pipeline?

    Question 2: As an alternative, ff we deactivate the “Featured Post” option, could we still apply some custom css to the “sticky” post in this specific list in order to replicate the styling done by WPSP? Or do you see any potential problem arising from this? It should be possible to target things fairly accurately, no?

    Thank you in advance for your help and kind regards,
    Paulo

    #28970
    elvin
    Moderator

    I’ve attempted to replicate this issue by setting a post to sticky and it works on my end.

    See my sandbox site here. “Hello world!” post is set to sticky. https://dev-generate-press.pantheonsite.io/wp_show_posts-id1821/

    The “featured post” feature simply takes the latest post and styles it differently.

    To answer the question/s:

    Question 1: Is this combination of sticky and featured indeed not possible with WPSP and is this maybe in the pipeline?

    It’s possible as shown on my sandbox site. Although, sticky may not work if you set a custom query for your WPSP list by PHP snippet or shortcode args (settings=””).

    Question 2: As an alternative, ff we deactivate the “Featured Post” option, could we still apply some custom css to the “sticky” post in this specific list in order to replicate the styling done by WPSP? Or do you see any potential problem arising from this? It should be possible to target things fairly accurately, no?

    The best practice is to solve why it isn’t working in the first place.

    There shouldn’t be that much of a problem w/ CSS changes as it doesn’t affect the backend. Just make sure it’s properly syntaxed and added on the appropriate place for it.

    #28999
    P
    Participant

    Hi Elvin,

    Thank you for the quick follow-up.
    Your sandbox link has likely changed and i can only see one article, but that’s ok – I assume it all works normally 🙂

    Regarding the sticky issue: i still can’t get it to work correctly on this site. I’ve re-checked and, for this particular list, the shortcode used has no extra args and there is no applicable php snippet in functions.php. There are a few extra snippets that target other lists, but they all specify the action by id; i expect this is not a cause.
    If i use the “Posts” block from Kadence Blocks, the sticky post stay on top of the list even if there are newer ones.
    I’ll try a partial rebuild in a staging site and go through other potential sources: deactivate all php snippets, side-effect from another plugin (like autooptimize), hosting settings. I’ll get back to you in case the issue persists.

    Regarding Question 1: i could not see it in the sandbox link. Still, maybe i need to restate my question as “with the options given by WPSP Pro, can i keep a sticky post at the top of the list AND apply the “featured post” look to it even when the sticky post is not the most recent one?” Previous forum threads indicated “no” but your answer says “yes”.

    As for Questions 2: thanks, i agree. I would simply add the extra styling in the “custom.css”.

    Best regards,
    Paulo

    #29029
    elvin
    Moderator

    Thank you for the quick follow-up.
    Your sandbox link has likely changed and i can only see one article, but that’s ok – I assume it all works normally 🙂

    Ah yes my bad. I was playing around with it for the other user’s topics. But yeah it works.

    Posts marked as “sticky” goes to the top of the list.

    Regarding Question 1: i could not see it in the sandbox link. Still, maybe i need to restate my question as “with the options given by WPSP Pro, can i keep a sticky post at the top of the list AND apply the “featured post” look to it even when the sticky post is not the most recent one?” Previous forum threads indicated “no” but your answer says “yes”.

    I made a new demo page for you to check. https://dev-generate-press.pantheonsite.io/https-wpshowposts-com-support-topic-sticky-posts-issue-how-to-style-as-featured-post-post-28999/

    Here’s a “tour” of how it was set up: https://share.getcloudapp.com/E0uYzyqX

    Same thing. Hello World! post is sticky. The list has enabled featured post.

    “Hello World!” definitely isn’t the most recent post. It’s infact the oldest one. The default dummy post that comes when installing WordPRess.

    #29133
    P
    Participant

    Hi Elvin,

    I went further into this and, after testing/deactivating several other things without success, i started from scratch with a clean install (see below). IMHO I think there is an issue with WPSP, in that the sticky property seems to be ignored by WPSP when i select for specific categories to constrain the posts displayed in a list. Maybe something with the underlying query construction?

    I’ve tried a few variations and, at least in my staging environment, i can consistently recreate this issue. I can even have a list with the issue next to one without the issue, using the same posts 🙂 I also checked this against the client’s website setup&data and my assessment of the issue holds. In your example website, given the video you shared, you are not filtering for specific categories. If you do, do you also see the sticky post dropping off the top position?

    For testing, I created a clean install of WP 5.7 with GeneratePress, WPSP and WPSP Pro. I created 3 post categories and 3 posts, one for each category. I created 2 lists: one without the filter for categories, where the older sticky post stays on top as desired; and another with the filter, where the sticky property is ignored. I don’t want to publish the link to the page here. How can i send it to you directly, if you need it?
    As a side note, in both cases the “featured” styling can be applied, as you had indicated.

    Please have a look and let me know if you find the same issue. Since we need to be able to filter for categories in this list, and also use the “sticky” post and “featured” styling, it would be great if this issue could be solved.

    Thank you in advance. Best,
    Paulo

    #29279
    Tom
    Keymaster

    Sticky posts in general have issues whenever you add any sort of category/term. This is why they don’t work by default on archive pages: https://wordpress.stackexchange.com/questions/117279/sticky-posts-not-sticking-to-top-of-category-archive

    Not sure what the best solution would be here, unfortunately. The solution at the URL I shared wouldn’t really work in this specific scenario.

    I just did some looking around on how to target specific posts to order them, but couldn’t come up with anything. The order and orderby params in the WP Query aren’t great, unfortunately.

    #29407
    P
    Participant

    Hi Tom,

    Thank you for the follow-up. Adjusting the WP Query does not seem like a reasonable option, indeed.
    For the time being, we’ll adopt the workaround solution with two lists: one for the sticky post and another for the featured with a filter on categories. We’ll need to just adjust the layout but that’s straightforward.
    I’ll close this ticket. Thanks for your time.
    Best

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