Skip to content

Instantly share code, notes, and snippets.

@rodica-andronache
Created November 8, 2013 09:15
Show Gist options
  • Select an option

  • Save rodica-andronache/7368434 to your computer and use it in GitHub Desktop.

Select an option

Save rodica-andronache/7368434 to your computer and use it in GitHub Desktop.
Paginatie pagina cu custom post types (Ex: Portofolio)
<ul>
<?php
global $paged, $wp_query, $wp;
if ( empty($paged) ) {
if ( !empty( $_GET['paged'] ) ) {
$paged = $_GET['paged'];
} elseif ( !empty($wp->matched_query) && $args = wp_parse_args($wp->matched_query) ) {
if ( !empty( $args['paged'] ) ) {
$paged = $args['paged'];
}
}
if ( !empty($paged) )
$wp_query->set('paged', $paged);
}
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('paged='.$paged.'&post_type=aktualnosci&showposts=3');
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<li> something here </li>
<?php endwhile; ?>
</ul>
<div class="pag">
<div class="numbers">
<div><?php previous_posts_link('<span class="prev">&nbsp;</span>') ?></div>
<div><?php next_posts_link('<span class="next">&nbsp;</span>') ?></div>
</div>
</div>
<?php $wp_query = null; $wp_query = $temp;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment