daily pastebin goal
37%
SHARE
TWEET

Extending $post in WordPress

RalfAlbert Aug 18th, 2012 70 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top