• Resolved joanlaura404

    (@joanlaura404)


    Have version 2.9.70 installed and setup to display a custom post type with a custom layout using in the instructions provided. I have filter turned off and everything looks great except I’ve noticed that when using the Load More pagination option, the items are repeating. In my case I have 20 items, 4 per row. When loading more I end up with the right amount of items display but there are multiple being repeated. When I switch to numeric pagination type, everything displays correctly. I also tried Scroll Infinity option and that also shows repeated items.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YMC

    (@wssoffice21)

    Hi!

    Send us a link to the page of your site where the filter is located. We need to test it on your side since everything works correctly on our side.

    • This reply was modified 1 year ago by YMC.
    Plugin Author YMC

    (@wssoffice21)

    We hope that you were able to solve your issue.

    Thread Starter joanlaura404

    (@joanlaura404)

    Here is our staging site homepage: https://wordpress-881001-5452117.cloudwaysapps.com/

    We’re using the shortcode after the Premier Private Outfitters title. Outfitters is the custom post type, and there are a total of 18 published outfitters. After you click View More twice it shows 18 blocks but you can see some are repeated.

    Here is the code I have in my functions.php for the custom layout

    function my_custom_post_layout( $layout, $post_id) {

        $outfitter_title = get_the_title( $post_id );

        $outfitter_link = get_permalink($post_id);

        $outfitter_img = get_the_post_thumbnail_url( $post_id, 'full' );

           $layout = '';

           $layout .= '<a href="';

           $layout .= $outfitter_link;

           $layout .= '"><div class="hp-out-block" style="position:relative; background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.8)),url(';

           $layout .= $outfitter_img;

           $layout .= ');"><h3 class="white-text fs-30 font-proh">';

           $layout .= $outfitter_title;

           $layout .= '</h3></div></a>';

         return $layout;

      }

      add_filter( 'ymc_post_custom_layout_47569_1', 'my_custom_post_layout', 10, 2 );
    Plugin Author YMC

    (@wssoffice21)

    Check the code for correctness: this is the code you should have

    function my_custom_post_layout( $layout, $post_id, $filter_id, $increment_post, $arrOptions ) {
    $outfitter_title = get_the_title( $post_id );
    $outfitter_link = get_permalink($post_id);
    $outfitter_img = get_the_post_thumbnail_url( $post_id, ‘full’ );

    $layout = '';  
    $layout .= $outfitter_title;  
    $layout .= $outfitter_link;    
    
    return $layout; 

    }
    add_filter( ‘ymc_post_custom_layout_47569_1’, ‘my_custom_post_layout’, 10, 5 );

    In addition, fix the errors that are on the site, as this may cause a failure in the execution of Ajax requests – https://prnt.sc/rExvxzsaSvLe

    Thread Starter joanlaura404

    (@joanlaura404)

    Thanks for your help, I looked for any scripts that could be conflicting and disabled any unnecessary plugins but could not find the source. I also did find that with number pagination it was duplicating as well. Unfortunately, I’m not the original developer of this site and there is lots of code in this theme that may be causing the issue since I’ve never experienced a problem with your plugin before. You can mark this as resolved, we’re unable to invest more time into investigating the theme issue. But thank you again for taking the time to respond 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Duplicate posts’ is closed to new replies.