-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-noticias.php
63 lines (49 loc) · 1.32 KB
/
page-noticias.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Template Name: Noticias
*
* @package Odin
* @since 2.2.0
*/
get_header(''); ?>
<main id="content" class="pagina-itens <?php echo odin_classes_page_full(); ?>" tabindex="-1" role="main">
<h1><?php echo get_the_title();?></h1>
<div class="row" id="ajax-itens">
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'noticia',
'paged'=> $paged,
'posts_per_page' =>4
);
$WP_Query_noticias = new WP_Query( $args );
if( $WP_Query_noticias->have_posts() )
{
while ( $WP_Query_noticias->have_posts() )
{
$WP_Query_noticias->the_post();
?>
<?php get_template_part('content','todos');
}
?>
<div class="clearfix"></div>
<div class="row pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $WP_Query_noticias->max_num_pages
) );
?>
</div>
<div class="clearfix"></div>
<br>
</div> <!-- id="escolad" -->
<?php
}
wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly
?>
</main>
<?php get_footer();