• When I push load more button in category.php it starts loading new page instead using AJAX. It adds ?paged=2 after URL and page is crashing.
    Other pages working well.

    code:

    
        <div class="news">
            <div class="fix">
                <div class="news__content news__content--catalog">
                    <ul class="preview-medium__list" id="ajax">
                        <?php
                        $args = array(
                            'post_type' => 'post' ,
                            'orderby' => 'date' ,
                            'order' => 'DESC' ,
                            'posts_per_page' => 1,
                            'cat'         => '22',
                            'paged' => get_query_var('paged'),
                            'post__not_in' => $ids,
                            'post_parent' => $parent
                        );
                        $q = new WP_Query($args);
    
                        if($q->have_posts() ) : while($q->have_posts()) : $q->the_post();  ?>
                            <li class="preview-medium__item"><a class="preview-medium__link" href="<?php the_permalink(); ?>">
                                    <h3 class="preview-medium__category"><?php echo get_the_category()[0]->cat_name; ?></h3><span class="preview-medium__text"><?php the_title(); ?></span><span class="preview-medium__info"><span class="preview-medium__date"><?php the_time('j M Y'); ?></span><span class="preview-medium__views"><?php echo getPostViews(get_the_ID()); ?>
                                            <svg class="preview-medium__icon">
                              <use xlink:href="#eye"></use>
                            </svg></span></span><span class="preview-medium__img"><?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'sticker-img', null, 'thumbnail', array('class' => 'preview-medium__sticker'));endif; ?></span></a></li>
                        <?php endwhile; ?>
                        <?php endif; ?>
                    </ul>
                    <div class="btn__box btn__box--icon btn__box--margin-top">
                        <div class="btn__data">
                            <?php load_more_button(); ?>
                            <!-- <button class="btn btn--load-more" type="button"><span class="btn__text">Завантажити ще</span></button>-->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    

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

  • The topic ‘Easy load more malfunctioning on Category Page’ is closed to new replies.