WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it a bad idea to set your themename and shortname as variables to be used in the various functions of a theme?


$themename = mytheme;
$shortname = mth;

 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
function toolbox_page_menu_args($args) {
    // some code
add_filter( 'wp_page_menu_args', $themename . '_page_menu_args' );
share|improve this question
up vote 1 down vote accepted

You can do it easier and without polluting the global namespace: get_option('template'); gives you the (parent) themes name. If you want the child themes name, use get_current_theme();.

You could also use a constant across your theme files: define( 'YOUR_PREFIX-THEME_NAME', get_current_theme() );

share|improve this answer
That works. Thanks! – Brett Johnson Aug 5 '11 at 12:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.