Advertisement
RalfAlbert

Extending $post in WordPress

Aug 18th, 2012
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement