* @copyright Copyright (c) 2008 - 2012, Justin Tadlock * @link http://themehybrid.com/hybrid-core * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ /* Add extra support for post types. */ add_action( 'init', 'hybrid_add_post_type_support' ); /* Add extra file headers for themes. */ add_filter( 'extra_theme_headers', 'hybrid_extra_theme_headers' ); /** * This function is for adding extra support for features not default to the core post types. * Excerpts are added to the 'page' post type. Comments and trackbacks are added for the * 'attachment' post type. Technically, these are already used for attachments in core, but * they're not registered. * * @since 0.8.0 * @access private * @return void */ function hybrid_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' ) ); } /** * Creates custom theme headers. This is the information shown in the header block of a theme's 'style.css' * file. Themes are not required to use this information, but the framework does make use of the data for * displaying additional information to the theme user. * * @since 1.2.0 * @access private * @link http://codex.wordpress.org/Theme_Review#Licensing * @param array $headers Array of extra headers added by plugins/themes. * @return array $headers */ function hybrid_extra_theme_headers( $headers ) { /* Add support for 'Template Version'. This is for use in child themes to note the version of the parent theme. */ if ( !in_array( 'Template Version', $headers ) ) $headers[] = 'Template Version'; /* Add support for 'License'. Proposed in the guidelines for the WordPress.org theme review. */ if ( !in_array( 'License', $headers ) ) $headers[] = 'License'; /* Add support for 'License URI'. Proposed in the guidelines for the WordPress.org theme review. */ if ( !in_array( 'License URI', $headers ) ) $headers[] = 'License URI'; /* Add support for 'Support URI'. This should be a link to the theme's support forums. */ if ( !in_array( 'Support URI', $headers ) ) $headers[] = 'Support URI'; /* Add support for 'Documentation URI'. This should be a link to the theme's documentation. */ if ( !in_array( 'Documentation URI', $headers ) ) $headers[] = 'Documentation URI'; /* Return the array of custom theme headers. */ return $headers; } /** * Looks for a template based on the hybrid_get_context() function. If the $template parameter * is a directory, it will look for files within that directory. Otherwise, $template becomes the * template name prefix. The function looks for templates based on the context of the current page * being viewed by the user. * * @since 0.8.0 * @access public * @param string $template The slug of the template whose context we're searching for. * @return string $template The full path of the located template. */ function get_atomic_template( $template ) { $templates = array(); $theme_dir = trailingslashit( THEME_DIR ) . $template; $child_dir = trailingslashit( CHILD_THEME_DIR ) . $template; if ( is_dir( $child_dir ) || is_dir( $theme_dir ) ) { $dir = true; $templates[] = "{$template}/index.php"; } else { $dir = false; $templates[] = "{$template}.php"; } foreach ( hybrid_get_context() as $context ) $templates[] = ( ( $dir ) ? "{$template}/{$context}.php" : "{$template}-{$context}.php" ); return locate_template( array_reverse( $templates ), true ); } /** * Generates the relevant template info. Adds template meta with theme version. Uses the theme * name and version from style.css. In 0.6, added the hybrid_meta_template * filter hook. * * @since 0.4.0 * @access private * @return void */ function hybrid_meta_template() { $theme = wp_get_theme( get_template(), get_theme_root( get_template_directory() ) ); $template = '' . "\n"; echo apply_atomic( 'meta_template', $template ); } /** * Dynamic element to wrap the site title in. If it is the front page, wrap it in an