Button that loads 3 more posts

2

I want my button id="boot" ( <div id="boot"> ) each time it is pressed, press +3 testimonials.

<?php 
query_posts( array ( "category_name" => "depo" ));
if (have_posts()) : while (have_posts()) : the_post(); 
?>
<article id="post-28" role="article" style="margin-left:20px;">

<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>

<h1 class="titulo-depo" ><b><a class="index-tro"href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></b></h1>
<h2 class="depo-p"><b><?=the_content();?></b></h2>

</article>

<?php 

$cont_banner++;
endwhile; ?>

<?php else : ?>

<?php endif; ?> 
<div id="bott"><a href="eventos.php"><p>+DEPOIMENTOS</p></a></div><br /><br /><br /><br />
    
asked by anonymous 24.09.2015 / 18:50

1 answer

0

Have you tried using WP_Query? And then you can do the paging ... There you have the option to do it on hand or use the jetpack plugin to do the infinite scroll / button to load more.

<?php 
$args = array(
  'category_name' => 'depo',
  'posts_per_page'  => 3
);
$query = new WP_Query($args);
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); 
?>

link

I hope I have helped if I can help with anything else, just talk =)

    
22.09.2016 / 20:21