Changeset 3267631
- Timestamp:
- 04/07/2025 05:16:31 AM (12 months ago)
- Location:
- image-video-xml-sitemap/trunk
- Files:
-
- 3 edited
-
image-video-xml-sitemap.php (modified) (2 diffs)
-
includes/class-image-video-xml-sitemap.php (modified) (3 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-video-xml-sitemap/trunk/image-video-xml-sitemap.php
r3224078 r3267631 3 3 Plugin Name: Image & Video XML Sitemap 4 4 Description: Enhance your website's media SEO by creating separate sitemaps for images and videos. Fully compatible with Yoast SEO, with advanced customization options. 5 Version: 1.0. 05 Version: 1.0.1 6 6 Requires at least: 5.2 7 7 Requires PHP: 7.4 … … 27 27 28 28 //Activation hook 29 register_activation_hook(__FILE__, 'ivxy_plugin_activation');30 function ivxy_plugin_activation() { 29 register_activation_hook(__FILE__, function() { 30 (new ivxs_ImageVideoSitemap())->ivxs_add_sitemap_rewrites(); 31 31 flush_rewrite_rules(); 32 } 32 }); 33 33 34 34 //Deactivation hook 35 register_deactivation_hook(__FILE__, 'ivxs_plugin_deactivation'); 36 function ivxs_plugin_deactivation() { 35 register_deactivation_hook(__FILE__, function() { 37 36 flush_rewrite_rules(); 38 } 37 }); 39 38 40 39 // Hook into WordPress admin initialization to check for SEO plugin. -
image-video-xml-sitemap/trunk/includes/class-image-video-xml-sitemap.php
r3224078 r3267631 94 94 <?php submit_button(); ?> 95 95 </form> 96 <p><em><strong>Note</strong>: Please visit Settings → Permalinks in your WordPress dashboard and simply click 'Save Changes' if the image or video XML sitemap URL is not working.</em></p> 96 97 </div> 97 98 <div class="ivxs-col-4"> … … 115 116 116 117 public function ivxs_save_settings() { 117 if (! current_user_can('manage_options') || !check_admin_referer('ivxs_save_settings', 'ivxs_nonce')) {118 if (!is_admin() || !current_user_can('manage_options') || !check_admin_referer('ivxs_save_settings', 'ivxs_nonce')) { 118 119 wp_die(esc_html(__('You are not allowed to perform this action.', 'image-video-xml-sitemap'))); 119 120 } … … 233 234 } 234 235 235 public function ivxs_add_sitemap_rewrites(){ 236 $image_sitemap_filename = get_option( 'ivxs_image_sitemap_filename', '' ); 237 $video_sitemap_filename = get_option( 'ivxs_video_sitemap_filename', '' ); 238 239 add_rewrite_rule( '^'.$image_sitemap_filename.'.xml$', 'index.php?custom_sitemap=image', 'top' ); 240 add_rewrite_rule( '^'.$video_sitemap_filename.'.xml$', 'index.php?custom_sitemap=video', 'top' ); 241 242 flush_rewrite_rules(); 243 } 244 245 public function ivxs_add_query_vars(){ 236 public function ivxs_add_sitemap_rewrites() { 237 $image_sitemap_filename = get_option('ivxs_image_sitemap_filename', 'image'); 238 $video_sitemap_filename = get_option('ivxs_video_sitemap_filename', 'video'); 239 240 if (!empty($image_sitemap_filename)) { 241 add_rewrite_rule('^' . preg_quote($image_sitemap_filename) . '\.xml$', 'index.php?custom_sitemap=image', 'top'); 242 } 243 244 if (!empty($video_sitemap_filename)) { 245 add_rewrite_rule('^' . preg_quote($video_sitemap_filename) . '\.xml$', 'index.php?custom_sitemap=video', 'top'); 246 } 247 } 248 249 public function ivxs_add_query_vars($vars) { 246 250 $vars[] = 'custom_sitemap'; 247 251 return $vars; 248 252 } 249 253 250 254 public function ivxs_generate_custom_sitemap() { 251 255 $custom_sitemap = get_query_var( 'custom_sitemap' ); -
image-video-xml-sitemap/trunk/readme.txt
r3224081 r3267631 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 33 33 ### Advanced Feature: 34 34 Even with Yoast SEO's media sitemap options enabled, this plugin generates independent sitemaps for better control and optimization of your media assets. 35 36 ### Extra Notes: 37 Please visit **Settings → Permalinks** in your WordPress dashboard and simply click "Save Changes". This will flush and refresh the rewrite rules so that the custom sitemap URLs start working properly. 35 38 36 39 == Installation == … … 76 79 == Changelog == 77 80 78 = 1.0 = 81 = 1.0.1 = 82 - URLs will correctly trigger your sitemap generator instead of redirecting to the homepage. 83 - Performance is improved by avoiding unnecessary flush operations. 84 - Query variables are correctly registered. 85 86 = 1.0.0 = 79 87 - Initial release. 80 88 - Added support for separate sitemaps for images and videos. … … 84 92 == Upgrade Notice == 85 93 86 = 1.0 = 94 = 1.0.1 = 95 Performance is improved by avoiding unnecessary flush operations. 96 97 = 1.0.0 = 87 98 Initial release. Ensure you have Yoast SEO installed and activated to use this plugin. 88 99
Note: See TracChangeset
for help on using the changeset viewer.