function rps_myajax_pagination()
{
    $page = (int) $_POST['page'];
    $offset = (int) $_POST['offset'];
    $offset = ($page - 1) * $offset;
    $args = array('post_type' => 'post', 'offset' => $offset, 'post_status' => 'publish');
    if (isset($_POST['cat'])) {
        $args['cat'] = (int) $_POST['cat'];
    }
    $query = new WP_Query($args);
    $posts = '';
    if ($query->have_posts()) {
        $i = 0;
        while ($query->have_posts()) {
            $query->the_post();
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                $posts .= '<div class="blog-page-excerpt has-thumbnail ' . $i . '"><article>' . "\n";
                $posts .= '<div class="header-excerpt-meta-container">';
                $posts .= '<header><h1 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1></header>' . "\n";
                $posts .= '<footer><p class="post-meta">Posted : ' . get_the_time('F jS, Y') . ' in ' . get_the_category_list(', ') . '</a></p></footer>' . "\n";
                $posts .= '<div class="excerpt-container">' . rps_nicer_excerpt(array('echo' => false, 'words' => 60)) . ' </div>' . "\n";
                $posts .= '</div>' . "\n";
                $posts .= '<div class="thumbnail-container"><a href="' . get_permalink() . '"><img class="post-thumbnail" src="' . $image[0] . '" alt="' . get_the_title() . '"></a></div>' . "\n";
                $posts .= '</article></div>' . "\n";
            } else {
                $posts .= '<div class="blog-page-excerpt no-thumbnail ' . $i . '"><article>' . "\n";
                $posts .= '<div class="header-meta-container">';
                $posts .= '<header><h1 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1></header>' . "\n";
                $posts .= '<footer><p class="post-meta">Posted : ' . get_the_time('F jS, Y') . ' in ' . get_the_category_list(', ') . '</a></p></footer>' . "\n";
                $posts .= '</div>' . "\n";
                $posts .= '<div class="excerpt-container">' . rps_nicer_excerpt(array('echo' => false, 'words' => 60)) . ' </div>' . "\n";
                $posts .= '</article></div>' . "\n";
            }
            $i++;
        }
    }
    echo $posts;
    die;
}
Exemple #2
0
            <header>
              <h1 class="news-item-header"><a href="<?php 
    the_permalink();
    ?>
"><?php 
    the_title();
    ?>
</a></h1>
              <time datetime="<?php 
    the_time('Y-m-d');
    ?>
"><strong><?php 
    the_time('j F, Y');
    ?>
</strong></time>
            </header>
            <?php 
    $options = array('link' => false, 'words' => 60);
    ?>
            <?php 
    rps_nicer_excerpt($options);
    ?>
          </div>
        </article>
      <?php 
}
wp_reset_query();
?>
      </div>
      <?php 
get_footer();
						<p class="post-meta"><?php 
        the_time('F jS, Y');
        ?>
 in <?php 
        the_category(' ');
        ?>
 <?php 
        comments_number('', ' - 1 comment', ' - % comments');
        ?>
</p>
					</footer>
				</div>

				<div class="excerpt-container">
					<?php 
        rps_nicer_excerpt(array('words' => 40));
        ?>
				</div>

			</article>

		</div>

	<?php 
    }
}
?>

	</div>

	<?php