Created
March 19, 2014 18:27
-
-
Save matgargano/9648111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// theme code | |
$contestants = apply_filters('contestants', 'name'); | |
if ( is_array( $contestants ) ) { | |
foreach($contestants as $contestant){ | |
echo "hello " . $contestant . '<br>'; | |
} | |
} elseif ( is_string($contestants)){ | |
echo 'hello ' . $contestant . '<br>'; | |
} | |
// if I add filter like this: | |
add_filter( 'contestants', function(){ | |
return array('Tom','Dick','Harry'); | |
}); | |
// it will return : | |
// hello Tom | |
// hello Dick | |
// hello Harry | |
// if I add filter like this: | |
add_filter( 'contestants', function(){ | |
return 'Chris'; | |
}); | |
// it will return : | |
// hello Chris |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment