Advertisement
calvino

formatlink

Mar 26th, 2011
2,736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php if (has_post_format('link')): ?>
  2. <?php
  3. $content = get_the_content();
  4. $linktoend = stristr($content, "http" );
  5. $afterlink = stristr($linktoend, ">");
  6. if ( ! strlen( $afterlink ) == 0 ):
  7. $linkurl = substr($linktoend, 0, -(strlen($afterlink) + 1));
  8. else:
  9. $linkurl = $linktoend;
  10. endif;
  11. ?>
  12. <a href="<?php echo $linkurl; ?>"><?php the_title(); ?></a>
  13. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement