forked from jbrad/standard
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsocial-networking.php
65 lines (47 loc) · 1.46 KB
/
social-networking.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* The template for rendering the social networking icons.
*
* @package Standard
* @since 3.0
* @version 3.1
*/
// Read the active social icon stirng
$social_options = get_option( 'standard_theme_social_options' );
$social_options = $social_options['active-social-icons'];
// Read out the URLs
$social_icons_urls = explode( ';', $social_options );
// Begin to build up the list looking for the anchors for each image, too
$html = '<ul class="nav social-icons clearfix">';
foreach( $social_icons_urls as $icon_url ) {
$icon_url_array = explode( '|' , $icon_url );
$url = null;
if( count( $icon_url_array ) == 1 ) {
$icon = $icon_url_array[0];
} else {
$icon = $icon_url_array[0];
$url = $icon_url_array[1];
} // end if/else
// Build the line item
if( isset( $url ) || '' != esc_url( $icon ) ) {
$html .= '<li>';
if( strpos( $icon, 'rss.png' ) > 0 ) {
$url = standard_get_rss_feed_url();
} // end if/else
// if the image has a URL, setup the anchor...
if( '' != $url ) {
$html .= '<a href="' . esc_url( str_replace( 'https://', 'http://', $url ) ) . '" class="fademe" target="_blank">';
} // end if
// display the image
$html .= '<img src="' . esc_url( $icon ) . '" alt="" />';
// ...and if the image has a URL, close the anchor
if( '' != $url ) {
$html .= '</a>';
} // end if
unset( $url );
$html .= '</li>';
} // end if/else
} // end foreach
$html .= '</ul>';
// Render the list
echo $html;