• Resolved jfl1977

    (@jfl1977)


    I love this plug in as it does exactly as advertised.

    I added a custom image field to the custom post pages that are being pulled into the masonry layout. I added the code to call the custom field with no problem.

    The issue I’m having is the field should return the URL of the image. However, it is returning the attachment ID and creating a url that includes the page the gallery is on, not the actual post. Basically it spits out a url of “https://www.examplesite.com/gallery-page/166. (Where 166 is the attachment id). It should spit out a url of “https://www.examplesite.com/wp-content/uploads/2015/05/myimage.jpg”.

    Under “global $post;” near line 330 of masonry-post-gallery.php I am calling the variable with:

    $logoimage = get_post_meta($post->ID,”logo2″,true);

    And then inside the databox I’m using the following:

    if(self::$a[‘display_post_titles’] && strlen($tit) > 0) $data_text .= “<img src='{$logoimage}’ />”;

    Please help me track down where the URL is switching from the image URL to the Attachment ID.

    https://www.ads-software.com/plugins/masonry-post-gallery/

Viewing 1 replies (of 1 total)
  • Thread Starter jfl1977

    (@jfl1977)

    After a bit of trial and error I managed to SOLVE THIS!!!! ??

    It was solved using a combination of custom field calls from the Advanced Custom Fields plugin and modifying the way I called the variable in $data_text

    Based on my sample code above, under “global $post;” near line 330 of masonry-post-gallery.php, I call the variable with:

    $logoimage = get_field(‘logo2’);

    And then inside the databox, I modified the first line of $data_text as follows:

    $data_text = “<div class=’cactus_masonry_databox’><img src='{$logoimage[‘url’]}’ />”;

    I calls perfectly now.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin is striping custom field URL’ is closed to new replies.