WP Tiles
[resolved] Need to grab image url from custom field (5 posts)

  1. djezer
    Posted 2 years ago #

    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?



  2. djezer
    Posted 2 years ago #

    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?

  3. djezer
    Posted 2 years ago #

    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.


  4. Mike Martel
    Plugin Author

    Posted 2 years ago #

    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!

  5. djezer
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Tiles
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic