tie get social 寫法

Published
2022-05-07
浏览次数 :  168

function tie_get_social( $newtab = true, $colored = true, $tooltip='ttip' ){
	$social = tie_get_option('social');

	if( !empty( $social ) && is_array( $social ) ){
		extract($social);
	}

	if ( !empty( $newtab ) ) $newtab = "target=\"_blank\"";
	else $newtab = '';

	if ( !empty( $colored ) ) $colored = " social-colored";
	else $colored = '';

		?>
		<div class="social-icons<?php echo $colored ?>">
		<?php
		// RSS
		if ( tie_get_option('rss_icon') ){
		if ( tie_get_option('rss_url') != '' && tie_get_option('rss_url') != ' ' ) $rss = tie_get_option('rss_url') ;
		else $rss = get_bloginfo('rss2_url');
			?><a class="<?php echo $tooltip; ?>" title="Rss" href="<?php echo esc_url( $rss ) ; ?>" <?php echo $newtab; ?>><i class="fa fa-rss"></i></a><?php
		}
		// Facebook
		if ( !empty($facebook) && $facebook != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Facebook" href="<?php echo esc_url( $facebook ); ?>" <?php echo $newtab; ?>><i class="fa fa-facebook"></i></a><?php
		}
		// Twitter
		if ( !empty($twitter) && $twitter != ' ') {
			?><a class="<?php echo $tooltip; ?>" title="Twitter" href="<?php echo esc_url( $twitter ); ?>" <?php echo $newtab; ?>><i class="fa fa-twitter"></i></a><?php
		}
		// Pinterest
		if ( !empty($Pinterest) && $Pinterest != ' ') {
			?><a class="<?php echo $tooltip; ?>" title="Pinterest" href="<?php echo esc_url( $Pinterest ); ?>" <?php echo $newtab; ?>><i class="fa fa-pinterest"></i></a><?php
		}
		// dribbble
		if ( !empty($dribbble) && $dribbble != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Dribbble" href="<?php echo esc_url( $dribbble ); ?>" <?php echo $newtab; ?>><i class="fa fa-dribbble"></i></a><?php
		}
		// LinkedIN
		if ( !empty($linkedin) && $linkedin != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="LinkedIn" href="<?php echo esc_url( $linkedin ); ?>" <?php echo $newtab; ?>><i class="fa fa-linkedin"></i></a><?php
		}
		// evernote
		if ( !empty($evernote) && $evernote != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Evernote" href="<?php echo esc_url( $evernote ); ?>" <?php echo $newtab; ?>><i class="tieicon-evernote"></i></a><?php
		}
		// Flickr
		if ( !empty($flickr) && $flickr != ' ') {
			?><a class="<?php echo $tooltip; ?>" title="Flickr" href="<?php echo esc_url( $flickr ); ?>" <?php echo $newtab; ?>><i class="tieicon-flickr"></i></a><?php
		}
		// Picasa
		if ( !empty($picasa) && $picasa != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Picasa" href="<?php echo esc_url( $picasa ); ?>" <?php echo $newtab; ?>><i class="tieicon-picasa"></i></a><?php
		}
		// YouTube
		if ( !empty($youtube) && $youtube != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Youtube" href="<?php echo esc_url( $youtube ); ?>" <?php echo $newtab; ?>><i class="fa fa-youtube"></i></a><?php
		}
		// Skype
		if ( !empty($skype) && $skype != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Skype" href="<?php echo esc_url( $skype ); ?>" <?php echo $newtab; ?>><i class="fa fa-skype"></i></a><?php
		}
		// Digg
		if ( !empty($digg) && $digg != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Digg" href="<?php echo esc_url( $digg ); ?>" <?php echo $newtab; ?>><i class="fa fa-digg"></i></a><?php
		}
		// Reddit
		if ( !empty($reddit) && $reddit != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Reddit" href="<?php echo esc_url( $reddit ); ?>" <?php echo $newtab; ?>><i class="fa fa-reddit"></i></a><?php
		}
		// Delicious
		if ( !empty($delicious) && $delicious != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Delicious" href="<?php echo esc_url( $delicious ); ?>" <?php echo $newtab; ?>><i class="fa fa-delicious"></i></a><?php
		}
		// stumbleuponUpon
		if ( !empty($stumbleupon) && $stumbleupon != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="StumbleUpon" href="<?php echo esc_url( $stumbleupon ); ?>" <?php echo $newtab; ?>><i class="fa fa-stumbleupon"></i></a><?php
		}
		// Tumblr
		if ( !empty($tumblr) && $tumblr != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Tumblr" href="<?php echo esc_url( $tumblr ); ?>" <?php echo $newtab; ?>><i class="fa fa-tumblr"></i></a><?php
		}
		// Vimeo
		if ( !empty($vimeo) && $vimeo != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Vimeo" href="<?php echo esc_url( $vimeo ); ?>" <?php echo $newtab; ?>><i class="tieicon-vimeo"></i></a><?php
		}
		// Blogger
		if ( !empty($blogger) && $blogger != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Blogger" href="<?php echo esc_url( $blogger ); ?>" <?php echo $newtab; ?>><i class="tieicon-blogger"></i></a><?php
		}
		// Wordpress
		if ( !empty($wordpress) && $wordpress != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="WordPress" href="<?php echo esc_url( $wordpress ); ?>" <?php echo $newtab; ?>><i class="fa fa-wordpress"></i></a><?php
		}
		// Yelp
		if ( !empty($yelp) && $yelp != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Yelp" href="<?php echo esc_url( $yelp ); ?>" <?php echo $newtab; ?>><i class="fa fa-yelp"></i></a><?php
		}
		// Last.fm
		if ( !empty($lastfm) && $lastfm != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Last.fm" href="<?php echo esc_url( $lastfm ); ?>" <?php echo $newtab; ?>><i class="fa fa-lastfm"></i></a><?php
		}
		// grooveshark
		if ( !empty($grooveshark) && $grooveshark != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Grooveshark" href="<?php echo esc_url( $grooveshark ); ?>" <?php echo $newtab; ?>><i class="tieicon-grooveshark"></i></a><?php
		}
		// sharethis
		if ( !empty($sharethis) && $sharethis != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="ShareThis" href="<?php echo esc_url( $sharethis ); ?>" <?php echo $newtab; ?>><i class="fa fa-share-alt"></i></a><?php
		}
		// dropbox
		if ( !empty($dropbox) && $dropbox != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Dropbox" href="<?php echo esc_url( $dropbox ); ?>" <?php echo $newtab; ?>><i class="fa fa-dropbox"></i></a><?php
		}
		// xing.me
		if ( !empty($xing) && $xing != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Xing" href="<?php echo esc_url( $xing ); ?>" <?php echo $newtab; ?>><i class="fa fa-xing"></i></a><?php
		}
		// DeviantArt
		if ( !empty($deviantart) && $deviantart != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="DeviantArt" href="<?php echo esc_url( $deviantart ); ?>" <?php echo $newtab; ?>><i class="tieicon-deviantart"></i></a><?php
		}
		// Apple
		if ( !empty($apple) && $apple != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Apple" href="<?php echo esc_url( $apple ); ?>" <?php echo $newtab; ?>><i class="fa fa-apple"></i></a><?php
		}
		// foursquare
		if ( !empty($foursquare) && $foursquare != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Foursquare" href="<?php echo esc_url( $foursquare ); ?>" <?php echo $newtab; ?>><i class="fa fa-foursquare"></i></a><?php
		}
		// github
		if ( !empty($github) && $github != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Github" href="<?php echo esc_url( $github ); ?>" <?php echo $newtab; ?>><i class="fa fa-github"></i></a><?php
		}
		// soundcloud
		if ( !empty($soundcloud) && $soundcloud != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="SoundCloud" href="<?php echo esc_url( $soundcloud ); ?>" <?php echo $newtab; ?>><i class="fa fa-soundcloud"></i></a><?php
		}
		// behance
		if ( !empty( $behance ) && $behance != '' && $behance != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Behance" href="<?php echo esc_url( $behance ); ?>" <?php echo $newtab; ?>><i class="fa fa-behance"></i></a><?php
		}
		// instagram
		if ( !empty( $instagram ) && $instagram != '' && $instagram != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="instagram" href="<?php echo esc_url( $instagram ); ?>" <?php echo $newtab; ?>><i class="fa fa-instagram"></i></a><?php
		}
		// paypal
		if ( !empty( $paypal ) && $paypal != '' && $paypal != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="paypal" href="<?php echo esc_url( $paypal ); ?>" <?php echo $newtab; ?>><i class="fa fa-paypal"></i></a><?php
		}
		// spotify
		if ( !empty( $spotify ) && $spotify != '' && $spotify != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="spotify" href="<?php echo esc_url( $spotify ); ?>" <?php echo $newtab; ?>><i class="fa fa-spotify"></i></a><?php
		}
		// viadeo
		if ( !empty( $viadeo ) && $viadeo != '' && $viadeo != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="viadeo" href="<?php echo esc_url( $viadeo ); ?>" <?php echo $newtab; ?>><i class="tieicon-viadeo"></i></a><?php
		}
		// Google Play
		if ( !empty( $google_play ) && $google_play != '' && $google_play != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Google Play" href="<?php echo esc_url( $google_play ); ?>" <?php echo $newtab; ?>><i class="fa fa-play"></i></a><?php
		}
		// 500PX
		if ( !empty($px500) && $px500 != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="500px" href="<?php echo esc_url( $px500 ); ?>" <?php echo $newtab; ?>><i class="tieicon-fivehundredpx"></i></a><?php
		}
		// Forrst
		if ( !empty($forrst) && $forrst != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Forrst" href="<?php echo esc_url( $forrst ); ?>" <?php echo $newtab; ?>><i class="tieicon-forrst"></i></a><?php
		}
		// VK
		if ( !empty($vk) && $vk != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="vk.com" href="<?php echo esc_url( $vk ); ?>" <?php echo $newtab; ?>><i class="fa fa-vk"></i></a><?php
		}
		// SnapChat
		if ( !empty($snapchat) && $snapchat != ' ' ) {
			?><a class="<?php echo $tooltip; ?>" title="Snapchat" href="<?php echo esc_url( $snapchat ); ?>" <?php echo $newtab; ?>><i class="fa fa-snapchat"></i></a><?php
		}

		?>

		<?php //Custom Social Networking

		for( $i=1 ; $i<=5 ; $i++ ){
			if ( tie_get_option( "custom_social_icon_$i" )  && tie_get_option( "custom_social_url_$i" ) ) {
				?><a class="<?php echo $tooltip; ?>" <?php if ( tie_get_option( "custom_social_title_$i" ) ) echo ' title="'.tie_get_option( "custom_social_title_$i" ).'"'; ?> href="<?php echo esc_url( tie_get_option( 'custom_social_url_'.$i ) ) ?>" <?php echo $newtab; ?>><i class="fa <?php echo tie_get_option( "custom_social_icon_$i" ) ?>"></i></a><?php
			}
		}

		?>
	</div>

<?php
}

  • 标签1
  • 标签1
  • 标签1
Top