[Resolved] Duplicate Post on Home Page

Home Forums Support [Resolved] Duplicate Post on Home Page

Home Forums Support Duplicate Post on Home Page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #698023
    Simon

    Hi,

    On the home page of the site included in URL for admins, you can see I have the current home page set to show the latest posts.

    My client wants to show a single featured post using the category tag, “Featured”. I achieved this using GeneratePress Elements and Tom’s WP Show Posts plugin.

    However, when doing so, the Featured Post appears both in my custom Hook and in the main loop on the Home page. I can stop this by offset 1 for the WP Show Posts list, however, it’s not ideal as it then doesn’t show the most recent featured post.

    How can I hide the duplicated post in the main loop on the Home page? The post in question for this example is called “TTEC Unveils New Customer Experience Innovation Lab in Belfast” and is located in my custom hook at the top of the page and further down the list of articles again in the main loop on the Home page.

    Kind regards,

    Simon

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #698194
    Leo
    Staff
    Customer Support

    Hi there,

    Try this CSS;

    .home .tag-featured:not(.wp-show-posts-single) {
        display: none;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    Let me know ๐Ÿ™‚

    #698215
    Simon

    Hi Leo,

    Would that CSS not have to be changed each time the featured post changed?

    It changes daily.

    Sorry, not had a chance to test yet, I just wanted to ask that additional question before testing.

    Kind regards,

    Simon

    #698248
    Leo
    Staff
    Customer Support

    Ahh I see. Edited the code above.

    #698270
    Simon

    Hi Leo,

    Thanks for editing the code. I tested it and it works perfectly!

    Kind regards,

    Simon

    #698290
    Leo
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.