Changeset 1260186
- Timestamp:
- 10/06/2015 06:57:13 AM (10 years ago)
- File:
-
- 1 edited
-
wp-page-title-with-icon/trunk/admin/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-page-title-with-icon/trunk/admin/functions.php
r1257112 r1260186 73 73 74 74 /* Ouputs icon in Front End with page/post title*/ 75 if(!is_admin()) 75 76 add_filter('the_title', 'display_pagetitle_icon'); 77 76 78 function display_pagetitle_icon($title){ 77 global $post;78 /* get values from post meta*/79 $value = get_post_meta( $post->ID, '_wpptwi_icon', true );80 $icon_color = get_post_meta( $post->ID, '_wpptwi_icon_color', true );81 $icon_size = get_post_meta( $post->ID, '_wpptwi_icon_size', true );79 global $post; 80 /* get values from post meta*/ 81 $value = get_post_meta( $post->ID, '_wpptwi_icon', true ); 82 $icon_color = get_post_meta( $post->ID, '_wpptwi_icon_color', true ); 83 $icon_size = get_post_meta( $post->ID, '_wpptwi_icon_size', true ); 82 84 83 /* escapes html entities*/84 $icon = esc_attr( $value );85 $icon_color = esc_attr( $icon_color );86 $icon_size = esc_attr( $icon_size );85 /* escapes html entities*/ 86 $icon = esc_attr( $value ); 87 $icon_color = esc_attr( $icon_color ); 88 $icon_size = esc_attr( $icon_size ); 87 89 88 /* checks if the icon is empty, title is in the loop*/89 if(!empty($icon) && in_the_loop()){90 /* checks if the icon is empty, title is in the loop*/ 91 if(!empty($icon) && in_the_loop()){ 90 92 91 /* check if this is the current page */92 if( is_page($post->ID) && $title == $post->post_title )93 /* check if this is the current page */ 94 if( is_page($post->ID) && $title == $post->post_title ) 93 95 94 return '<i class="fa '.$icon.'" style="color:'.$icon_color.'; font-size:'.$icon_size.'px"></i> '.$title;96 return '<i class="fa '.$icon.'" style="color:'.$icon_color.'; font-size:'.$icon_size.'px"></i> '.$title; 95 97 96 /* check if this is the current post */97 else if( is_single($post->ID) && $title == $post->post_title ){98 /* check if this is the current post */ 99 else if( is_single($post->ID) && $title == $post->post_title ){ 98 100 99 return '<i class="fa '.$icon.'" style="color:'.$icon_color.'; font-size:'.$icon_size.'px"></i> '.$title; 101 return '<i class="fa '.$icon.'" style="color:'.$icon_color.'; font-size:'.$icon_size.'px"></i> '.$title; 102 } 103 104 /* else return title */ 105 else{ 106 return $title; 107 } 100 108 } 101 102 /* else return title */103 109 else{ 104 110 return $title; 105 111 } 106 }107 else{108 return $title;109 }110 112 111 113 }
Note: See TracChangeset
for help on using the changeset viewer.