php - Wordpress IF statement not working -
i have if statement stating following...
<?php if (empty($data['footer_text'])) { echo'<p>© '; print(date("y")); echo'<span class="sep"> | </span><a href="'; echo get_settings('home'); echo'" title="'; bloginfo( 'name' ); echo'" rel="home">'; bloginfo( 'name' ); echo'</a></p>'; } else{ echo'<p>'; global $data; echo $data['footer_text']; echo'</p>'; } ?>
the problem i'm running when call this.
<p><?php global $data; echo $data['footer_text']; ?>;</p>
it displays text correctly. when use if statement defaults showing site name when know it's displaying text correctly.
is syntax screwed up? can't figure out why thinks nothing there still shows when display in p tag.
you don't declare $data global until you're inside if(), meaning $data undefined @ point you're doing the
if (empty($data[...])) {
you want
global $data; if (empty($data[...])) {
instead.
Comments
Post a Comment