Support » Plugin: WP Tiles » Need to grab image url from custom field

  • Resolved djezer


    Hello, first off, great plugin! I’ve started playing with it yesterday and am in the process of integrating it to a site. The problem lies in the fact that it is using the Dynamic Content Gallery presently and when they add an image to a post, they copy the image url and post it in a custom field along with the DCG box. Perhaps this is why the WP Tiles plugin doesn’t see the image for each post. Is there a way to tell the plugin to fetch the url for the image in a custom field?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Here’s the link to there current plugin:

    And I just wanted to clarify the way images are handled in the current process. Users upload the image to the wordpress and copy the url and pasted in two separate boxes when creating a new post. The first post is a Custom Field type ‘Image’ and the second is the box for the DCG plugin.

    With this setup it seems like Tiles doesn’t know to get the image from the custom field. Is there a fix for this?

    I’m reading about custom fields here:

    And it looks like I’m going to fetch the image data using something like this:
    get_post_meta($post_id, ‘image’, true);

    I’m not sure how to integrate it in the Tiles plugin though. Any help would be appreciated.


    Plugin Author Mike Martel


    Hi there! There’s a filter in WP Tiles just for this: pre_wp_tiles_image. The second argument is the post. If you return the src for the image through this filter, everything should work.

    So add something like this to you functions.php:

    add_filter( 'pre_wp_tiles_image', 'grab_dcg_image_for_wp_tiles', 10, 2 );
    function grab_dcg_image_for_wp_tiles( $src, $post  ) {
        if ( $img = get_post_meta($post->ID, 'image', true) )
             $src = $img;
        return $src;

    Good luck!

    Thanks Mike! All I had to add was a concatenation of the images’ subfolder and it worked like a charm!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Need to grab image url from custom field’ is closed to new replies.