cwp_megar_enhanced_image_navigation

Filter in a link to a content ID attribute for the next/previous image links on image attachment pages.

Description

cwp_megar_enhanced_image_navigation( $url, $id ); 

Parameters (2)

0. $url
The url.
1. $id
The id.

Usage

  1. if ( !function_exists( 'cwp_megar_enhanced_image_navigation' ) ) { 
  2. require_once '/inc/extras.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // The id. 
  8. $id = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cwp_megar_enhanced_image_navigation($url, $id); 
  12.  

Defined (1)

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

/inc/extras.php  
  1. function cwp_megar_enhanced_image_navigation( $url, $id ) { 
  2.  
  3. if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) 
  4.  
  5. return $url; 
  6.  
  7.  
  8.  
  9. $image = get_post( $id ); 
  10.  
  11. if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) 
  12.  
  13. $url .= '#main'; 
  14.  
  15.  
  16.  
  17. return $url; 
  18.