Created
February 15, 2015 20:25
-
-
Save ABooooo/817f60083f3dc1992b7f to your computer and use it in GitHub Desktop.
show post from category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Protect against arbitrary paged values | |
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; | |
$args = array( | |
'posts_per_page' => 10, | |
'category_name' => 'novice', | |
'paged' => $paged, | |
); | |
$the_query = new WP_Query( $args ); | |
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); | |
echo '<span class="date">'; | |
echo get_the_date(); | |
echo '</span><br/>'; | |
echo permalink_anchor(); | |
echo '<br/><h4>'; | |
echo '<a class="permaLink" href="'; | |
echo the_permalink(); | |
echo'" title="'; | |
echo the_title_attribute(); | |
echo'">'; | |
echo the_title(); | |
echo '</a>'; | |
echo '</h4><br/>'; | |
echo get_the_content('<br/><br/>Preberi več...'); | |
echo '<hr/>'; | |
endwhile; | |
endif; | |
$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' => $the_query->max_num_pages | |
) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment