get_parent_post_rel_link

Get parent post relational link.

Description

(string) get_parent_post_rel_link( ); 

Returns (string)

Parameters (1)

0. $title — Optional. (string) => '%title'
Link title format. Default %title..

Usage

  1. if ( !function_exists( 'get_parent_post_rel_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Optional. Link title format. Default '%title'. 
  5. $title = '%title'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_parent_post_rel_link($title); 
  9.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function get_parent_post_rel_link( $title = '%title' ) { 
  2. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  3.  
  4. if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) 
  5. $post = get_post($GLOBALS['post']->post_parent); 
  6.  
  7. if ( empty($post) ) 
  8. return; 
  9.  
  10. $date = mysql2date(get_option('date_format'), $post->post_date); 
  11.  
  12. $title = str_replace('%title', $post->post_title, $title); 
  13. $title = str_replace('%date', $date, $title); 
  14. $title = apply_filters('the_title', $title, $post->ID); 
  15.  
  16. $link = "<link rel='up' title='"; 
  17. $link .= esc_attr( $title ); 
  18. $link .= "' href='" . get_permalink($post) . "' />\n"; 
  19.  
  20. return apply_filters( "parent_post_rel_link", $link );