Advertisement
Guest User

Untitled

a guest
Mar 13th, 2015
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. // Allow shortcodes in excerpts
  4. add_filter( 'get_the_excerpt', 'do_shortcode');
  5.  
  6. // Add Shortcode
  7. function pb_texticon( $atts , $content = null ) {
  8.  
  9.     // Attributes
  10.     extract( shortcode_atts(
  11.         array(
  12.             'ytb' => '',
  13.             'vim' => '',
  14.             'dwl' => '',
  15.             'url' => '',
  16.         ), $atts )
  17.     );
  18.  
  19.     // Code
  20. if ($ytb == '') {
  21.     $yt='';
  22. } else {
  23.     $yt= '<a href="https://www.youtube.com/watch?v=' . $ytb . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/youtube_icon_24.png" alt="vimeo" /></a>';
  24. }
  25.  
  26. if ($vim == '') {
  27.     $vi='';
  28. } else {
  29.     $vi='<a href="https://vimeo.com/' . $vim . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/vimeo_icon_24.png" alt="vimeo" /></a>';
  30. }
  31.  
  32. if ($dwl == '') {
  33.     $dw='';
  34. } else {
  35.     $dw='<a href="' . $dwl . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/file_download_icon_24.png" alt="file" /></a>';
  36. }
  37.  
  38. if ($url == '') {
  39.     $ur='';
  40. } else {
  41.     $ur='<a href="' . $url . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/link_icon_24.png" alt="file" /></a>';
  42. }
  43.  
  44.  
  45. $result='<span id="texticon">' . $yt . $vi . $dw . $ur . $content . '</span>';
  46.  
  47. return $result;
  48. }
  49. add_shortcode( 'pb_txi', 'pb_texticon' );
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement