WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Featured Image
[resolved] Getting image descriptions (3 posts)

  1. Chris
    Member
    Posted 7 months ago #

    Hi,

    thanks for the great plugin!

    Is there is way to get the descriptions of the featured images?

    Thanks!

    http://wordpress.org/plugins/dynamic-featured-image/

  2. Ankit Pokhrel
    Member
    Plugin Author

    Posted 7 months ago #

    Hello Chris,

    Thank you for using the plugin. I haven't provided any function to fetch the description of an image but you can do it using similar function.

    /*
    * Get image description
    * This code is not tested
    * @return String
    */
     function dfi_get_image_description( $image_url ) {
        global $wpdb;
        $prefix = $wpdb->prefix;
        $post_description = $wpdb->get_col( $wpdb->prepare( "SELECT post_content FROM " . $prefix . "posts" . " WHERE guid = %s", $image_url ) );
    
        return empty($post_description ) ? null : $post_description[0];
     }

    Thanks,
    Ankit

  3. Chris
    Member
    Posted 6 months ago #

    Thank you very much, that helps!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.