Plugin Directory

Changeset 3336544


Ignore:
Timestamp:
07/30/2025 10:41:09 AM (7 months ago)
Author:
developer1998
Message:

Improve, fixed and clean the plugin code

Location:
image-video-xml-sitemap
Files:
32 added
3 edited

Legend:

Unmodified
Added
Removed
  • image-video-xml-sitemap/trunk/image-video-xml-sitemap.php

    r3310512 r3336544  
    33Plugin Name: Image & Video XML Sitemap
    44Description: 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.2
     5Version: 1.0.3
    66Requires at least: 5.2
    77Requires PHP: 7.4
  • image-video-xml-sitemap/trunk/includes/class-image-video-xml-sitemap.php

    r3310818 r3336544  
    310310                echo '<loc>' . esc_url( $url ) . '</loc>';
    311311                if ( $lastmod ) {
    312                     echo '<lastmod>'. esc_html( $lastmod ) . '</lastmod>';
     312                    echo '<lastmod>' . esc_html( $lastmod ) . '</lastmod>';
    313313                }
    314314                if ( $media_type === 'image' ) {
     
    316316                } elseif ( $media_type === 'video' ) {
    317317                    $thumbnail = esc_url( wp_get_attachment_url( get_post_thumbnail_id() ) );
    318                     $title = get_the_title();
    319                     $description = get_the_excerpt();
     318                    $attachment_id = get_the_ID();
     319
     320                    // Title fallback
     321                    $title = get_the_title( $attachment_id );
     322                    if ( empty( $title ) ) {
     323                        $title = get_bloginfo( 'name' );
     324                    }
     325
     326                    // Description fallback chain
     327                    $description = wp_get_attachment_caption( $attachment_id );
     328                    if ( empty( $description ) ) {
     329                        $description = get_post_field( 'post_content', $attachment_id );
     330                    }
     331                    if ( empty( $description ) ) {
     332                        $description = get_bloginfo( 'description' );
     333                    }
     334                    if ( empty( $description ) ) {
     335                        $description = get_bloginfo( 'name' );
     336                    }
    320337
    321338                    echo '<video:video>';
    322339                    echo '<video:thumbnail_loc>' . esc_url( $thumbnail ) . '</video:thumbnail_loc>';
    323340                    echo '<video:title>' . esc_html( $title ) . '</video:title>';
    324                     echo '<video:description>' . esc_html( wp_strip_all_tags($description) ) . '</video:description>';
     341                    echo '<video:description>' . esc_html($description) . '</video:description>';
    325342                    echo '<video:content_loc>' . esc_url( $url ) . '</video:content_loc>';
    326343                    echo '</video:video>';
  • image-video-xml-sitemap/trunk/readme.txt

    r3310794 r3336544  
    33Tags: sitemaps, xml-sitemap, image sitemap, video sitemap, seo
    44Requires at least: 5.2 
    5 Tested up to: 6.8.1
     5Tested up to: 6.
    66Requires PHP: 7.4 
    7 Stable tag: 1.0.2 
     7Stable tag: 1.0.3 
    88License: GPLv2 or later 
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7979== Changelog ==
    8080
     81= 1.0.3 =
     82- Improved: Added dynamic <lastmod> support in media sitemap based on attachment modification date.
     83- Fixed: Video sitemap warnings caused by missing <video:title> or <video:description> elements.
     84- Enhanced: Implemented fallback logic for video title and description using attachment data, site tagline, and site title.
     85- Cleanup: General code improvements and better XML escaping for sitemap output.
     86
    8187= 1.0.2 =
    8288- Enhanced our plugin to support a wider range of file types for image and video sitemaps.
Note: See TracChangeset for help on using the changeset viewer.