Plugin Directory

Changeset 3284341


Ignore:
Timestamp:
04/29/2025 06:38:46 PM (8 months ago)
Author:
jeherve
Message:

1.5.2: fix issue where featured image was not displayed in some site configurations.

Location:
rest-api-post-embeds/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rest-api-post-embeds/trunk/readme.txt

    r3281569 r3284341  
    22Contributors: jeherve
    33Tags: shortcode, embed, posts, jetpack, api
    4 Stable tag: 1.5.1
     4Stable tag: 1.5.2
    55Requires at least: 5.6
    66Tested up to: 6.8
     
    141141== Changelog ==
    142142
     143= 1.5.2 =
     144Release Date: April 29, 2025
     145
     146* Featured Image: fix issue where featured image was not displayed in some site configurations.
     147
    143148= 1.5.1 =
    144149Release Date: April 25, 2025
  • rest-api-post-embeds/trunk/rest-api-post-embeds.php

    r3281569 r3284341  
    55 * Description: Embed posts from your site or others' into your posts and pages.
    66 * Author: Jeremy Herve
    7  * Version: 1.5.1
     7 * Version: 1.5.2
    88 * Author URI: https://jeremy.hu
    99 * License: GPL2+
     
    359359                $featured_image_url = $this->get_wpapi_featured_image( $post->featured_media, $atts );
    360360
    361                 if ( empty( $featured_image_url ) ) {
    362                     continue;
     361                if ( ! empty( $featured_image_url ) ) {
     362                    $article .= sprintf(
     363                        '<div class="post-embed-post-thumbnail"><a title="%1$s" href="%2$s"><img src="%3$s" alt="%1$s"/></a></div>',
     364                        esc_attr( $post_title ),
     365                        esc_url( $post->link ),
     366                        /** This filter is documented in rest-api-post-embeds.php */
     367                        apply_filters( 'jeherve_post_embed_featured_image', esc_url( $featured_image_url ), $atts )
     368                    );
    363369                }
    364 
    365                 $article .= sprintf(
    366                     '<div class="post-embed-post-thumbnail"><a title="%1$s" href="%2$s"><img src="%3$s" alt="%1$s"/></a></div>',
    367                     esc_attr( $post_title ),
    368                     esc_url( $post->link ),
    369                     /** This filter is documented in rest-api-post-embeds.php */
    370                     apply_filters( 'jeherve_post_embed_featured_image', esc_url( $featured_image_url ), $atts )
    371                 );
    372370            }
    373371
     
    574572    public function get_wpapi_featured_image( $featured_id, $atts ) {
    575573        if ( ! $atts || ! $featured_id ) {
    576             return;
     574            return '';
    577575        }
    578576
     
    587585        // If no post ID, let's stop right there.
    588586        if ( ! $blog_id ) {
    589             return;
     587            return '';
    590588        }
    591589
     
    600598            $featured_query_hash = substr( md5( $featured_query_url ), 0, 21 );
    601599        } else {
    602             return;
     600            return '';
    603601        }
    604602
     
    627625        if ( ! is_wp_error( $featured_response )  ) {
    628626            $featured_info = json_decode( $featured_response, true );
    629             $featured_url = $featured_info['guid']['rendered'];
    630         } else {
    631             return;
     627            $featured_url = $featured_info['source_url'];
     628        } else {
     629            return '';
    632630        }
    633631
Note: See TracChangeset for help on using the changeset viewer.