Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Allow shortcodes in excerpts
- add_filter( 'get_the_excerpt', 'do_shortcode');
- // Add Shortcode
- function pb_texticon( $atts , $content = null ) {
- // Attributes
- extract( shortcode_atts(
- array(
- 'ytb' => '',
- 'vim' => '',
- 'dwl' => '',
- 'url' => '',
- ), $atts )
- );
- // Code
- if ($ytb == '') {
- $yt='';
- } else {
- $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>';
- }
- if ($vim == '') {
- $vi='';
- } else {
- $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>';
- }
- if ($dwl == '') {
- $dw='';
- } else {
- $dw='<a href="' . $dwl . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/file_download_icon_24.png" alt="file" /></a>';
- }
- if ($url == '') {
- $ur='';
- } else {
- $ur='<a href="' . $url . '" target="_blank"><img src="http://probiner.xyz/pb_contents/images/icons/link_icon_24.png" alt="file" /></a>';
- }
- $result='<span id="texticon">' . $yt . $vi . $dw . $ur . $content . '</span>';
- return $result;
- }
- add_shortcode( 'pb_txi', 'pb_texticon' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement