Trying to hide .row
if no text is entered into the 'extra_text'
within a wordpress options page.
<div class="row">
<div class=".ten.columns.centered">
<div class="panel" style="margin-top: 20px;">
<p><?php if(esc_textarea(of_get_option('extra_text')) != NULL){ echo esc_textarea(of_get_option('extra_text'));} else echo 'display:none;'; ?></p>
</div>
</div>
</div>
Some things for my noob eyes.
- Your .ten.columns.centered should be “ten columns centered” or something like that. The way you have it now isn’t valid.
- You echo display:none; (presumably) but that needs to be set in the style attribute for the
<p>
.
I don’t know if the IF statement works or not but that’s just what I noticed. The classes and then the echo.
2 Likes
mawburn
4
This should work. I’m not that familiar with WP or the functions you’re using though, so it might not. Give it a shot.
<?php if(esc_textarea(of_get_option('extra_text')) != NULL) { ?>
<div class="row">
<div class="ten columns centered">
<div class="panel" style="margin-top: 20px;">
<p><?php echo esc_textarea(of_get_option('extra_text')); ?></p>
</div>
</div>
</div>
<?php } ?>
2 Likes
Worked like a dream - I was tinkering around with adding the echo into a p tag just couldnt get the full syntax right. Many thanks @mawburn
1 Like
system
Closed
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.