Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ~The Most Base~
- ---------------
- */
- get_permalink() // постоянная ссылка
- /*
- ~Pagination~
- ------------
- */
- // Simple Pagination
- next_posts_link( '<< Older Posts' );
- previous_posts_link( 'Newer Posts >>' );
- // Simple Pagination with Title
- next_posts_link( '<span>Older Posts</span><h3>%link</h3>', '%title', false );
- previous_posts_link( '<span>Newer Posts</span><h3>%link</h3>', '%title', false );
- // Numeric Pagination
- echo paginate_links();
- /*
- ~Show Posts of Certain Category~
- */
- // for example of category 'about'
- // (if see ** - delete line if don't need pagination)
- $currentPage = get_query_var( 'paged' ); //**
- $aboutPosts = new WP_Query( array(
- 'category_name' => 'about',
- 'posts_per_page' => 3,
- 'paged' => $paged //**
- ) );
- <?php
- if( $aboutPosts->have_posts() ):
- while( $aboutPosts->have_posts() ):
- $aboutPosts->the_post();
- ?>
- <li>
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
- </li>
- <?php
- endwhile;
- echo paginate_links( array(
- 'total' => $aboutPosts->max_num_pages //**
- ) );
- //previous_posts_link(); //**
- //next_posts_link( 'Next Page', $aboutPosts->max_num_pages ); //**
- endif;
- ?>
Add Comment
Please, Sign In to add comment