This file contains 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
// ❌ You can skip the else block | |
function hello(name) { | |
if(name) { | |
return '👋' | |
} | |
else { | |
return '👻' | |
} | |
} |
This file contains 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
// ❌ You can skip the else block | |
function calcPercentage(number) { | |
// Check if valid number | |
if(typeof number === 'number') { | |
// Another check: only do calculation number is less than 1 | |
if (number > 1) { | |
return 'Number must be less than 1'; | |
} else { |
This file contains 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
//* Add language switcher polylang with slug inspite of names | |
//* Position header-right | |
add_action( 'genesis_header_right', 'custom_language_switcher'); | |
function custom_language_switcher() { | |
echo '<ul class="custom-lang-switcher">'; | |
pll_the_languages(array('show_names'=>1,'display_names_as'=>'slug')); | |
echo '</ul>'; | |
} |