
Untitled
By: a guest on
Sep 19th, 2012 | syntax:
None | size: 1.06 KB | hits: 45 | expires: Never
<?php
// don't edit this
global $wp_query;
$first_page_total= 9; // total number of posts on first page
$paginated_total = 10;
$found_posts = $wp_query->found_posts;
$pages = 1 + ceil(($found_posts - $first_page_total) / $paginated_total);
$wp_query->max_num_pages = $pages;
// start editing
?>
<?php /* Start the Loop */ ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php if(!is_paged()) : ?>
<?php
$sticky = get_option( 'sticky_posts' );
$args = array(
'posts_per_page' => 1,
'post__in' => $sticky,
'ignore_sticky_posts' => 1
);
$the_query = new WP_Query( $args); ?>
<?php /* Start the sticky post loop */ ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
if ( $sticky[0] ) {
get_template_part( 'content', get_post_format() );
}
?>
<?php endwhile; ?>
<?php endif; ?>
<!-- pagination functions here -->
<?php else : ?>
<!-- no post found text here -->
<?php endif; ?>