RalfAlbert

Extending $post in WordPress

Aug 18th, 2012
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global $post;
  2.  
  3. $post->post_link = function() use ( $post ){
  4.    
  5.     return sprintf(
  6.         '<a href="%s" title="%s">%s</a>',
  7.         get_permalink( $post->ID ), $post->post_name, $post->post_title
  8.     );
  9. };
  10.  
  11. $postlink = $post->post_link;
  12.  
  13. echo $postlink();
RAW Paste Data