When I set this template as homepage, pagination doesn't work. I see the buttons, but when I click the button for page 2, nothing happens, doesn't go on page 2, it still remain in page 1.
What is wrong? Where is the mistake?
I read all posts from here & from internet about this issue, but nothing works.
Solution for pagination is this: kriesi.
Here is the code:
<!-- MAIN CONTENT -->
<section id="main-container">
<div class="row">
<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php
$template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true );
$post_type = str_replace( array('template-', '.php'), array(''), $template_name);
?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php
$loop = new WP_Query("post_type=$post_type&paged=$paged");
if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post(); ?>
<?php get_template_part('loop', $post_type) ?>
<?php endwhile; ?>
<?php else: ?>
<?php require THEME_DIR.'/empty.php'; ?>
<?php endif; ?>
<?php pagination($loop->max_num_pages); ?>
</div>
<?php get_sidebar(); ?>
</div>
</section>
<!-- END MAIN CONTENT -->