Plugin Directory

Changeset 3398177


Ignore:
Timestamp:
11/18/2025 03:36:52 PM (5 months ago)
Author:
wpsaad
Message:

fix image empty data

Location:
alt-manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • alt-manager/tags/1.7.9/inc/alm-empty-generator.php

    r3390753 r3398177  
    148148                    // options
    149149                    $options = [
    150                         'Site Name'        => get_bloginfo( 'name' ),
    151                         'Site Description' => get_bloginfo( 'description' ),
    152                         'Page Title'       => get_the_title( $ID ),
    153                         'Post Title'       => get_post_field( 'post_title', $ID ),
    154                         'Product Title'    => get_post_field( 'post_title', $ID ),
     150                        'Site Name'         => get_bloginfo( 'name' ),
     151                        'Site Description'  => get_bloginfo( 'description' ),
     152                        'Page Title'        => get_the_title( $ID ),
     153                        'Post Title'        => get_post_field( 'post_title', $ID ),
     154                        'Product Title'     => get_post_field( 'post_title', $ID ),
     155                        'Image Alt'         => '',
     156                        'Image Name'        => '',
     157                        'Image Caption'     => '',
     158                        'Image Description' => '',
    155159                    ];
    156160                    //wp image attachment data
    157                     if ( wp_attachment_is_image( $attachment_id ) ) {
     161                    if ( $attachment_id && wp_attachment_is_image( $attachment_id ) ) {
    158162                        $options['Image Alt'] = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
    159163                        $options['Image Name'] = get_the_title( $attachment_id );
    160164                        $options['Image Caption'] = wp_get_attachment_caption( $attachment_id );
    161                         $options['Image Description'] = get_the_content( $attachment_id );
     165                        $options['Image Description'] = get_post_field( 'post_content', $attachment_id );
    162166                    }
    163167                    /*Check If its logo*/
  • alt-manager/trunk/inc/alm-empty-generator.php

    r3390753 r3398177  
    148148                    // options
    149149                    $options = [
    150                         'Site Name'        => get_bloginfo( 'name' ),
    151                         'Site Description' => get_bloginfo( 'description' ),
    152                         'Page Title'       => get_the_title( $ID ),
    153                         'Post Title'       => get_post_field( 'post_title', $ID ),
    154                         'Product Title'    => get_post_field( 'post_title', $ID ),
     150                        'Site Name'         => get_bloginfo( 'name' ),
     151                        'Site Description'  => get_bloginfo( 'description' ),
     152                        'Page Title'        => get_the_title( $ID ),
     153                        'Post Title'        => get_post_field( 'post_title', $ID ),
     154                        'Product Title'     => get_post_field( 'post_title', $ID ),
     155                        'Image Alt'         => '',
     156                        'Image Name'        => '',
     157                        'Image Caption'     => '',
     158                        'Image Description' => '',
    155159                    ];
    156160                    //wp image attachment data
    157                     if ( wp_attachment_is_image( $attachment_id ) ) {
     161                    if ( $attachment_id && wp_attachment_is_image( $attachment_id ) ) {
    158162                        $options['Image Alt'] = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
    159163                        $options['Image Name'] = get_the_title( $attachment_id );
    160164                        $options['Image Caption'] = wp_get_attachment_caption( $attachment_id );
    161                         $options['Image Description'] = get_the_content( $attachment_id );
     165                        $options['Image Description'] = get_post_field( 'post_content', $attachment_id );
    162166                    }
    163167                    /*Check If its logo*/
Note: See TracChangeset for help on using the changeset viewer.