How to avoid same post displaying twice on same page?

  • Unknown's avatar

    I’m experiencing multiple issues with Tenaz theme.

    1. First and foremost, there are multiple queries on the front page that result in posts appearing twice on the same page. How to get the second query (“Trending” for the home page) to exclude all the posts that are already appearing on the page? This discussion here captures my issue perfectly but I’m not a coder and need step-by-step instructions where to insert it in the Gutenberg editor.
    2. Same issue above for posts pages. The sidebar, “recent posts,” includes a reference to the post itself. How to exclude that and avoid duplication?
    3. A featured image caption plugin is malfunctioning when the image appears twice on a post page. I would like to fix this by getting rid of the post appearing twice. See bottom right of this page: https://earthhope.net/2023/09/19/corals-storm-back-after-sea-weeding-project/
    4. I cannot activate the index template for the entire site and so I don’t have any page that includes ALL my posts. I could create a category called “all” and be sure to check it every time I create a post, but that is a cumbersome manual affair, isn’t it? My impression is that the index template should fulfill this purpose. I understand how to edit the index template but I don’t see how I can create a page using the template. I don’t see a template dropdown menu under “page attributes” as per the instructions provided when I asked WP support. Reading settings do not include any “default posts page.”
    5. Although I have selected “show 10 posts” for my home page, it only shows 6 in the main area.

    I’m about to change my theme to see if that helps but I don’t want to do that if I can avoid it. I already put a lot of work into this theme. Thanks for any help.

    The blog I need help with is: (visible only to logged in users)

  • Hey there,

    Many thanks for reaching out!

    First and foremost, there are multiple queries on the front page that result in posts appearing twice on the same page. How to get the second query (“Trending” for the home page) to exclude all the posts that are already appearing on the page? This discussion here captures my issue perfectly but I’m not a coder and need step-by-step instructions where to insert it in the Gutenberg editor.

    It’s possible to assign the query loop block to pull in categories of posts, for example, you could have a category called featured, and this is what appears on the front page.

    I created this screenshot to you show you how this would be created.

    Same issue above for posts pages. The sidebar, “recent posts,” includes a reference to the post itself. How to exclude that and avoid duplication?

    There’s two ways you could do this – you could look to utilise sticky posts, and have them include/exclude certain posts, or you could look to use tags/categories to manipulate what you wish to show there.

    A featured image caption plugin is malfunctioning when the image appears twice on a post page. I would like to fix this by getting rid of the post appearing twice. See bottom right of this page: https://earthhope.net/2023/09/19/corals-storm-back-after-sea-weeding-project/

    This could be solved by one of the methods above, which would stop the featured image appearing twice.

    Failing that, you would need to contact the plugin developers on how that could be fixed, as this is a third party plugin.

    I cannot activate the index template for the entire site and so I don’t have any page that includes ALL my posts. I could create a category called “all” and be sure to check it every time I create a post, but that is a cumbersome manual affair, isn’t it? My impression is that the index template should fulfill this purpose. I understand how to edit the index template but I don’t see how I can create a page using the template. I don’t see a template dropdown menu under “page attributes” as per the instructions provided when I asked WP support. Reading settings do not include any “default posts page.”

    I see the blog page is currently set to draft. Once published, this can be set as the posts page via Appearance > Customizer > Posts page dropdown, and this will adopt the Index template.

    It wouldn’t be possible to do this step whilst the page is draft.

    Although I have selected “show 10 posts” for my home page, it only shows 6 in the main area.

    This would be changed in the Index template, I see there’s 4 columns, so a total of 8 articles would currently show on the blog page.

    I’m hoping this is all useful information! :)

  • Unknown's avatar

    Hello,

    Thank you for your detailed explanations.

    Re: Blog page, which I’ve titled “Archives” and published. Under Appearance>Customize> I don’t see a “posts page dropdown.”  I see three options:

    Site identity>

    Homepage settings>

    Additional CSS>

    Under “homepage settings,” there is an option to change the homepage from “your latest posts” to a “static page.” I notice this is a setting also available in the reading settings but in the reading settings there is an additional dropdown related to “posts page.” If I switch my homepage setting to “static page,” I can select “archives” in the dropdown. I can also select “archives” for the “posts page,” but then the blog/archive page turns into an exact duplicate of the home page. When the archive page is published without this setting, it doesn’t include the “previous” and “next” arrows. It does display the arrows in editing mode, so those blocks are added but not working. I still don’t see where the index page template comes into play. I really like my index page template.

    Re: Query loops. I understand how to include/exclude certain categories from the “trending” and “recent posts” queries. But I don’t see a logic that would eliminate duplicate headlines. For the recent posts, ideally the logic is “include everything recent, but don’t include this post.” For each and every post, that is a different thing to exclude. If the query “recent posts” is in the sidebar of every single post, there isn’t any category I can assign that would work. For the homepage, I follow you that the top could be a certain category and the bottom could be designated a different category, but I would also need for every story in each of those categories to not have any overlapping categories. Eliminating duplications seems like a very simple coding task that could be included in the background of every single query loop and applied to all WP templates and benefit everybody! Nobody wants duplications.

    New question: I have stickied the otter story so it’s always the top post on the home page. You will notice that the home page template does not include any white space, but the published version is different than the template. I have tried extending my home page maximum posts to 14 to see if that white space will fill, but it didn’t work.

    Thank you again for your time and any further assistance you can provide!

  • Unknown's avatar

    PS. Thinking it through, I see that two separate non overlapping categories (even if posts share some overlapping categories) would work on the home page, but it seems highly manual adding and deleting categories as posts are created. Plus, it also brings up the question of the index again. What page would actually display the entire blog?

  • Unknown's avatar

    Update: I unpinned/unstickied the story that was causing the front page design to go whack, even though I’d really like to sticky it to the top. I categorized the oldest stories so they would show up in “trending” on the home page. So now there’s no duplication on the home page. I added another post, so now the number of posts exceeds what the first page of the archives page can hold and the “next” arrow is showing up. I still would like to use my index template with the four columns instead of the blog template I have on the archives page. I still would like to eliminate duplication in the “recent posts” query loop. Thanks for any help.

  • Hey there @amandaroyal23,

    I unpinned/unstickied the story that was causing the front page design to go whack, even though I’d really like to sticky it to the top.

    Does a different sticky/pinned story have the same issue, or was it a problem with just that otter one?

    Re: Blog page, which I’ve titled “Archives” and published. Under Appearance>Customize> I don’t see a “posts page dropdown.”

    Apologies; that’s a setting for classic themes, but you should always be able to find it here: https://wordpress.com/settings/reading/

    Also, can you clarify what your featured image plugin does? I wonder if it’s complicating things. I’m also seeing some odd overlap in the sidebar currently and wonder if that’s related.

    Going forward, it might be easiest to make separate topics for each separate issue, just so we can see at a glance what is and isn’t resolved.

    We could focus this thread on the issue of excluding posts within recent posts so they don’t appear more than once. I see that’s an issue on the Tenaz demo itself, so we could chase that down and see what’s possible.

  • Unknown's avatar

    Thank you. Yes, solving the duplicates would be wonderful. It is not resolved on my front page. I just did a manual workaround. Yes, it appears on the Tenaz demo as well as the the screenshot of the theme when it appears in the theme menu.

    The featured image caption plugin puts the caption from the media library under the featured image any time you have a featured image with a caption saved in the media library. It works great anywhere else; it only malfunctions when the post appears twice on the same page. I haven’t asked the plugin owners to help resolve because I believe they would say “get rid of the same post appearing twice on the same page and that will solve it.”

    Is there a theme where this duplication issue is not a problem? I have put a lot of time into this theme but I’m at my wits’ end on this and multiple other issues. It’s also been a consistent problem that support documentation and support staff recommend a solution that doesn’t work because it’s for a classic theme instead of a block theme.

  • The featured image caption plugin puts the caption from the media library under the featured image any time you have a featured image with a caption saved in the media library. It works great anywhere else; it only malfunctions when the post appears twice on the same page. 

    Ah, thanks for clarifying; I’m grabbing a screenshot so my colleagues can easily see that’s what you’re referring to.

    For the front page, I can see duplication happening if you have posts in more than one category; I’d just be sure to set your filters in each query loop there so they don’t overlap, if possible.

    But for the single posts template, I don’t see an easy solution yet. We’ll let you know what we find!

    Can you make a separate thread about the sticky post issue with more details?

  • Unknown's avatar

    Thanks. How do I contact support for the Tenaz theme? Someone suggested that and I spent an hour trying to figure it out one day but couldn’t. I feel like the front page sticky post issue is an issue for them. I actually like having two main stories when it happens, but then the rest of the page under the smaller posts is white space.

  • Tenaz is by Automattic, and that’s us! You’re welcome to open a chat or email ticket, or to continue here, would you make a separate post here for the Sticky Post question, and include a screenshot of what you see with it on? If you can also test to see how it looks without the extra featured image plugin, that would be helpful.

    Someone suggested that and I spent an hour trying to figure it out one day but couldn’t.

    Is this in relation to the sticky post issue, or to dividing up the content on the front page? Might be worth making a separate issue for that if it’s on dividing up content; it’s relatively easy but I can absolutely see how it would get confusing when we’re talking about several issues at once.

    In the meantime, we’ll keep looking for a solution re: the single page and update you here with that. Cheers!

  • Unknown's avatar

    Thanks. I re-stickied the story to get a screen shot and have created a separate post on the sticky issue: https://wordpress.com/forums/topic/sticky-post-disrupts-front-page-layout-in-tenaz-theme/

  • Unknown's avatar

    There aren’t any captions or caption blocks on the front page so I don’t think the image caption plugin would affect the front page. But who knows.

  • Thank you @amandaroyal23! I’m doing some digging on whether it’s possible to display recent posts without showing the post from that page. We’ll let you know what we find on that, and we’ll follow up on the other topic as well. Cheers!

  • Thanks for making the other thread; I found a solution there.

    Still no great fix on this one, but we’ll get more eyes on it.

    I noticed the caption feature isn’t rendering HTML correctly. Instead of showing a link, for example, it’s actually typing out <a href= and all that, and it’s also positioning itself on top of the post info. If you deactivate that temporarily, do the image captions go back to showing a link instead of HTML?

  • Unknown's avatar

    I noticed that about the html in the caption as well. It only does it on captions I didn’t create, such as captions that came with a free photo from Pexels.

    The duplicate display issue has been discussed all over the web, including here, but all the suggestions require digging into the code.

  • Unknown's avatar

    It sure seems that if it were built into the template not to do that, nobody would complain. It would be universally welcome.

  • It only does it on captions I didn’t create, such as captions that came with a free photo from Pexels.

    Do any of your captions include links? I’d bet it just isn’t rendering HTML at all, and the Pexels ones include that.

    The duplicate display issue has been discussed all over the web, including here, but all the suggestions require digging into the code.

    Ah, yup, and that’s an older post from before the Query Block even existed. That particular issue is about excluding duplicates from two query loops, like you’ve got on the front page.

    While it wouldn’t solve the single post thing, I think for the front page, the “tag” method Adam recommended would be ideal, then just be sure you don’t put two of those tags on the same post. You could use the same method to differentiate the posts on the sidebar and bottom of the single page.

    Do you want to set that up using filters? Basically, you would decide first what posts go where, and add tags or categories accordingly. Then, you’d edit the template and use the “filter” option on the query loops to show just that one tag or category in that space:

    WP
    Blocks (The Full List) » Query Loop Block
    9 min read
    Use the Query Loop block to display blog posts (or other content types such as pages, testimonials, or projects) anywhere on your site. This block is similar to the Blog Posts block, but with greater flexibility to display your content using many different parameters and visual layouts. This guide will show you how to use it. Add the Query Loop Block The Query Look block may already be add
  • Unknown's avatar

    Ideally, there would be recent posts showing up in that sidebar as it was designed. Then there’s no work or worrying once you post something. I think the template was designed well that way. However, there isn’t any logic/categorization/tag that I could add to the recent post query loop that would exclude the current post. Say I categorize a post “current” and then I go through and I categorize everything else “recent” and I tell the query loop to only include “recent,” then on the next post, what do I do? It’s a lot of jerry-rigging and manual tagging to get something done that could be automagic. Say you ask your engineers to create a check box in the query loop that is “exclude” instead of “include” and there’s a check box for “current post.” Speaking of posts down below, I have clicked Tools>Marketing>Traffic>Related posts (toggled on) and I don’t see any related posts down below my stories. It’s funny how many instructions don’t work around here.

  • Unknown's avatar

    PS. I don’t think hyperlinks are allowed in the media library edit caption area.

  • Unknown's avatar

    @supernovia I created another Tenaz theme question here:

    https://wordpress.com/forums/topic/tenaz-theme-templates-are-not-usable/

    It’s really more of a complaint than a question. This is an issue that support bot, support documentation, support chat and support email have all failed to address and initially tried to answer by providing support documentation that didn’t apply to Tenaz theme (because it’s a block theme and not a classic theme).

  • The topic ‘How to avoid same post displaying twice on same page?’ is closed to new replies.