Support

Account

Home Forums Front-end Issues Displaying links or images & images as thumbnails + Reply To: Displaying links or images & images as thumbnails +

  • Hi Elliot – Thanks for the Debugging info – very useful and I now have a page that is at least rendering in a browser window.

    Still working on this if statement issue – at the moment on the page, all thumbnails open up to the full size image. However, I’m trying to have a situation where, if I’ve entered a url in repeater/subfield 2 then I want it to go to that url rather than load the image. For me, the fact that this doesn’t work implies that the if($links) part of the code (see below) is always taking the else option, so I need to solve what’s wrong with the first part/option, or if it’s not that, the overall structure of the if statement may be at fault. As I said before, this is beyond my current coding knowledge and would appreciate if you could have a look & see if you can see what’s wrong.

    For instance – do I have to include a foreach($links as $link) in this section, similar to the foreach($rows as $row) in the previous bit of code? This might not be the case, but this is where my coding knowledge falls short and any help would be most appreciated.

    To view the page I’m working on in a browser please click here

    Many thanks in advance for your help

    Phil

    
    <?php 
    // using normal array
    $rows = get_field('press_badge');
    
    if($rows)
    {
    	echo '<ul id="pressBadgesList" class="pressBadgesList">';
    	foreach($rows as $row)
    	{
    		echo '<li>' . '<div class=\'radio_badge_title\'><p>' . $row['press_title_printed'] . '</p></div>';
    
    		$links = get_sub_field('press_url');
    		if($links) {
    				echo '<' . 'a ' . 'target=' . '\'_blank\'' . 'href=' . $row['press_url'] . '>' ;
    				}
    				else
    				{echo '<' . 'a ' .  'rel=\'lightbox[reviews]\'' . 'href=' . $row['press_image_printed']  . '>'; }
    
    			
    		echo '<' . 'img src=' . $row['press_image_printed'] . ' width=\'150\'' . 'height=\'150\'' . '>' .'</a>'.'</li>';
    	}
    	echo '</ul>';
    }
    ?>