I having issues getting a function to echo, where $lightbox_link1
= get_custom_field('lightbox_link1')
. I’m fairly new to PHP.
Below is the defining function:
// Check for a lightbox link, if it exists, use that as the value.
// If it doesn't, use the featured image URL from above.
if(get_custom_field('lightbox_link1')) {
$lightbox_link1 = get_custom_field('lightbox_link1');
} else {
$lightbox_link1 = $image_full[0];
}
Echo Function:
<?php if ($lightbox_link1 = get_custom_field('lightbox_link1')) {
echo '<a href="<?php echo $lightbox_link1; ?>" data-rel="prettyPhoto[<?php echo $post_slug; ?>]"></a>';
} ?>
should be
=
is used for assignment==
is used for comparison===
is used for typesafe comparisonalso you can’t declare
<?php ... ?>
inside another<?php ... ?>
to get something like
<?php ... <?php ... ?> ... ?>
take a look at what you did up to here:
Instead, using doublequotes in your
echo
statement will allow for the php variables inside to be parsed, so you could just doto get