Advertisement
MrPauloeN

Custom Post Navigation for Bootstrap Theme

Apr 4th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1.     /*
  2.      * Custom Post Navigation for Bootstrap Theme
  3.      *
  4.      *  This function is replacement for:
  5.      *  @the_post_navigation();
  6.      *  and is used on single.php template, line: 61
  7.      *
  8.      *  It shows nice and clear post navigation tailored to Bootstrap Theme
  9.      *
  10.      * @since The Bootstrap Blog 0.1
  11.      **/
  12.      
  13. function the_bootstrap_blog__the_post_navigation(){
  14.  
  15.     $n = "\n";
  16.  
  17.     $prev = get_adjacent_post( false, '', true );
  18.  
  19.     if( !empty( $prev ) )
  20.         $prev = '<a class="btn btn-outline-primary" href="' . esc_url( get_permalink( $prev->ID ) ) . '" title="' . esc_attr( $prev->post_title ) . '">' . __( 'Previus post', 'the-bootstrap-blog') . '</a>';
  21.  
  22.     $next = get_adjacent_post( false, '', false );
  23.  
  24.     if( !empty( $next ) )
  25.         $next = '<a class="btn btn-outline-secondary" href="' . esc_url( get_permalink( $next->ID ) ) . '" title="' . esc_attr( $next->post_title ) . '">' . __( 'Next post', 'the-bootstrap-blog') . '</a>';
  26.  
  27.     $post_pagination = "<nav class='blog-pagination mb-4'>{$n}{$prev}{$n}{$next}{$n}</nav>";
  28.  
  29.     echo $post_pagination;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement