We'll create fresh WordPress site with TTT Loadmore installed. You have 20 minutes to test the plugin after that site we'll be deleted.
WordPress plugin to load more event with your own template.
For code contributions please go to https://github.com/33themes/ttt-loadmore
This is the base html:
<a href="#" data-tttloadmore-do="archiveposts" data-tttloadmore-to="#main" data-tttloadmore-args="category:php;">
Load more content
</a>
Then, you have to create an action with the same name of the data-tttloadmore-do
<?php
function loadmore_archiveposts( $page, $args = false ){
$archiveposts = array(
'post_type' => 'post',
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'paged' => $page,
'ignore_sticky_posts' => 1,
'category_name' => $args['category'],
);
$archiveposts_query = new WP_Query($archiveposts);
?>
<?php if ($archiveposts_query->have_posts()) : ?>
<?php while ($archiveposts_query->have_posts()) : $archiveposts_query->the_post(); ?>
<?php get_template_part( 'partials/content', 'content' ); ?>
<?php wp_reset_postdata();?>
<?php endwhile; ?>
<?php endif;?>
<?
}
add_action('ttt_loadmore_archiveposts','loadmore_archiveposts', 1, 2);
?>