Created
March 11, 2013 08:40
-
-
Save mauryaratan/5132836 to your computer and use it in GitHub Desktop.
Useful WordPress functions for random needs.
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
<?php | |
function is_sidebar_active( $index = 1){ | |
$sidebars = wp_get_sidebars_widgets(); | |
$count = count($sidebars['sidebar-'.$index]); | |
if($count === 0){ | |
return false; | |
}else{ | |
return true; | |
} | |
} | |
/* Custom text length */ | |
function stag_trim_text($text, $cut, $suffix = '...') { | |
if ($cut < strlen($text)) { | |
return substr($text, '0', $cut) . $suffix; | |
} else { | |
return substr($text, '0', $cut); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment