Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Example:

$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

1 Answer 1

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
1  
That works. Thanks! –  Brett Johnson Aug 5 '11 at 12:09

Your Answer

 
discard

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.