mh_impact_lite_postnav

The MH Impact lite mh impact lite postnav function.

Description

mh_impact_lite_postnav(); 

Usage

  1. if ( !function_exists( 'mh_impact_lite_postnav' ) ) { 
  2. require_once '/includes/mh-custom-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = mh_impact_lite_postnav(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/mh-custom-functions.php  
  1. function mh_impact_lite_postnav() { 
  2. global $post; 
  3. $parent_post = get_post($post->post_parent); 
  4. $attachment = is_attachment(); 
  5. $previous = ($attachment) ? $parent_post : get_adjacent_post(false, '', true); 
  6. $next = get_adjacent_post(false, '', false); 
  7.  
  8. if (!$next && !$previous) 
  9. return; 
  10.  
  11. if ($attachment) { 
  12. $attachments = get_children(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $parent_post->ID)); 
  13. $count = count($attachments); 
  14. echo '<nav class="post-nav-wrap" role="navigation">' . "\n"; 
  15. echo '<ul class="post-nav clearfix">' . "\n"; 
  16. echo '<li class="post-nav-prev">' . "\n"; 
  17. if ($attachment) { 
  18. if ($count == 1) { 
  19. $permalink = get_permalink($parent_post); 
  20. echo '<a href="' . $permalink . '"><i class="fa fa-chevron-left"></i>' . __('Back to post', 'mh-impact-lite') . '</a>'; 
  21. } else { 
  22. previous_image_link('%link', '<i class="fa fa-chevron-left"></i>' . __('Previous image', 'mh-impact-lite')); 
  23. } else { 
  24. previous_post_link('%link', '<i class="fa fa-chevron-left"></i>' . __('Previous post', 'mh-impact-lite')); 
  25. echo '</li>' . "\n"; 
  26. echo '<li class="post-nav-next">' . "\n"; 
  27. if ($attachment) { 
  28. next_image_link('%link', __('Next image', 'mh-impact-lite') . '<i class="fa fa-chevron-right"></i>'); 
  29. } else { 
  30. next_post_link('%link', __('Next post', 'mh-impact-lite') . '<i class="fa fa-chevron-right"></i>'); 
  31. echo '</li>' . "\n"; 
  32. echo '</ul>' . "\n"; 
  33. echo '</nav>' . "\n";