get_boundary_post_rel_link

Get boundary post relational link.

Description

(string) get_boundary_post_rel_link( , (constant) $in_same_cat = false, (string) $excluded_categories = '', (constant) $start = true ); 

Can either be start or end post relational link.

Returns (string)

Parameters (4)

0. $title — Optional. (string) => '%title'
Link title format.
1. $in_same_cat — Optional. (constant) => false
Whether link should be in a same category.
2. $excluded_categories — Optional. (string) => ''
Excluded categories IDs.
3. $start — Optional. (constant) => true
Optional, default is true. Whether to display link to first or last post.

Usage

  1. if ( !function_exists( 'get_boundary_post_rel_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Optional. Link title format. 
  5. $title = '%title'; 
  6.  
  7. // Optional. Whether link should be in a same category. 
  8. $in_same_cat = false; 
  9.  
  10. // Optional. Excluded categories IDs. 
  11. $excluded_categories = ''; 
  12.  
  13. // Optional, default is true. Whether to display link to first or last post. 
  14. $start = true; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, $start); 
  18.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { 
  2. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  3.  
  4. $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); 
  5. // If there is no post stop. 
  6. if ( empty($posts) ) 
  7. return; 
  8.  
  9. // Even though we limited get_posts to return only 1 item it still returns an array of objects. 
  10. $post = $posts[0]; 
  11.  
  12. if ( empty($post->post_title) ) 
  13. $post->post_title = $start ? __('First Post') : __('Last Post'); 
  14.  
  15. $date = mysql2date(get_option('date_format'), $post->post_date); 
  16.  
  17. $title = str_replace('%title', $post->post_title, $title); 
  18. $title = str_replace('%date', $date, $title); 
  19. $title = apply_filters('the_title', $title, $post->ID); 
  20.  
  21. $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; 
  22. $link .= esc_attr($title); 
  23. $link .= "' href='" . get_permalink($post) . "' />\n"; 
  24.  
  25. $boundary = $start ? 'start' : 'end'; 
  26. return apply_filters( "{$boundary}_post_rel_link", $link );