'framework_custom_background_callback' ) ); /* Add support for post thumbnails. */ add_theme_support( 'post-thumbnails' ); /* Add extra support for post types. */ add_action( 'init', 'framework_add_post_type_support' ); /* This function is for adding extra support for features not default to the core post types. */ function framework_add_post_type_support() { /* Add support for excerpts to the 'page' post type. */ add_post_type_support( 'page', array( 'excerpt' ) ); /* Add support for trackbacks to the 'attachment' post type. */ add_post_type_support( 'attachment', array( 'trackbacks' ) ); } /* Defines the theme prefix. */ function framework_get_prefix() { global $framework; /* If the global prefix isn't set, define it. */ if ( empty( $framework->prefix ) ) $framework->prefix = apply_filters( 'framework_prefix', get_template() ); return $framework->prefix; } /* Defines the theme textdomain. */ function framework_get_textdomain() { global $framework; /* If the global textdomain isn't set, define it. Plugin/theme authors may also define a custom textdomain. */ if ( empty( $framework->textdomain ) ) $framework->textdomain = sanitize_key( apply_filters( framework_get_prefix() . '_textdomain', get_template() ) ); return $framework->textdomain; } /* Filters the 'load_textdomain_mofile' filter hook. */ function framework_load_textdomain( $mofile, $domain ) { /* If the $domain is for the parent or child theme, search for a $domain-$locale.mo file. */ if ( $domain == framework_get_textdomain() ) { /* Check for a $domain-$locale.mo file in the parent theme root and /languages folder. */ $locale = get_locale(); $locate_mofile = locate_template( array( "languages/{$domain}-{$locale}.mo", "{$domain}-{$locale}.mo" ) ); /* If a mofile was found based on the given format, set $mofile to that file name. */ if ( !empty( $locate_mofile ) ) $mofile = $locate_mofile; } /* Return the $mofile string. */ return $mofile; } /* Loads the theme settings once and allows the input of the specific field the user would like to show. */ function framework_get_setting( $option ) { /* Get the theme prefix. */ $prefix = framework_get_prefix(); /* Get the settings so they can be displayed. */ $options = get_option( $prefix . '_theme_settings' ); if ( isset( $options[$option] ) ) return $options[$option]; else return false; } /* Adds contextual action hooks to the theme. */ function do_atomic( $tag = '', $arg = '' ) { if ( empty( $tag ) ) return false; /* Get the theme prefix. */ $pre = framework_get_prefix(); /* Get the args passed into the function and remove $tag. */ $args = func_get_args(); array_splice( $args, 0, 1 ); /* Do actions on the basic hook. */ do_action_ref_array( "{$pre}_{$tag}", $args ); /* Loop through context array and fire actions on a contextual scale. */ foreach ( (array)framework_get_context() as $context ) do_action_ref_array( "{$pre}_{$context}_{$tag}", $args ); } /* Adds contextual filter hooks to the theme. */ function apply_atomic( $tag = '', $value = '' ) { if ( empty( $tag ) ) return false; /* Get theme prefix. */ $pre = framework_get_prefix(); /* Get the args passed into the function and remove $tag. */ $args = func_get_args(); array_splice( $args, 0, 1 ); /* Apply filters on the basic hook. */ $value = $args[0] = apply_filters_ref_array( "{$pre}_{$tag}", $args ); /* Loop through context array and apply filters on a contextual scale. */ foreach ( (array)framework_get_context() as $context ) $value = $args[0] = apply_filters_ref_array( "{$pre}_{$context}_{$tag}", $args ); /* Return the final value once all filters have been applied. */ return $value; } /* Wraps the output of apply_atomic() in a call to do_shortcode(). */ function apply_atomic_shortcode( $tag = '', $value = '' ) { return do_shortcode( apply_atomic( $tag, $value ) ); } /* This is a fix for when a user sets a custom background color with no custom background image. */ function framework_custom_background_callback() { /* Get the background image. */ $image = get_background_image(); /* If there's an image, just call the normal WordPress callback. We won't do anything here. */ if ( !empty( $image ) ) { _custom_background_cb(); return; } /* Get the background color. */ $color = get_background_color(); /* If no background color, return. */ if ( empty( $color ) ) return; /* Use 'background' instead of 'background-color'. */ $style = "background: #{$color};"; echo ''; } ?>