Using $themename Variables

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' );

Related posts

Leave a Reply

1 comment

  1. 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() );