[Plugin: NextGEN Custom Fields] conditional statements based on custom field content
-
Hi,
This plugin is a great help for some custom design/functionality I wanted to implement on my new website.
I’ve got it working as I’d like fine already though I think with some php know how it could be easier.
I’ve got some custom fields on my images and then on the gallery template there is some code wrapped around what goes in the custom field. The trouble with this is that that extra code wrapped around still shows up for those images where the custom field is blank.
There probably is an easy way to do an if statement to check if the custom field is empty and if it is then don’t display anything, else if there is something in the custom field, wrap this code around it. I’m just a html+css monkey though and I’ve given writing an if statement a go, though I can’t seem to work out the right syntax.
The current work around means putting the whole code each time into the custom field. That isn’t very elegant compared to just putting the url I wanted to link to in the custom field though.
For example:
If custom field isn’t empty do:
<a class="more-icon" title="Read Article" href="http://<?php echo $image->ngg_custom_fields["link"]; ?>">Read more</a>else do:
nothing
Then I could just put
www.abc123.com
into the custom field.Instead of putting
<a class="more-icon" title="Read Article" href="http://www.abc123.com">Read more</a>
into the custom field.
The topic ‘[Plugin: NextGEN Custom Fields] conditional statements based on custom field content’ is closed to new replies.