• Hi, I’m showing some pics in a table and I would add a “BUY” link only under the pics with excerpt.

    This is my code:

    if (count($rows_img) > 0 && !is_page())
    							{
    								foreach ($rows_img as $numKey01 => $row_img)
    								{
    									$strFullImg	=	$row_img->guid;
    									$numTmpPos	=	strpos($strFullImg, '.', strlen($strFullImg) - 5);
    									$strExt	=	strtolower(substr($strFullImg, $numTmpPos));
    									$strThumb	=	substr($strFullImg, 0, $numTmpPos).$strExt;
    									if ($strExt == '.jpg' || $strExt == '.jpeg' || $strExt == '.gif' || $strExt == '.png')
    		     {
    			$strResultGallery	.=	'<td>'.'<img height=600px alt="'.$row_img->post_title.'" src="'.$strThumb.'" />';
    
    if ($row_img->post_excerpt) {$buy = "<a href=\"\">BUY</a>";} */
    
    $strResultGallery	.=	'<h5>'.$row_img->post_excerpt. $buy.'</h5></td>';
    
    $strResultGallery	.= '</tr>';
    							$strResultGallery	.= '</table>';

    but the link appears under ALL images.

    Why?

    Many thanks

    [ Please do not bump, that’s not permitted here. ]

  • The topic ‘if post_excerpt EXISTS…’ is closed to new replies.