Changeset 910600
- Timestamp:
- 05/08/2014 04:35:01 PM (12 years ago)
- Location:
- wp-auto-featured-image/trunk
- Files:
-
- 4 edited
-
css/wafi-style.css (modified) (1 diff)
-
js/wafi-script.js (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
wp-auto-featured-image.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-auto-featured-image/trunk/css/wafi-style.css
r898584 r910600 85 85 padding-bottom: 15px; 86 86 } 87 .note { 88 color: #706C6C; 89 float: left; 90 font-size: 12px; 91 width: 100%; 92 } 93 div.updated { 94 float: left; 95 width: 98%; 96 } 97 form.paypal select, form.paypal input{ 98 float: left; 99 } 100 form.paypal { 101 float: left; 102 margin-bottom: 10px; 103 width: 100%; 104 } -
wp-auto-featured-image/trunk/js/wafi-script.js
r900041 r910600 45 45 jQuery('.button-primary').click(); 46 46 } 47 48 49 jQuery('.cat_include').click(function(){ 50 jQuery('.cat_include').prop('checked',false); 51 jQuery('.cat_include').prop('checked',true); 52 }); 47 53 }); 48 54 -
wp-auto-featured-image/trunk/readme.txt
r900041 r910600 1 1 === Wordpress Auto Featured Image === 2 2 Contributors: sanny_rss 3 Tags: Featured Image, Auto Featured Image, Default Featured Image, Auto, Default, Post Thumbnail, Auto Post Thumbnail, Set Post Thumbnail 3 Tags: Featured Image, Auto Featured Image, Default Featured Image, Auto, Default, Post Thumbnail, Auto Post Thumbnail, Set Post Thumbnail, Auto Post Thumbnail, WordPress Post Thumbnail 4 4 Donate link: http://royalsoftwareservices.com/donate/ 5 5 Requires at least: 3.0 6 6 Tested up to: 3.9 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 12 12 13 13 == Description == 14 Bored to set default images each time for a page, post or custom type or want a image to auto attachas thumbnail if a user ignores setting up a thumbnail? Here is the solution:14 Bored to set default images each time for a page, post or custom type or want an image to auto set as thumbnail if a user ignores setting up a thumbnail? Here is the solution: 15 15 16 16 This plugin provides you an easy way to set a default thumbnail image for your posts, pages or custom post types. You can select an image from your local machine or media library. 17 17 18 You can access this from the WordPress dashboard => "WAFI" (admin menu)18 You can access this from the WordPress dashboard under Settings => "WAFI" (admin menu) 19 19 20 20 Option to choose: 21 21 22 22 * Select an image to set. 23 * Select for specific categories. 23 24 * Choose post types for which it will trigger. 24 25 … … 51 52 == Changelog == 52 53 54 = 1.1 = 55 * Restrict to specific categoriers. 56 * Allow Categories for all post types or for POST only. 57 * Menu moved under 'Settings'. 58 53 59 = 1.0 = 54 60 * First release. … … 57 63 == Upgrade Notice == 58 64 65 = 1.1 = 66 * Restrict to specific categoriers. 67 * Allow Categories for all post types or for POST only. 68 * Menu moved under 'Settings'. 69 59 70 = 1.0 = 60 71 First Version. -
wp-auto-featured-image/trunk/wp-auto-featured-image.php
r900157 r910600 37 37 define( 'WP_Auto_FI_DIR', WP_PLUGIN_DIR . '/wp-auto-featured-image' ); 38 38 define( 'WP_Auto_FI_URL', WP_PLUGIN_URL . '/wp-auto-featured-image' ); 39 define( 'WP_Auto_ADMIN_URL', get_admin_url(null, 'admin.php?page=wp_auto_featured_image') ); 39 40 40 41 … … 42 43 add_action('admin_menu', 'wpafi_admin_add_page'); 43 44 function wpafi_admin_add_page() { 44 add_menu_page('Wordpress Auto Featured Image', 'WP AFI', 'manage_options', 'wp_auto_featured_image', 'wpafi_start'); 45 } 45 add_options_page('Wordpress Auto Featured Image', 'WP AFI', 'manage_options', 'wp_auto_featured_image', 'wpafi_start'); 46 } 47 48 # Setting option in PLUGIN page 49 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links' ); 50 function my_plugin_action_links( $links ) { 51 $links[] = '<a href="'. WP_Auto_ADMIN_URL.'">Settings</a>'; 52 $links[] = '<a href="http://www.royalsoftwareservices.com/plugins/" target="_blank">Documentation</a>'; 53 return $links; 54 } 55 56 46 57 47 58 # Menu Callback and backend design 48 59 function wpafi_start() { ?> 49 60 <div class="wrap wp_afi"> 61 <?php if( isset($_GET['settings-updated']) ) { ?> 62 <div id="message" class="updated"> 63 <p><strong><?php _e('Settings saved.') ?></strong></p> 64 </div> 65 <?php } ?> 50 66 <h2>Wordpress Auto Featured Image</h2> 51 67 <div class="content_area"> … … 69 85 <div class="inside"> 70 86 <p class="multi-option">Have you encountered any problem with our plugin and need our help? Do you need to ask us any question?</p> 71 <p>You can post your question or issues at WordPress <a target="_blank" href="http://wordpress.org/support/plugin/wp-auto-featured-image">Support</a> or can directly mail me at <a href="mailto:[email protected]">[email protected]</a>.</p>87 <p>You can post your question or issues at WordPress <a target="_blank" href="http://wordpress.org/support/plugin/wp-auto-featured-image">Support</a> or can directly <a href="mailto:[email protected]?subject=Support Request For Wordpress Auto Featured Image From <?php bloginfo('url');?>">mail me</a>.</p> 72 88 </div> 73 89 </div> … … 79 95 <div class="inside"> 80 96 <p class="multi-option"> 81 We need your support to make this and other plugins more smarter and helpful for you, if this plugin saved few minutes of your effort, kindly get some time for a favor to us and</p> 82 <p>1) <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-auto-featured-image">Rate this plugin.</a><br/> 83 2) Make a small <a href="http://www.royalsoftwareservices.com/donate/" target="_blank"> donation</a> for us. </p> 97 We need your support to make this and other plugins more smarter and helpful for you, if this plugin saved any minutes of your timeffort, kindly get some time for a favor to us and</p> 98 <p> 99 1) <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-auto-featured-image">Rate this plugin.</a><br/> 100 2) Make a small <a href="http://www.royalsoftwareservices.com/donate/" target="_blank"> donation</a> for us. 101 </p> 102 <form target="_blank" class="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" name="_xclick"> 103 <input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="[email protected]" /> 104 <input type="hidden" name="item_name" value="Donate for plugin support" /><input type="hidden" name="currency_code" value="USD" /> 105 <select name="amount"> 106 <option value="05.00">05</option> 107 <option value="10.00">10</option> 108 <option value="15.00">15</option> 109 <option value="20.00">20</option> 110 <option value="25.00">25</option> 111 <option value="50.00">50</option> 112 </select> 113 <input type="image" alt="Make payments with PayPal - it's fast, free and secure!" name="submit" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" /> 114 </form> 84 115 <p>Any help would be very appreciated. Thanks for using this plugin.<br/> 85 116 Have a good day!!</p> 117 </div> 118 </div> 119 </div> 120 <div class="metabox-holder"> 121 <div class="postbox-container postbox" style="width: 99%;"> 122 <h3 class="hndle"><span>Hire Me</span></h3> 123 <div class="inside"> 124 <p class="multi-option">Do you want more customization on this plugin? or want to develope a new plugin?</p> 125 <p><strong><a href="mailto:[email protected]?subject=Hire Request From <?php bloginfo('url');?>">Hire me</a> at just $15/hour.</strong></p> 86 126 </div> 87 127 </div> … … 98 138 add_settings_section('wpafi_main', 'General Settings', 'wpafi_desp', 'wp_auto_featured_image'); 99 139 add_settings_field('wpafi_post_type', 'Include Post Types:', 'wpafi_post_types', 'wp_auto_featured_image', 'wpafi_main'); 140 add_settings_field('wpafi_categories', 'Only for these categories:', 'wpafi_categories', 'wp_auto_featured_image', 'wpafi_main'); 141 add_settings_field('wpafi_categories_all', 'Apply categories filter for all post types:', 'wpafi_categories_all', 'wp_auto_featured_image', 'wpafi_main'); 100 142 add_settings_field('wpafi_default_thumb', 'Set Default Thumbnail:', 'wpafi_default_thumb', 'wp_auto_featured_image', 'wpafi_main'); 101 143 add_settings_field('wpafi_default_thumb_id', '', 'wpafi_default_thumb_id', 'wp_auto_featured_image', 'wpafi_main'); … … 127 169 } 128 170 171 function wpafi_categories_all() { 172 $options = get_option('wpafi_options'); 173 // print_r($options); 174 175 if($options['wpafi_categories_all'] == 'yes'){ 176 $yes = 'checked="checked'; 177 $no = ''; 178 } else { 179 $no = 'checked="checked'; 180 $yes = ''; 181 } 182 echo ' 183 <input type="radio" '.$yes.' class="cat_include" name="wpafi_options[wpafi_categories_all]" id="wpafi_text_string-yes" value="yes" /> 184 <label class="post-type" for="wpafi_text_string-yes">Yes</label> 185 <input type="radio" '.$no.' class="cat_include" name="wpafi_options[wpafi_categories_all]" id="wpafi_text_string-no" value="no" /> 186 <label class="post-type" for="wpafi_text_string-no">No</label>'; 187 echo '<span class="note clear">If you set `yes`, only posts (for all selected post types) will be modified that comes under selected categories, if `no` is selected category restriction will only work for WordPress default posts. This setting will not effect for pages.</span>'; 188 } 189 190 191 function wpafi_categories() { 192 $options = get_option('wpafi_options'); 193 $wpafi_cats = get_categories( array('type'=> 'post','hide_empty'=> 0,'orderby' => 'name', 'order'=> 'ASC' )); 194 195 foreach ( $wpafi_cats as $wpafi_cat ) { 196 $selected = ''; 197 if($options['wpafi_categories']) { 198 if((is_array($options['wpafi_categories'])) && (in_array($wpafi_cat->slug,$options['wpafi_categories']))) { $selected = " checked='checked'"; } 199 } 200 echo ' 201 <input type="checkbox"'.$selected.' name="wpafi_options[wpafi_categories][]" id="wpafi_text_string-'.$wpafi_cat->slug.'" value="'.$wpafi_cat->slug.'" /> 202 <label class="post-type" for="wpafi_text_string-'.$wpafi_cat->slug.'">'.$wpafi_cat->name.'</label>'; 203 } 204 echo '<span class="note clear">Leave this unchecked if you want to work this plugin for all categories. This setting will not effect for pages.</span>'; 205 } 206 129 207 function wpafi_default_thumb() { 130 208 $options = get_option('wpafi_options'); 131 209 if(empty($options['wpafi_default_thumb'])) { 132 210 echo '<input type="text" id="default_thumb_url" name="wpafi_options[wpafi_default_thumb]" value="" /> 133 <input id="upload_default_thumb" class="button" type="button" value="Upload Image" />';211 <input id="upload_default_thumb" class="button" type="button" value="Upload Thumbnail" />'; 134 212 } else { 135 213 echo ' 136 <input id="upload_default_thumb" class="button" type="button" value="Update Image" />214 <input id="upload_default_thumb" class="button" type="button" value="Update Thumbnail" /> 137 215 <input type="hidden" id="default_thumb_url" name="wpafi_options[wpafi_default_thumb]" value="'.$options["wpafi_default_thumb"].'" /> 138 216 <input id="delete_thumb" name="delete_thumb" type="button" class="button" value="Delete Thumbnail" /> … … 181 259 add_action('save_post', 'wpfi_set_thumbnail' ); 182 260 function wpfi_set_thumbnail( $post_id ) { 183 global $wpdb; 184 extract($_POST); 185 $options = get_option('wpafi_options'); 186 187 188 if(!empty($options['wpafi_post_type'])){ 189 # Check if this suppose to be set thumbnail 190 if(empty($options['wpafi_post_type'])){ 191 return; 192 } 193 if((in_array($post_type, $options['wpafi_post_type']) == 0) || has_post_thumbnail( $post_id ) || empty($options['wpafi_default_thumb_id'])) { 194 return; 195 } 196 197 # Set thumbnail here 198 set_post_thumbnail( $post_id, $options['wpafi_default_thumb_id']); 199 } 261 262 global $wpdb; 263 extract($_POST); 264 $options = get_option('wpafi_options'); 265 266 # Check if this suppose to be set thumbnail. 267 if((!empty($options['wpafi_post_type'])) && (is_array($options['wpafi_post_type'])) && (in_array($post_type, $options['wpafi_post_type']) != 0) && (has_post_thumbnail( $post_id ) == false)) { 268 269 # If category filter is on. 270 if((is_array($options['wpafi_categories'])) && ($post_type != 'page')){ 271 272 #if restricted for default POST 273 if($options['wpafi_categories_all'] == 'no'){ 274 if(in_category($options['wpafi_categories'], $post_id) && ($post_type == 'post')){ 275 # Set thumbnail here 276 set_post_thumbnail( $post_id, $options['wpafi_default_thumb_id']); 277 } 278 } elseif($options['wpafi_categories_all'] == 'yes'){ 279 if(in_category($options['wpafi_categories'], $post_id)){ 280 # Set thumbnail here 281 set_post_thumbnail( $post_id, $options['wpafi_default_thumb_id']); 282 } 283 } 284 } else { 285 # Set thumbnail here 286 set_post_thumbnail( $post_id, $options['wpafi_default_thumb_id']); 287 } 288 } 200 289 } 201 290
Note: See TracChangeset
for help on using the changeset viewer.