I know its basic of php.Question is simple as the question title like : My code doesnt pass another if pharese when see return phrase.To explain that what I want to do, I want to control that will show social icons with their links seem or not on my header.My code works generally but the big problem is when I set first if statement as false, all the other social icons wont seem.Or the another example is, if I set twitter icon as not seeming, no social icons seem.
I think the best way is looking the codes for you.If I am not wrong the problem is related the "return" command.
I call this function in header.php to show them:
function header_social_icons() {
global $redux_demo;
echo ' <span class="wrapper2 custom-social-link">';
if ( isset( $redux_demo['switch-on-twitter-icon'] ) && $redux_demo['switch-on-twitter-icon'] ) {
echo "<a href=". $redux_demo['text-twitter-link'] . ">
<i class=\"fa fa-3x fa-twitter-square\"></i></a>";
} else {
return ;
}
if ( isset( $redux_demo['switch-on-youtube-icon'] ) && $redux_demo['switch-on-youtube-icon'] ) {
echo "<a href=". $redux_demo['text-youtube-link'] . ">
<i class=\"fa fa-3x fa-youtube-square\"></i></a>";
} else {
return ;
}
if ( isset( $redux_demo['switch-on-facebook-icon'] ) && $redux_demo['switch-on-facebook-icon'] ) {
echo "<a href=". $redux_demo['text-facebook-link'] . ">
<i class=\"fa fa-3x fa-facebook-square\"></i></a>";
} else {
return ;
}
if ( isset( $redux_demo['switch-on-github-icon'] ) && $redux_demo['switch-on-github-icon'] ) {
echo "<a href=". $redux_demo['text-github-link'] . ">
<i class=\"fa fa-3x fa-github-square\"></i></a>";
} else {
return ;
}
if ( isset( $redux_demo['switch-on-pinterest-icon'] ) && $redux_demo['switch-on-pinterest-icon'] ) {
echo "<a href=". $redux_demo['text-pinterest-link'] . ">
<i class=\"fa fa-3x fa-pinterest-square\"></i></a>";
} else {
return ;
}
if ( isset( $redux_demo['switch-on-instagram-icon'] ) && $redux_demo['switch-on-instagram-icon'] ) {
echo "<a href=". $redux_demo['text-instagram-link'] . ">
<i class=\"fa fa-3x fa-instagram\"></i></a>";
} else {
return ;
}
echo '</span>';
}
Aucun commentaire:
Enregistrer un commentaire