• Resolved Bhaskar Dhote

    (@hemant29)


    Hello

    Thanks for building such a nice plugin.

    I am facing one problem with it.I created a template and load a category post on this page and added your plugin but its not working properly its showing the duplicate post every time.

    Can you please help me in that.

    Thanks

    Here is the complete code:

    <?php
    /* Template Name: Blog */
    get_header();
    ?>

    <div class=”container”>
    <?php
    $paged = ( get_query_var(‘page’) ) ? get_query_var(‘page’) : 1;
    $query_args = array(
    ‘post_type’ => ‘post’,
    ‘posts_per_page’ => 8,
    //’paged’ => $paged,
    //’page’ => $paged,
    ‘category_name’ => ‘blog’
    );

    $frontpage_query = new WP_Query( $query_args );
    ?>
    <?php if ( $frontpage_query->have_posts() ) : ?>
    <div id=”ajax” class=”blog-li”>
    <?php $post_count = 1; ?>
    <?php while ( $frontpage_query->have_posts() ) : $frontpage_query->the_post(); ?>
    <li<?php if (! has_post_thumbnail() ) { echo ‘ class=”no-img”‘; } ?>>
    <?php
    if ( has_post_thumbnail() ) {
    the_post_thumbnail(array(255,208));
    }
    ?>

    <?php $category = get_the_category();
    $firstCategory = $category[0]->cat_name;
    ?>

    <?php $title = substr( get_the_title(), 0, 20 ) . ‘…’; ?>

    <?php $content = substr( get_the_content(), 0, 130 ) . ‘…’; ?>

    <h2 class=”post-title”>“><?php echo $title ?></h2>

    <p><?php echo strip_tags($content); ?></p>
    “>Read More

    <?php $post_count++; endwhile; endif; ?>

    </div>
    <?php wp_reset_postdata(); ?>
    <?php load_more_button();?>

    </div>

    <?php
    get_footer();
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Idiom

    (@brianbrey)

    You almost have it there. If you put the load_more_button() function before wp_reset_postdata() it should work. Hope that helps!

    Thread Starter Bhaskar Dhote

    (@hemant29)

    Hii

    I added it before wp_reset_postdata() but still not working 🙁

    Can you help me out in it.

    Thanks

    Thread Starter Bhaskar Dhote

    (@hemant29)

    Hii Andrew

    Can you help me in.

    Thanks

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

The topic ‘Showing Duplicate Post’ is closed to new replies.