teidar on "[Plugin: Ajax Pagination and Infinite Scroll] Ajax pagination not working"

ساخت وبلاگ

teidar
Member
Posted 56 minutes ago #

Ajax pagination not working. If you click the next button the url changes to the page/2/ but posts dont it's still the first page
Here is my home.php

<div class="tmpl-blog"> <div class="top-title"> <h2>BLOG OFFSHORE</h2> </div> <div class="clear"></div> <?php get_template_part( 'templates/main', 'post' ); ?> <div class="recent-posts" id="main"> <div class="title"> <p class="fancy"><span>RECENT POSTS</span></p> </div> <div class="posts-grid"> <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'category_name' => 'posts', 'posts_per_page' => 4, 'paged' => $paged ); $main_query = new WP_Query($args); while ($main_query->have_posts()) : $main_query->the_post(); get_template_part( 'templates/content', 'blog' ); endwhile; ?> </div> <div class="posts-pagination"> <?php the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => __( 'Previus', 'textdomain' ), 'next_text' => __( 'Next', 'textdomain' ), ) ); ?> <?php wp_reset_postdata(); ?> </div> </div> <div class="popular-posts"> <h2>MOST POPULAR POSTS</h2> <?php dynamic_sidebar('popular-posts'); ?> </div>
</div>
<?php dynamic_sidebar('module-faq'); ?>
<?php dynamic_sidebar('module-contact-form'); ?>

https://wordpress.org/plugins/malinky-ajax-pagination/

malinkymedia
Member
Plugin Author

Posted 37 minutes ago #

Have you got a demo?

If not can you also post up the contents of the file templates/content-blog.php

Thanks

teidar
Member
Posted 31 minutes ago #

The site is on my localhost
Here is the templates/main-post.php

<div class="main-post"> <?php $args = array( 'category_name' => 'main-post' ); $custom_query = new WP_Query($args); while ($custom_query->have_posts()) : $custom_query->the_post(); ?> <div class="img-block"> <div class="date-wrap"> <p class="month-name"><?php the_time('F'); ?></p> <p class="month-date"><?php the_time('j'); ?></p> </div> <?php the_post_thumbnail(); ?> </div> <div class="content"> <h2><?php the_title(); ?></h2> <p><?php $content = get_the_content(); echo wp_trim_words( $content, '140' ); ?> <a href="<?php the_permalink(); ?>">Lire la suite <img src="<?php bloginfo('template_directory');?>/dist/images/blog/link-arrow.png" alt="Link arrow" width="10" height="26" /></a></p> </div> <?php endwhile; wp_reset_postdata(); ?>
</div>

and here is the templates/content-blog.php

<article> <div class="img-block"> <div class="date-wrap"> <p class="month-name"><?php the_time('F'); ?></p> <p class="month-date"><?php the_time('j'); ?></p> </div> <?php the_post_thumbnail(); ?> </div> <div class="content"> <h2><?php the_title(); ?></h2> <p><?php $content = get_the_content(); echo wp_trim_words( $content, '100' ); ?></p> <p><a href="<?php the_permalink(); ?>">Lire la suite <img src="<?php bloginfo('template_directory');?>/dist/images/blog/link-arrow.png" alt="Link arrow" width="10" height="26" /></a></p> </div>
</article>

malinkymedia
Member
Plugin Author

Posted 16 minutes ago #

Thanks. Quick question I assume your home.php also includes a header and footer that includes these two functions.

wp_head()
wp_footer()

teidar
Member
Posted 11 minutes ago #

Yes of course

malinkymedia
Member
Plugin Author

Posted 9 minutes ago #

Thanks, I only ask as it has happened before

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 188 تاريخ : پنجشنبه 6 خرداد 1395 ساعت: 17:35