WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Content Gallery
Get thumbnail ID from postmeta table (1 post)

  1. TeamHBH
    Member
    Posted 1 year ago #

    Hi,

    I noticed that if you use image in your post that has been used in another page or post, WordPress will not create a separate record (with post_type = 'attachment') in the posts table again for the particular image. If you set the existing image in such case as featured image (manually or with some auto-featured-image plugin), WordPress will create record in the postmeta table with meta_key '_thumbnail_id' but still no separate attachment record in the posts table.

    The Dynamic Content Gallery plugin however looks for attached images solely in the posts table and not in postmeta table.

    I fixed this by adding the following lines in the function dfcg_grab_post_image in includes/dfcg-gallery-core.php, after
    "$id = dfcg_get_image_id($parent_id, $args['num']);" on line 463:

    if (!$id) {
    $id = get_post_meta($parent_id, "_thumbnail_id", true);
    }

    Hope this will help everyone who also hits this problem.

    http://wordpress.org/extend/plugins/dynamic-content-gallery-plugin/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic