Changeset 510511
- Timestamp:
- 02/25/2012 07:13:38 PM (14 years ago)
- Location:
- wp-about-author
- Files:
-
- 40 added
- 4 edited
-
assets (added)
-
assets/banner-772x250.png (added)
-
tags/1.3 (added)
-
tags/1.3/images (added)
-
tags/1.3/images/delicious.png (added)
-
tags/1.3/images/digg.png (added)
-
tags/1.3/images/facebook.png (added)
-
tags/1.3/images/feed.png (added)
-
tags/1.3/images/flickr.png (added)
-
tags/1.3/images/googleplus.png (added)
-
tags/1.3/images/jonbishopcom.png (added)
-
tags/1.3/images/linkedin.png (added)
-
tags/1.3/images/pinterest.png (added)
-
tags/1.3/images/reddit.png (added)
-
tags/1.3/images/stumbleupon.png (added)
-
tags/1.3/images/twitter.png (added)
-
tags/1.3/images/wordpress.png (added)
-
tags/1.3/images/wordpressorg.png (added)
-
tags/1.3/images/yelp.png (added)
-
tags/1.3/images/youtube.png (added)
-
tags/1.3/readme.txt (added)
-
tags/1.3/screenshot-1.png (added)
-
tags/1.3/screenshot-2.png (added)
-
tags/1.3/wp-about-author-admin.php (added)
-
tags/1.3/wp-about-author.css (added)
-
tags/1.3/wp-about-author.php (added)
-
trunk/images/delicious.png (added)
-
trunk/images/digg.png (added)
-
trunk/images/facebook.png (added)
-
trunk/images/feed.png (added)
-
trunk/images/flickr.png (added)
-
trunk/images/googleplus.png (added)
-
trunk/images/linkedin.png (added)
-
trunk/images/pinterest.png (added)
-
trunk/images/reddit.png (added)
-
trunk/images/stumbleupon.png (added)
-
trunk/images/twitter.png (added)
-
trunk/images/wordpress.png (added)
-
trunk/images/yelp.png (added)
-
trunk/images/youtube.png (added)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/wp-about-author-admin.php (modified) (12 diffs)
-
trunk/wp-about-author.css (modified) (2 diffs)
-
trunk/wp-about-author.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-about-author/trunk/readme.txt
r409518 r510511 4 4 Tags: author, author bio, author box, post, widget, bio, twitter, facebook, about, about author 5 5 Requires at least: 3.0 6 Tested up to: 3. 2.17 Stable tag: 1. 26 Tested up to: 3.3.1 7 Stable tag: 1.3 8 8 9 9 Easily display customizable author bios below your posts … … 18 18 1. Change background color with easy to use color picker 19 19 1. Display settings allow you to control when to display author bios 20 1. Display text links or icons to a users social media profiles 20 21 21 This plugin also expands your profile page by adding Twitter and Facebookfields so it's easier for readers to follow your authors.22 This plugin also expands your profile page by adding popular social media fields so it's easier for readers to follow your authors. 22 23 23 24 == Installation == … … 35 36 Of course your can. It's one of the options available to you in the settings panel. 36 37 38 = Can I change the layout of the content in the box? = 39 40 As of version 1.3 you can. All you have to do is create your own HTML using the following templates tags and use a filter. 41 42 Templates tags are: %%bordertype%%, %%borderbg%%, %%authorpic%% and %%content%% 43 44 Example: 45 Add the following to a functionality plugin or your functions.php file 46 `<?php 47 function my_wp_about_author_template(){ 48 return '<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>'; 49 } 50 add_filter('wp_about_author_template', 'my_wp_about_author_template'); 51 ?>` 52 53 = Can I add additional social media links? = 54 55 As of version 1.3 you can. Once again using a filter you can intercept the data that generates these links and add your own. 56 57 Example: 58 Add the following to a functionality plugin or your functions.php file 59 `<?php 60 function my_wp_about_author_social($social){ 61 $social['my_service_key'] = array( 62 'link'=>'http://www.myservice.com/%%username%%', 63 'title'=>'My Service', 64 'icon'=>'http://www.fullpathtoicon.com/icon.png' 65 ); 66 return '<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>'; 67 } 68 add_filter('wp_about_author_get_socials', 'my_wp_about_author_social'); 69 ?>` 70 71 = Can I filter the author box from additional pages not listed in my settings? = 72 73 Sure thing. Now there's a WordPress filter for that. 74 75 Example: 76 Add the following to a functionality plugin or your functions.php file to exclude the author box from a page with the id equal to 100 77 `<?php 78 function my_wp_about_author_display($author_content){ 79 if(is_page(100)) 80 return ""; 81 return $author_content; 82 } 83 add_filter('wp_about_author_display', 'my_wp_about_author_display'); 84 ?>` 85 86 87 = Are there any other filters that let me modify the output? = 88 89 The following filters have been added: 90 wp_about_author_name - Modify the output of the name in the author box 91 wp_about_author_description - Modify the output of the description in the author box 92 wp_about_author_more_posts - Modify the "More Posts" text in the author box 93 wp_about_author_website - Modify the "Website" text in the author box 94 wp_about_author_follow_me - Modify the "Follow Me:" text in the author box 95 wp_about_author_separator - Change the separator displayed between text links 96 37 97 38 98 == Screenshots == … … 44 104 == Changelog == 45 105 46 The current version is 1.2 (2011.7.13) 106 The current version is 1.3 (2012.2.23) 107 108 = 1.3 (2012.2.23) = 109 * Added social media icons as an alternative to text links 110 * Optimized code and added actions and filters for developers to modify output 111 * Cleaned up settings area 112 113 = 1.2 (2011.7.13) = 114 * Added option to display bio in feed 47 115 48 116 = 1.1 (2010.11.30) = … … 50 118 * Fixed formatting issues 51 119 52 = 1.2 (2011.7.13) =53 * Added option to display bio in feed54 55 56 120 = 1.0 = 57 121 * Plugin released -
wp-about-author/trunk/wp-about-author-admin.php
r409518 r510511 1 1 <?PHP 2 2 3 //============================================= 3 4 // Load admin styles 4 5 //============================================= 5 6 function add_wp_about_author_admin_styles() { 6 global $pagenow;7 if ( $pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'],"wp-about-author")) {8 wp_enqueue_style('dashboard');9 wp_enqueue_style('global');10 wp_enqueue_style('wp-admin');11 wp_enqueue_style('farbtastic');12 }7 global $pagenow; 8 if ($pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'], "wp-about-author")) { 9 wp_enqueue_style('dashboard'); 10 wp_enqueue_style('global'); 11 wp_enqueue_style('wp-admin'); 12 wp_enqueue_style('farbtastic'); 13 } 13 14 } 14 15 … … 17 18 //============================================= 18 19 function add_wp_about_author_admin_scripts() { 19 global $pagenow;20 if ( $pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'],"wp-about-author")) {21 wp_enqueue_script('postbox');22 wp_enqueue_script('dashboard');23 wp_enqueue_script('custom-background');24 }20 global $pagenow; 21 if ($pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'], "wp-about-author")) { 22 wp_enqueue_script('postbox'); 23 wp_enqueue_script('dashboard'); 24 wp_enqueue_script('custom-background'); 25 } 25 26 } 26 27 … … 29 30 //============================================= 30 31 function wp_about_author_show_plugin_support() { 31 $content = '<p>Leave a comment on the <a target="_blank" href="http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/#comments">WP About Author Plugin Page</a></p>32 $content = '<p>Leave a comment on the <a target="_blank" href="http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/#comments">WP About Author Plugin Page</a></p> 32 33 <p style="text-align:center;">- or -</p> 33 34 <p>Create a new topic on the <a target="_blank" href="http://wordpress.org/tags/wp-about-author">WordPress Support Forum</a></p>'; 34 return wp_about_author_postbox('wp-about-author-support', 'Support', $content);35 return wp_about_author_postbox('wp-about-author-support', 'Support', $content); 35 36 } 36 37 … … 39 40 //============================================= 40 41 function wp_about_author_show_donate() { 41 $content = '<p>If you like this plugin please consider donating a few bucks to support its development. If you can\'t spare any change you can also help by giving me a good rating on WordPress.org and tweeting this plugin to your followers.42 $content = '<p>If you like this plugin please consider donating a few bucks to support its development. If you can\'t spare any change you can also help by giving me a good rating on WordPress.org and tweeting this plugin to your followers. 42 43 <ul> 43 44 <li><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jonbish%40gmail%2ecom&lc=US¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">Donate With PayPal</a></li> … … 45 46 <li><a target="_blank" href="http://twitter.com/?status=WordPress Plugin: Easily Display Customizable Author Bios Below Posts http://bit.ly/a5mDhh (via @jondbishop)">Share On Twitter</a></li> 46 47 </ul></p>'; 47 return wp_about_author_postbox('wp-about-author-donate', 'Donate & Share', $content);48 return wp_about_author_postbox('wp-about-author-donate', 'Donate & Share', $content); 48 49 } 49 50 … … 52 53 //============================================= 53 54 function wp_about_author_show_blogfeed() { 54 include_once(ABSPATH . WPINC . '/feed.php');55 $content = "";56 $rss = fetch_feed("http://feeds.feedburner.com/JonBishop");57 if (!is_wp_error( $rss )) {58 $maxitems = $rss->get_item_quantity(5); 59 $rss_items = $rss->get_items(0, $maxitems); 60 }61 62 if ($maxitems == 0) {63 $content .= "<p>No Posts</p>";64 } else {65 $content .= "<ul>";66 foreach ( $rss_items as $item ) { 67 $content .= "<li><a href='" . $item->get_permalink(). "' title='Posted ".$item->get_date('j F Y | g:i a') ."'>" . $item->get_title() . "</a></li>";68 }69 $content .= "</ul>";70 $content .= "<p><a href='" . $rss->get_permalink() . "'>More Posts »</a></p>";71 }72 return wp_about_author_postbox('wp-about-author-blog-rss', 'Tips and Tricks', $content);55 include_once(ABSPATH . WPINC . '/feed.php'); 56 $content = ""; 57 $rss = fetch_feed("http://feeds.feedburner.com/JonBishop"); 58 if (!is_wp_error($rss)) { 59 $maxitems = $rss->get_item_quantity(5); 60 $rss_items = $rss->get_items(0, $maxitems); 61 } 62 63 if ($maxitems == 0) { 64 $content .= "<p>No Posts</p>"; 65 } else { 66 $content .= "<ul>"; 67 foreach ($rss_items as $item) { 68 $content .= "<li><a href='" . $item->get_permalink() . "' title='Posted " . $item->get_date('j F Y | g:i a') . "'>" . $item->get_title() . "</a></li>"; 69 } 70 $content .= "</ul>"; 71 $content .= "<p><a href='" . $rss->get_permalink() . "'>More Posts »</a></p>"; 72 } 73 return wp_about_author_postbox('wp-about-author-blog-rss', 'Tips and Tricks', $content); 73 74 } 74 75 … … 76 77 // Contact page options 77 78 //============================================= 78 function wp_about_author_general_settings(){ 79 $wp_about_author_settings = wp_about_author_process_settings(); 80 81 $wrapped_content = ""; 82 $general_content = ""; 83 $box_content = ""; 84 85 if ( function_exists('wp_nonce_field') ){ $general_content .= wp_nonce_field('wp-about-author-update-options','_wpnonce',true,false); } 86 $general_content .= '<p><strong>' . __("Display On Front Page") . '</strong><br /> 87 <input type="checkbox" name="wp_author_display_front" ' .checked($wp_about_author_settings['wp_author_display_front'], 'on', false) . ' /> 88 <small>Display buttons on the front page at the top of each entry.</small></p>'; 89 $general_content .= '<p><strong>' . __("Display In Archives") . '</strong><br /> 90 <input type="checkbox" name="wp_author_display_archives" ' .checked($wp_about_author_settings['wp_author_display_archives'], 'on', false) . ' /> 91 <small>Display buttons on the archive pages at the top of each entry.</small></p>'; 92 $general_content .= '<p><strong>' . __("Display In Search Results") . '</strong><br /> 93 <input type="checkbox" name="wp_author_display_search" ' .checked($wp_about_author_settings['wp_author_display_search'], 'on', false) . ' /> 94 <small>Display buttons on the search page at the top of each entry.</small></p>'; 95 $general_content .= '<p><strong>' . __("Display On Individual Posts") . '</strong><br /> 96 <input type="checkbox" name="wp_author_display_posts" ' .checked($wp_about_author_settings['wp_author_display_posts'], 'on', false) . ' /> 97 <small>Display buttons on individual posts at the top of the entry.</small></p>'; 98 $general_content .= '<p><strong>' . __("Display On Individual Pages") . '</strong><br /> 99 <input type="checkbox" name="wp_author_display_pages" ' .checked($wp_about_author_settings['wp_author_display_pages'], 'on', false) . ' /> 100 <small>Display buttons on individual pages at the top of the entry.</small></p>'; 101 $general_content .= '<p><strong>' . __("Display In RSS Feeds") . '</strong><br /> 102 <input type="checkbox" name="wp_author_display_feed" ' .checked($wp_about_author_settings['wp_author_display_feed'], 'on', false) . ' /> 103 <small>Display buttons in feeds at the top of each entry.</small></p>'; 104 $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Display Settings', $general_content); 105 106 $box_content .= '<p><strong>' . __("Box Background Color") . '</strong><br /> 79 function wp_about_author_general_settings() { 80 $wp_about_author_settings = wp_about_author_process_settings(); 81 82 $wrapped_content = ""; 83 $general_content = ""; 84 $social_content = ""; 85 $box_content = ""; 86 87 if (function_exists('wp_nonce_field')) { 88 $general_content .= wp_nonce_field('wp-about-author-update-options', '_wpnonce', true, false); 89 } 90 $general_content .= '<p><strong>' . __("Display On Front Page") . '</strong><br /> 91 <input type="checkbox" name="wp_author_display_front" ' . checked($wp_about_author_settings['wp_author_display_front'], 'on', false) . ' /> 92 <small>Display author box on the front page at the top of each entry.</small></p>'; 93 $general_content .= '<p><strong>' . __("Display In Archives") . '</strong><br /> 94 <input type="checkbox" name="wp_author_display_archives" ' . checked($wp_about_author_settings['wp_author_display_archives'], 'on', false) . ' /> 95 <small>Display author box on the archive pages at the top of each entry.</small></p>'; 96 $general_content .= '<p><strong>' . __("Display In Search Results") . '</strong><br /> 97 <input type="checkbox" name="wp_author_display_search" ' . checked($wp_about_author_settings['wp_author_display_search'], 'on', false) . ' /> 98 <small>Display author box on the search page at the top of each entry.</small></p>'; 99 $general_content .= '<p><strong>' . __("Display On Individual Posts") . '</strong><br /> 100 <input type="checkbox" name="wp_author_display_posts" ' . checked($wp_about_author_settings['wp_author_display_posts'], 'on', false) . ' /> 101 <small>Display author box on individual posts at the top of the entry.</small></p>'; 102 $general_content .= '<p><strong>' . __("Display On Individual Pages") . '</strong><br /> 103 <input type="checkbox" name="wp_author_display_pages" ' . checked($wp_about_author_settings['wp_author_display_pages'], 'on', false) . ' /> 104 <small>Display author box on individual pages at the top of the entry.</small></p>'; 105 $general_content .= '<p><strong>' . __("Display In RSS Feeds") . '</strong><br /> 106 <input type="checkbox" name="wp_author_display_feed" ' . checked($wp_about_author_settings['wp_author_display_feed'], 'on', false) . ' /> 107 <small>Display author box in feeds at the top of each entry.</small></p>'; 108 $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Display Settings', $general_content); 109 110 $social_content .= '<p><strong>' . __("Display Social Media Icons") . '</strong><br /> 111 <input type="checkbox" name="wp_author_social_images" ' . checked($wp_about_author_settings['wp_author_social_images'], 'on', false) . ' /> 112 <small>Display buttons instead of text links in the author box.</small></p>'; 113 $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Social Links Display Settings', $social_content); 114 115 $box_content .= '<p><strong>' . __("Box Background Color") . '</strong><br /> 107 116 <input type="text" name="wp_author_alert_bg" id="background-color" value="' . $wp_about_author_settings['wp_author_alert_bg'] . '" /> 108 117 <a class="hide-if-no-js" href="#" id="pickcolor">' . __('Select a Color') . '</a> 109 118 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 110 119 <small>By default, the background color of the box is a yellowish tone.</small></p>'; 111 $box_content .= '<p><strong>' . __("Box Border") . '</strong><br />120 $box_content .= '<p><strong>' . __("Box Border") . '</strong><br /> 112 121 <select name="wp_author_alert_border"> 113 <option value="top" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'top', false) . '>Thick Top Border</option>114 <option value="around" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'around', false) . '>Thin Surrounding Border</option>115 <option value="none" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'none', false) . '>No Border</option>122 <option value="top" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'top', false) . '>Thick Top Border</option> 123 <option value="around" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'around', false) . '>Thin Surrounding Border</option> 124 <option value="none" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'none', false) . '>No Border</option> 116 125 </select><br /><small>By default, a thick black line is displayed above the author bio.</small></p>'; 117 $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-alert', 'Box Settings', $box_content); 118 119 wp_about_author_admin_wrap('WP About Author Settings', $wrapped_content); 120 } 126 $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-alert', 'Box Settings', $box_content); 127 128 wp_about_author_admin_wrap('WP About Author Settings', $wrapped_content); 129 } 130 // 131 function wp_about_author_get_options(){ 132 $fields = array( 133 'wp_author_alert_border' => "", 134 'wp_author_display_front' => "", 135 'wp_author_display_archives' => "", 136 'wp_author_display_search' => "", 137 'wp_author_display_posts' => "", 138 'wp_author_display_pages' => "", 139 'wp_author_display_feed' => "", 140 'wp_author_social_images' => "" 141 ); 142 $wp_about_author_settings = get_option('wp_about_author_settings'); 143 return wp_parse_args( $wp_about_author_settings, $fields ); 144 } 145 121 146 122 147 //============================================= … … 124 149 //============================================= 125 150 function wp_about_author_process_settings() { 126 if ( !empty($_POST['wp_about_author_option_submitted']) ){ 127 $wp_about_author_settings = array(); 128 129 if(strstr($_GET['page'],"wp-about-author") && check_admin_referer('wp-about-author-update-options')){ 130 $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['wp_author_alert_bg']); 131 if ((strlen($color)==6||strlen($color) == 3)&&isset($_POST['wp_author_alert_bg'])){ $wp_about_author_settings['wp_author_alert_bg']=$_POST['wp_author_alert_bg']; } 132 if(isset($_POST['wp_author_alert_border'])){ $wp_about_author_settings['wp_author_alert_border']=$_POST['wp_author_alert_border']; } 133 if(isset($_POST['wp_author_display_front'])){ $wp_about_author_settings['wp_author_display_front']=$_POST['wp_author_display_front']; } 134 if(isset($_POST['wp_author_display_archives'])){ $wp_about_author_settings['wp_author_display_archives']=$_POST['wp_author_display_archives']; } 135 if(isset($_POST['wp_author_display_search'])){ $wp_about_author_settings['wp_author_display_search']=$_POST['wp_author_display_search']; } 136 if(isset($_POST['wp_author_display_posts'])){ $wp_about_author_settings['wp_author_display_posts']=$_POST['wp_author_display_posts']; } 137 if(isset($_POST['wp_author_display_pages'])){ $wp_about_author_settings['wp_author_display_pages']=$_POST['wp_author_display_pages']; } 138 if(isset($_POST['wp_author_display_feed'])){ $wp_about_author_settings['wp_author_display_feed']=$_POST['wp_author_display_feed']; } 139 140 echo "<div id=\"updatemessage\" class=\"updated fade\"><p>WP About Author settings updated.</p></div>\n"; 141 echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>"; 142 143 update_option('wp_about_author_settings', $wp_about_author_settings); 144 } 145 }//updated 146 $wp_about_author_settings=get_option('wp_about_author_settings'); 147 return $wp_about_author_settings; 151 $fields = wp_about_author_get_options(); 152 if (!empty($_POST['wp_about_author_option_submitted'])) { 153 $wp_about_author_settings = array(); 154 155 if (strstr($_GET['page'], "wp-about-author") && check_admin_referer('wp-about-author-update-options')) { 156 $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['wp_author_alert_bg']); 157 if ((strlen($color) == 6 || strlen($color) == 3) && isset($_POST['wp_author_alert_bg'])) { 158 $wp_about_author_settings['wp_author_alert_bg'] = $_POST['wp_author_alert_bg']; 159 } 160 foreach ($fields as $field_key=>$field_value) { 161 if (isset($_POST[$field_key])) { 162 $wp_about_author_settings[$field_key] = $_POST[$field_key]; 163 } else { 164 $wp_about_author_settings[$field_key] = ""; 165 } 166 } 167 echo "<div id=\"updatemessage\" class=\"updated fade\"><p>WP About Author settings updated.</p></div>\n"; 168 echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>"; 169 update_option('wp_about_author_settings', $wp_about_author_settings); 170 } 171 }//updated 172 173 $wp_about_author_settings = get_option('wp_about_author_settings'); 174 $wp_about_author_settings = wp_parse_args( $wp_about_author_settings, $fields ); 175 176 return $wp_about_author_settings; 148 177 } 149 178 … … 152 181 //============================================= 153 182 function add_wp_about_author_options_subpanel() { 154 if (function_exists('add_options_page')) {155 add_options_page('WP About Author', 'WP About Author', 'manage_options', __FILE__, 'wp_about_author_general_settings');156 }183 if (function_exists('add_options_page')) { 184 add_options_page('WP About Author', 'WP About Author', 'manage_options', __FILE__, 'wp_about_author_general_settings'); 185 } 157 186 } 158 187 … … 161 190 //============================================= 162 191 function wp_about_author_postbox($id, $title, $content) { 163 $postbox_wrap = "";164 $postbox_wrap .= '<div id="' . $id . '" class="postbox">';165 $postbox_wrap .= '<div class="handlediv" title="Click to toggle"><br /></div>';166 $postbox_wrap .= '<h3 class="hndle"><span>' . $title . '</span></h3>';167 $postbox_wrap .= '<div class="inside">' . $content . '</div>';168 $postbox_wrap .= '</div>';169 return $postbox_wrap;170 } 192 $postbox_wrap = ""; 193 $postbox_wrap .= '<div id="' . $id . '" class="postbox">'; 194 $postbox_wrap .= '<div class="handlediv" title="Click to toggle"><br /></div>'; 195 $postbox_wrap .= '<h3 class="hndle"><span>' . $title . '</span></h3>'; 196 $postbox_wrap .= '<div class="inside">' . $content . '</div>'; 197 $postbox_wrap .= '</div>'; 198 return $postbox_wrap; 199 } 171 200 172 201 //============================================= … … 174 203 //============================================= 175 204 function wp_about_author_admin_wrap($title, $content) { 176 ?>205 ?> 177 206 <div class="wrap"> 178 207 <h2><?php echo $title; ?></h2> 179 208 <form method="post" action=""> 180 <div class="postbox-container" style="width:60%;"> 181 <div class="metabox-holder"> 182 <div class="meta-box-sortables"> 183 <?php 184 echo $content; 185 ?> 186 <p class="submit"> 187 <input type="submit" name="wp_about_author_option_submitted" class="button-primary" value="Save Changes" /> 188 </p> 189 <br /><br /> 209 <div id="dashboard-widgets-wrap"> 210 <div id="dashboard-widgets" class="metabox-holder"> 211 <div id="postbox-container-1" class="postbox-container" style="width:60%;"> 212 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 213 <?php 214 echo $content; 215 ?> 216 <p class="submit"> 217 <input type="submit" name="wp_about_author_option_submitted" class="button-primary" value="Save Changes" /> 218 </p> 219 </div> 190 220 </div> 191 </div> 192 </div> 193 <div class="postbox-container" style="width:30%;"> 194 <div class="metabox-holder"> 195 <div class="meta-box-sortables"> 196 <?php 197 echo wp_about_author_show_donate(); 198 echo wp_about_author_show_plugin_support(); 199 echo wp_about_author_show_blogfeed(); 200 ?> 221 <div id="postbox-container-2" class="postbox-container" style="width:30%;"> 222 <div id="side-sortables" class="meta-box-sortables ui-sortable"> 223 <?php 224 echo wp_about_author_show_donate(); 225 echo wp_about_author_show_plugin_support(); 226 echo wp_about_author_show_blogfeed(); 227 ?> 228 </div> 201 229 </div> 202 230 </div> … … 204 232 </form> 205 233 </div> 206 <?php234 <?php 207 235 } 208 236 ?> -
wp-about-author/trunk/wp-about-author.css
r312633 r510511 40 40 .wp-about-author-pic img{ 41 41 width: 100px; 42 height: 100px; 43 max-width: 100px; 42 44 } 43 45 .wp-about-author-text{ … … 45 47 margin: 0 0 0 140px; 46 48 } 49 .wp-about-author-text p { 50 margin: 0 0 5px 0; 51 } 52 .wp-about-author-text p.wpa-nomargin { 53 margin: 0; 54 } 55 .wpa-social-icons{ 56 margin:0 3px; 57 } 47 58 -
wp-about-author/trunk/wp-about-author.php
r409518 r510511 4 4 Plugin URI: http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/ 5 5 Description: Easily display customizable author bios below your posts 6 Version: 1. 26 Version: 1.3 7 7 Author: Jon Bishop 8 8 Author URI: http://www.jonbishop.com … … 23 23 24 24 $wp_about_author_content = ""; 25 $wp_about_author_links = ""; 26 $wp_about_author_social = ""; 25 27 $wp_about_author_author_pic = ""; 26 28 $wp_about_author_author = array(); 27 29 $wp_about_author_author['name'] = get_the_author(); 28 30 $wp_about_author_author['description'] = get_the_author_meta('description'); 29 $wp_about_author_author['twitter'] = get_the_author_meta('twitter');30 $wp_about_author_author['facebook'] = get_the_author_meta('facebook');31 31 $wp_about_author_author['website'] = get_the_author_meta('url'); 32 32 $wp_about_author_author['posts'] = (int)get_the_author_posts(); 33 33 $wp_about_author_author['posts_url'] = get_author_posts_url(get_the_author_meta('ID')); 34 35 $wp_about_author_author_pic = get_avatar(get_the_author_email(), '100'); 34 $wp_about_author_author_pic = get_avatar(get_the_author_meta('email'), '100'); 35 36 // About Author Title 37 $wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url']. "' title='". $wp_about_author_author['name'] ."'>". apply_filters( 'wp_about_author_name', $wp_about_author_author['name'] ) ."</a></h3>"; 36 38 37 $wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url']. "' title='". $wp_about_author_author['name'] ."'>". $wp_about_author_author['name'] ."</a></h3>"; 38 39 $wp_about_author_content .= "<p>" .$wp_about_author_author['description'] . "</p>"; 40 $wp_about_author_link = ''; 41 if(!empty($wp_about_author_author['website'])||!empty($wp_about_author_author['twitter'])||!empty($wp_about_author_author['facebook'])){ 42 $wp_about_author_content .= "<p>"; 43 if(!empty($wp_about_author_author['website'])){ 44 $wp_about_author_link .= "<a href='" . $wp_about_author_author['website']. "' title='". $wp_about_author_author['name'] ."'>Website</a> "; 45 } 46 if(!empty($wp_about_author_author['twitter'])){ 47 if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; } 48 $wp_about_author_link .= "<a href='" . $wp_about_author_author['twitter']. "' title='". $wp_about_author_author['name'] ."on Twitter'>Twitter</a> "; 49 } 50 if(!empty($wp_about_author_author['facebook'])){ 51 if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; } 52 $wp_about_author_link .= "<a href='" . $wp_about_author_author['facebook']. "' title='". $wp_about_author_author['name'] ." on Facebook'>Facebook</a> "; 53 } 54 if(!empty($wp_about_author_author['posts_url'])){ 55 if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; } 56 $wp_about_author_link .= "<a href='" . $wp_about_author_author['posts_url']. "' title='More posts by ". $wp_about_author_author['name'] ."'>More Posts</a> "; 57 } 58 $wp_about_author_content .= $wp_about_author_link; 59 $wp_about_author_content .= "</p>"; 60 } 39 // About Author Description 40 $wp_about_author_content .= "<p>" .apply_filters( 'wp_about_author_description', $wp_about_author_author['description']) . "</p>"; 41 42 // About Author Links 43 if(!empty($wp_about_author_author['posts_url'])){ 44 $wp_about_author_links .= "<a href='" . $wp_about_author_author['posts_url']. "' title='More posts by ". $wp_about_author_author['name'] ."'>".apply_filters( 'wp_about_author_more_posts', "More Posts")."</a> "; 45 } 46 if(!empty($wp_about_author_author['website'])){ 47 if($wp_about_author_links!=""){$wp_about_author_links.=apply_filters( 'wp_about_author_separator', " - ");} 48 $wp_about_author_links .= "<a href='" . $wp_about_author_author['website']. "' title='". $wp_about_author_author['name'] ."'>".apply_filters( 'wp_about_author_website', "Website")."</a> "; 49 } 50 51 // About Author Social 52 $wp_about_author_social .= wp_about_author_get_social_links($wp_about_author_settings); 53 if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){ 54 $wp_about_author_content .= "<p>" .$wp_about_author_links . "</p>"; 55 if($wp_about_author_social != ""){ 56 $wp_about_author_content .= '<p class="wpa-nomargin">'.apply_filters( 'wp_about_author_follow_me', "Follow Me:").'<br />' . $wp_about_author_social.'</p>'; 57 } 58 } else { 59 $wp_about_author_content .= "<p class='wpa-nomargin'>"; 60 $wp_about_author_content .= $wp_about_author_links; 61 if($wp_about_author_social != ""){ 62 $wp_about_author_content .= apply_filters( 'wp_about_author_separator', " - ") . $wp_about_author_social; 63 } 64 $wp_about_author_content .= "</p>"; 65 } 66 67 // Create output 68 $return_content = ''; 69 // Allow filters to create new templates for output 61 70 if (!$for_feed){ 62 return '<div class="wp-about-author-containter-'.$wp_about_author_settings['wp_author_alert_border'].'" style="background-color:'.$wp_about_author_settings['wp_author_alert_bg'].';"><div class="wp-about-author-pic">'.$wp_about_author_author_pic.'</div><div class="wp-about-author-text">'.$wp_about_author_content.'</div></div>';71 $return_content = apply_filters( 'wp_about_author_template','<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>'); 63 72 } else { 64 return '<p><div style="float:left; text-align:left;>'.$wp_about_author_author_pic.'</div>'.$wp_about_author_content.'</p>'; 65 } 73 $return_content = apply_filters( 'wp_about_author_feed_template','<p><div style="float:left; text-align:left;>%%authorpic%%</div>%%content%%</p>'); 74 } 75 $replace_array = array( 76 '%%bordertype%%'=>$wp_about_author_settings['wp_author_alert_border'], 77 '%%borderbg%%'=>$wp_about_author_settings['wp_author_alert_bg'], 78 '%%authorpic%%'=>$wp_about_author_author_pic, 79 '%%content%%'=>$wp_about_author_content 80 ); 81 foreach($replace_array as $search=>$replace){ 82 $return_content = str_replace($search, $replace, $return_content); 83 } 84 85 return apply_filters( 'wp_about_author_display', $return_content ); 66 86 } 67 87 … … 69 89 // Add buttons to page 70 90 function insert_wp_about_author($content) { 71 $wp_about_author_settings=array(); 72 $wp_about_author_settings=get_option('wp_about_author_settings'); 73 74 if(is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']){ 75 $content=$content.wp_about_author_display(); 91 $wp_about_author_settings=wp_about_author_get_options(); 92 93 if(is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']){ 94 $content.=wp_about_author_display(); 76 95 } else if(is_archive() && isset($wp_about_author_settings['wp_author_display_archives']) && $wp_about_author_settings['wp_author_display_archives']){ 77 $content =$content.wp_about_author_display();96 $content.=wp_about_author_display(); 78 97 } else if(is_search() && isset($wp_about_author_settings['wp_author_display_search']) && $wp_about_author_settings['wp_author_display_search']){ 79 $content =$content.wp_about_author_display();98 $content.=wp_about_author_display(); 80 99 } else if(is_page() && isset($wp_about_author_settings['wp_author_display_pages']) && $wp_about_author_settings['wp_author_display_pages']){ 81 $content =$content.wp_about_author_display();100 $content.=wp_about_author_display(); 82 101 } else if(is_single() && isset($wp_about_author_settings['wp_author_display_posts']) && $wp_about_author_settings['wp_author_display_posts']){ 83 $content =$content.wp_about_author_display();102 $content.=wp_about_author_display(); 84 103 } else if(is_feed() && isset($wp_about_author_settings['wp_author_display_feed']) && $wp_about_author_settings['wp_author_display_feed']){ 85 $content =$content.wp_about_author_display(true);104 $content.=wp_about_author_display(true); 86 105 } else { 87 106 $content=$content; … … 90 109 } 91 110 111 // Generate social icons 112 function wp_about_author_get_social_links($wp_about_author_settings){ 113 $content=""; 114 $socials = wp_about_author_get_socials(); 115 foreach($socials as $social_key=>$social){ 116 if (get_the_author_meta($social_key)){ 117 if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){ 118 $content .= "<a class='wpa-social-icons' href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'><img src='". $social['icon']."' alt='".$social['title']."'/></a>"; 119 } else { 120 if($content != "") 121 $content .= apply_filters( 'wp_about_author_separator', " - "); 122 $content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>"; 123 } 124 } 125 } 126 return $content; 127 } 128 129 function wp_about_author_get_socials() { 130 $socials = array(); 131 $socials['twitter'] = array('title'=>'Twitter', 'link'=>'http://www.twitter.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/twitter.png'); 132 $socials['facebook'] = array('title'=>'Facebook', 'link'=>'http://www.facebook.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/facebook.png'); 133 $socials['linkedin'] = array('title'=>'LinkedIn', 'link'=>'http://www.linkedin.com/in/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/linkedin.png'); 134 $socials['pinterest'] = array('title'=>'Pinterest', 'link'=>'http://www.pinterest.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/pinterest.png'); 135 $socials['googleplus'] = array('title'=>'Google Plus', 'link'=>'https://plus.google.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/googleplus.png'); 136 $socials['digg'] = array('title'=>'Digg', 'link'=>'http://www.digg.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/digg.png'); 137 $socials['flickr'] = array('title'=>'Flickr', 'link'=>'http://www.flickr.com/people/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/flickr.png'); 138 $socials['stumbleupon'] = array('title'=>'StumbleUpon', 'link'=>'http://www.stumbleupon.com/stumbler/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/stumbleupon.png'); 139 $socials['youtube'] = array('title'=>'YouTube', 'link'=>'http://www.youtube.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/youtube.png'); 140 $socials['yelp'] = array('title'=>'Yelp', 'link'=>'http://www.yelp.com/user_details?userid=%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/yelp.png'); 141 $socials['reddit'] = array('title'=>'Reddit', 'link'=>'http://www.reddit.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/reddit.png'); 142 $socials['delicious'] = array('title'=>'Delicious', 'link'=>'http://www.delicious.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/delicious.png'); 143 return apply_filters( 'wp_about_author_get_socials', $socials ); 144 } 145 92 146 // Add css to header 93 147 function wp_about_author_style() { 94 wp_enqueue_style('wp- sauthor-bio', WPAUTHORURL_URL . 'wp-about-author.css');148 wp_enqueue_style('wp-author-bio', WPAUTHORURL_URL . 'wp-about-author.css'); 95 149 } 96 150 97 151 function wp_about_author_filter_contact($contactmethods) { 98 99 152 unset($contactmethods['yim']); 100 153 unset($contactmethods['aim']); 101 154 unset($contactmethods['jabber']); 102 103 $contactmethods['twitter'] = 'Twitter'; 104 $contactmethods['facebook'] = 'Facebook'; 155 $socials = wp_about_author_get_socials(); 156 foreach($socials as $social_key=>$social){ 157 $contactmethods[$social_key] = $social['title']; 158 } 105 159 $contactmethods['yim'] = 'Yahoo IM'; 106 160 $contactmethods['aim'] = 'AIM'; … … 108 162 109 163 return $contactmethods; 110 111 164 } 112 165 … … 118 171 $tmp = array( 119 172 "wp_author_installed"=>"on", 120 "wp_author_version"=>"1 3",173 "wp_author_version"=>"14", 121 174 "wp_author_alert_bg"=>"#FFEAA8", 122 175 "wp_author_display_front"=>"on", … … 126 179 "wp_author_display_pages"=>"on", 127 180 "wp_author_display_feed"=>"", 128 "wp_author_alert_border"=>"top" 181 "wp_author_alert_border"=>"top", 182 "wp_author_social_images"=>"on" 129 183 ); 130 184 update_option('wp_about_author_settings', $tmp); 131 185 } 186 if (!$tmp['wp_author_social_images']){ 187 $tmp['wp_author_display_feed'] = ""; 188 update_option('wp_about_author_settings', $tmp); 189 } 132 190 if (!$tmp['wp_author_display_feed']){ 133 191 $tmp['wp_author_display_feed'] = "";
Note: See TracChangeset
for help on using the changeset viewer.