[Resolved] Duplicated post content (using dynamic post content)

Home Forums Support [Resolved] Duplicated post content (using dynamic post content)

Home Forums Support Duplicated post content (using dynamic post content)

  • This topic has 7 replies, 3 voices, and was last updated 2 years ago by Fernando.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2172182
    Igal

    Hi,

    I’ve created an element (Page Hero) to serve as the template for my blog posts.

    I’ve added dynamic post title, image and dynamic post content blocks.

    The title and image works great, since I can disable them.

    But the actual content of the post shows up twice (first the dynamic one, than the ‘real’ one)

    How do I disable the original post content from showing up like I do with the Title, Featured Image and Primary Post Meta?

    #2172200
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to a post where i can see this ?

    #2173188
    Igal

    Basically I’m using the Dynamic Content Block – in order to get the post content. But then it’s showing up twice, it’s like the page is pulling the Page Hero template and right after that, it’s pulling the normal WordPress page.

    #2173201
    Fernando
    Customer Support

    Hi Igal,

    To confirm, are you wanting to remove the default content in your Posts?

    If so, try adding this PHP:

    add_filter( 'generate_has_default_loop', function( $show ) {
        if ( is_single() ) {
            return false;
        }
    	else {
    		return true;
    	}
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    Adding it through Code Snippets should work.

    Reference: https://docs.generatepress.com/article/generate_more_jump/

    Kindly let us know how it goes. 🙂

    #2173223
    Igal

    Fernando, i’m trying to figure this out:

    1. GeneratePress has the option of using a Dynamic Post Content block, right?
    2. That means that by using this block, it will PULL the Post Content (basically all the article except for the title and featured image), and will publish it where ever the block is
    3. If so, how does it make sense that we need to use a specific PHP code to hide the original WordPress content to avoid duplication?

    Again, maybe I’m not clear, but it doesn’t make any sense that you have this option but it order to use it, I need to use some custom code. I’m sure I’m not doing something right and there should be an easy fix for it.

    Let me make another example:

    1. Generatepress has the option to use a dynamic block to PULL the title
    2. When creating a new element, if I’m not disabling the title, the title would show up twice on the page
    3. So – it does not make sense to use a custom PHP code to disable the title, since there’s an option to disable it
    4. Question is – where is this option for the “Post Content” dynamic block?

    Hope it’s clear now. It does feel like I’m missing something very simple.

    Thanks

    #2173286
    Fernando
    Customer Support

    You’re not missing anything. 🙂

    There is no option to disable the content.

    If you wish to use a Dynamic Content Block that displays the Post Content over the content generated by default, another way to do this without any code is through these steps mentioned by David: https://generatepress.com/forums/topic/suggestion-disable-element-full-page-post-content/#post-1549940

    For example: https://share.getcloudapp.com/DOu4DdKK

    Also see: https://share.getcloudapp.com/9ZumxoyZ

    Moreover, usually, the content displayed is the one displayed by default, as opposed to using a Dynamic Content – Post Content Block. The use of this type of Block is case to case.

    Hope this clarifies. 🙂

    #2173336
    Igal

    Ok so apparently all I needed to do is change the element type from Page Hero to Content Template… Now it works. Thanks!

    #2174098
    Fernando
    Customer Support

    I see. Glad you were able to figure it out!

    For reference, if you still need it, here is an article with regards to using a Content Template – Block Element: https://docs.generatepress.com/article/block-element-content-template/

    Feel free to reach out anytime you’ll need assistance with anything else. 🙂

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