Jump to content

PHP IF NOT VARIABLE THEN DO


frankdm
Go to solution Solved by ginerjm,

Recommended Posts

Hello all, I got a value in a variable (works fine), now I want to check if that value is NOT some things and then do something if it is not, here is what I have so far: (the two lines between the empty lines are the new bit, the other lines are old and work fine)

 

if ($atts['excerpt'] == 'true') {
$varproducttitle = get_the_title();
$vargooglelinkend = " house";
 
$varbundlecheck = get_the_ID();
IF $varbundlecheck IS NOT 5415 IS NOT 5961 IS NOT 4710 THEN DO
 
$varcomplete = $vargooglelink . $varproducttitle . $vargooglelinkend;
$content .= "<td> <a href='$varcomplete' target=_blank><img src=wp-content/custom/imageicon.png /></a> </td>";
}
break;
Link to comment
Share on other sites

I adapted it to the best of my abilities, it is not erroring but it is not working either:

 

case 'excerpt':
if ($atts['excerpt'] == 'true') {
$varproducttitle = get_the_title();
$vargooglelinkend = " house";
 
$varbundlecheck = get_the_ID();
if ( !in_array($varbundlecheck, array('5415','5961','4710'), true ) ) {
 
$varcomplete = $vargooglelink . $varproducttitle . $vargooglelinkend;
$content .= "<td> <a href='$varcomplete' target=_blank><img src=wp-content/custom/imageicon.png /></a> </td>";
}
}
break;
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.