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
if ( !function_exists( 'get_boundary_post_rel_link' ) ) { require_once ABSPATH . WPINC . '/deprecated.php'; } // Optional. Link title format. $title = '%title'; // Optional. Whether link should be in a same category. $in_same_cat = false; // Optional. Excluded categories IDs. $excluded_categories = ''; // Optional, default is true. Whether to display link to first or last post. $start = true; // NOTICE! Understand what this does before running. $result = get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, $start);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/deprecated.php
- function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
- _deprecated_function( __FUNCTION__, '3.3.0' );
- $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
- // If there is no post stop.
- if ( empty($posts) )
- return;
- // Even though we limited get_posts to return only 1 item it still returns an array of objects.
- $post = $posts[0];
- if ( empty($post->post_title) )
- $date = mysql2date(get_option('date_format'), $post->post_date);
- $title = str_replace('%title', $post->post_title, $title);
- $title = str_replace('%date', $date, $title);
- $title = apply_filters('the_title', $title, $post->ID);
- $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
- $link .= esc_attr($title);
- $link .= "' href='" . get_permalink($post) . "' />\n";
- $boundary = $start ? 'start' : 'end';
- return apply_filters( "{$boundary}_post_rel_link", $link );
- }