Skip Navigation

[Resolved] Types Child post image thickbox gallery

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by malcolmG 9 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#271796

I am trying to: Generate a rel-gallery from child post multiple image field.

$child_posts = types_child_posts('unit');
foreach ($child_posts as $child_post) {
(more code in between)
$floorimgs = get_post_meta(get_the_ID(), 'wpcf-multi-floor-plans', false);
	if (count($floorimgs) > 0) 
      {
	echo '<div class="tencol first"><a href="'. $floorimgs[0] .'" class="thickbox" rel="floor-gallery">';
	echo '<img width="100%" src="' . $floorimgs[0] . '" class="floor-thumb" />';
		foreach ((array)$floorimgs as $floorimg) {
		echo '<a href="'.$floorimg.'" rel="floor-gallery" style="display:none">';
		echo '<img src="'.$floorimg.'" /></a>';
	}
	echo '</a></div></div>';
	} else {
	echo '<div class="tencol first"><a href="'.$child_post->fields['floorplan'].'" class="thickbox"><img src="'.$child_post->fields['floorplan'].'" class="floor-thumb" width="100%" /></a></div></div>';
	}
#271835

I can see one problem in your PHP codes, there are two extra close tag:

</div>

If the problem still exists, I suggest you try debug your codes line by line manually.

#271876

Thanks but in the '(more code in between)' section the extra div code is covered off. That isn't the problem.

Currently, $floorimgs[0] returns nothing so I think there is a problem there...but I just don't know what it should be instead? Barring that, I think this should work.

Suggestions?

#271928

Since it is a custom PHP code problem, could you duplicate same problem in a test site, and fill below private detail box with login details and ftp access, also point out the problem page URL and where I can edit your PHP codes. I need a live website to debug this problem, thanks

#272129

Problem solved.

First get_the_ID() didn't work, I needed it to be contained within the $child_post->ID I set up...but then I got a gallery of all of the unit images regardless of post. This was because of the Thickbox rel gallery setting.

Turns out the rel needed to be unique to the child_post variable that I set so that it wouldn't grab all of the images. I simply used that $child_post->ID variable again and viola!

#272130

Resolved.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.