Support » Plugin: Gutenberg Blocks and Template Library by Otter » Secondary blog post duplicated in blocks

  • Resolved oc3ancool89

    (@oc3ancool89)


    Hi, I have used the blog post blocks but blog posts are duplicating on the secondary language page.

    Context: My website is a multilingual website, using Traditional Chinese as primary language and English as secondary language. I use WPML for translation, but for “Our Stories” categories (you can see in the link) I am not translating the posts, hence posts are in Traditional Chinese. However, blog posts are duplicating itself but working fine in primary language page.

    Appreciate your help.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor soarerobertdaniel7

    (@soarerobertdaniel7)

    Hi, thanks for reporting this issue.

    The posts are indeed identical as content, but their link addresses are different.
    The first post has the link address: https://oskanimalcare.com/osk-animal-care-in-kaohsiung-sep-2020-sixth-formosa-vet-congress/
    The second has: https://oskanimalcare.com/osk-animal-care-in-kaohsiung-sep-2019-fifth-formosa-vet-congress-2/?lang=en

    We will investigate this problem and please check if there is a misconfiguration in WPLM that may cause this issue.

    I have double check the translation settings and they appear fine. Appreciate your help.

    Hi, just touching base to see if we have any updates. Thanks.

    Plugin Contributor soarerobertdaniel7

    (@soarerobertdaniel7)

    The WPLM plugin made some internal changes in the WordPress environment and caused a weird behavior on the Posts Block. The fix will be shipped in the next version.

    If you need it right now, the fix can be applied manually with a text editor like Notepad. Also, you can use the WPIDE plugin to access the files directly from the WordPress interface.

    1. Go to wp-content/plugins/otter-blocks/vendor/codeinwp/gutenberg-blocks/inc/render
    2. Open the file: class-posts-grid-block.php
    3. Around line 138 you can see the code that looks the same as the one below.

    $recent_posts = wp_get_recent_posts(
    	array(
    		'numberposts' => $attributes['postsToShow'],
    		'post_status' => 'publish',
    		'order'       => $attributes['order'],
    		'orderby'     => $attributes['orderBy'],
    		'offset'      => $attributes['offset'],
    		'category'    => $categories,
    	)
    );

    4. After 'category' => $categories, you need to add the following line: 'suppress_filters' => false

    5. In the end, the code will be

    $recent_posts = wp_get_recent_posts(
    	array(
    		'numberposts' => $attributes['postsToShow'],
    		'post_status' => 'publish',
    		'order'       => $attributes['order'],
    		'orderby'     => $attributes['orderBy'],
    		'offset'      => $attributes['offset'],
    		'category'    => $categories,
                    'suppress_filters' => false
    	)
    );

    @soarerobertdaniel7, apologies for my late reply, I have been snowed under and have lag in following up. There is no hurry. I will just await the next fix to be on the safe side as I am not a coder. I will revert back once fix is released and patched. Thank you!!

    Plugin Contributor soarerobertdaniel7

    (@soarerobertdaniel7)

    Glad to hear it and thanks for reporting this issue!

    oc3ancool89

    (@oc3ancool89)

    @soarerobertdaniel7 I can confirm that the latest update has fixed my issue, thank you so much!

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