/** * Initializes the theme framework, loads the required files, and calls the * functions needed to run the theme. * * @since 0.7 */ function init() { /* Define theme constants. */ $this->constants(); /* Load theme functions. */ $this->functions(); /* Load theme extensions. */ $this->extensions(); /* Load legacy files and functions. */ $this->legacy(); /* Load admin files. */ $this->admin(); /* Theme prefix for creating things such as filter hooks (i.e., "$prefix_hook_name"). */ $this->prefix = hybrid_get_prefix(); /* Load theme textdomain. */ $domain = hybrid_get_textdomain(); $locale = get_locale(); load_textdomain( $domain, locate_template( array( "languages/{$domain}-{$locale}.mo", "{$domain}-{$locale}.mo" ) ) ); /* Initialize the theme's default actions. */ $this->actions(); /* Initialize the theme's default filters. */ $this->filters(); /* Theme init hook. */ do_action( "{$this->prefix}_init" ); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6 */ function Hybrid_Widget_Calendar() { $this->prefix = hybrid_get_prefix(); $this->textdomain = hybrid_get_textdomain(); $widget_ops = array( 'classname' => 'calendar', 'description' => __( 'An advanced widget that gives you total control over the output of your calendar.', $this->textdomain ) ); $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => "{$this->prefix}-calendar" ); $this->WP_Widget( "{$this->prefix}-calendar", __( 'Calendar', $this->textdomain ), $widget_ops, $control_ops ); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6 */ function Hybrid_Widget_Bookmarks() { $this->prefix = hybrid_get_prefix(); $this->textdomain = hybrid_get_textdomain(); $widget_ops = array( 'classname' => 'bookmarks', 'description' => __( 'An advanced widget that gives you total control over the output of your bookmarks (links).', $this->textdomain ) ); $control_ops = array( 'width' => 800, 'height' => 350, 'id_base' => "{$this->prefix}-bookmarks" ); $this->WP_Widget( "{$this->prefix}-bookmarks", __( 'Bookmarks', $this->textdomain ), $widget_ops, $control_ops ); }
/** * Add the revised meta tag on single posts and pages (or any post type). This shows the last time the post * was modified. * * @since 0.4.0 */ function hybrid_meta_revised() { $revised = ''; if ( is_singular() ) $revised = '<meta name="revised" content="' . get_the_modified_time( esc_attr__( 'l, F jS, Y, g:i a', hybrid_get_textdomain() ) ) . '" />' . "\n"; echo apply_atomic( 'meta_revised', $revised ); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6 */ function Hybrid_Widget_Search() { $this->prefix = hybrid_get_prefix(); $this->textdomain = hybrid_get_textdomain(); $widget_ops = array( 'classname' => 'search', 'description' => __( 'An advanced widget that gives you total control over the output of your search form.', $this->textdomain ) ); $control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-search" ); $this->WP_Widget( "{$this->prefix}-search", __( 'Search', $this->textdomain ), $widget_ops, $control_ops ); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6 */ function Hybrid_Widget_Nav_Menu() { $this->prefix = hybrid_get_prefix(); $this->textdomain = hybrid_get_textdomain(); $widget_ops = array( 'classname' => 'nav-menu', 'description' => __( 'An advanced widget that gives you total control over the output of your menus.', $this->textdomain ) ); $control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-nav-menu" ); $this->WP_Widget( "{$this->prefix}-nav-menu", __( 'Navigation Menu', $this->textdomain ), $widget_ops, $control_ops ); }
/** * Grabs series by custom field. Checks for other articles in the series. * Series identified custom field key 'Series' and unique value. * * @todo Fix the multiple hyphens in the series class. * @todo Allow filtering of title. * * @since 0.1 * @param array $args Array of arguments. */ function custom_field_series( $args = array() ) { global $post; $textdomain = hybrid_get_textdomain(); $series_meta = get_metadata( 'post', $post->ID, 'Series', true ); if ( $series_meta ) { $defaults = array( 'order' => 'DESC', 'orderby' => 'ID', 'include' => '', 'exclude' => '', 'post_type' => 'any', 'numberposts' => -1, 'meta_key' => 'Series', 'meta_value' => $series_meta, 'echo' => true ); $args = apply_filters( 'custom_field_series_args', $args ); $args = wp_parse_args( $args, $defaults ); $series_posts = get_posts( $args ); if ( $series_posts ) { $class = str_replace( array( '_', ' ', ' ' ) , '-', $series_meta ); $class = preg_replace('/[^A-Za-z0-9-]/', '', $class ); $class = strtolower( $class ); $series = '<div class="series series-' . $class . '">'; $series .= '<h4 class="series-title">' . __( 'Articles in this series', $textdomain) . '</h4>'; $series .= '<ul>'; foreach ( $series_posts as $serial ) { if ( $serial->ID == $post->ID ) $series .= '<li class="current-post">' . $serial->post_title . '</li>'; else $series .= '<li><a href="' . get_permalink( $serial->ID ) . '" title="' . esc_attr( $serial->post_title ) . '">' . $serial->post_title . '</a></li>'; } $series .= '</ul></div>'; } } $series = apply_filters( 'custom_field_series', $series ); if ( $args['echo'] && $series ) echo $series; elseif ( $series ) return $series; }
/** * Returns an array of the core framework's available sidebars for use in themes. We'll just set the * ID (array keys), name, and description of each sidebar. The other sidebar arguments will be set when the * sidebar is registered. * * @since 1.2.0 */ function hybrid_get_sidebars() { /* Get the theme textdomain. */ $domain = hybrid_get_textdomain(); /* Set up an array of sidebars. */ $sidebars = array('primary' => array('name' => _x('Primary', 'sidebar', $domain), 'description' => __('The main (primary) widget area, most often used as a sidebar.', $domain)), 'secondary' => array('name' => _x('Secondary', 'sidebar', $domain), 'description' => __('The second most important widget area, most often used as a secondary sidebar.', $domain)), 'subsidiary' => array('name' => _x('Subsidiary', 'sidebar', $domain), 'description' => __('A widget area loaded in the footer of the site.', $domain)), 'header' => array('name' => _x('Header', 'sidebar', $domain), 'description' => __('Displayed within the site\'s header area.', $domain)), 'before-content' => array('name' => _x('Before Content', 'sidebar', $domain), 'description' => __('Loaded before the page\'s main content area.', $domain)), 'after-content' => array('name' => _x('After Content', 'sidebar', $domain), 'description' => __('Loaded after the page\'s main content area.', $domain)), 'after-singular' => array('name' => _x('After Singular', 'sidebar', $domain), 'description' => __('Loaded on singular post (page, attachment, etc.) views before the comments area.', $domain))); /* Return the sidebars. */ return $sidebars; }
/** * Creates the settings for the post meta box depending on some things in how the theme are set up. Most * of the available options depend on theme-supported features of the framework. * * @since 0.7.0 * @param string $type The post type of the current post in the post editor. */ function hybrid_post_meta_box_args( $type = '' ) { /* Set up some default variables. */ $prefix = hybrid_get_prefix(); $domain = hybrid_get_textdomain(); $meta = array(); /* If no post type is given, default to 'post'. */ if ( empty( $type ) ) $type = 'post'; /* If the current theme supports the 'hybrid-core-seo' feature. */ if ( current_theme_supports( 'hybrid-core-seo' ) ) { $meta['title'] = array( 'name' => 'Title', 'title' => sprintf( __( 'Document Title: %s', $domain ), '<code><title></code>' ), 'type' => 'text' ); $meta['description'] = array( 'name' => 'Description', 'title' => sprintf( __( 'Meta Description: %s', $domain ), '<code><meta></code>' ), 'type' => 'textarea' ); $meta['keywords'] = array( 'name' => 'Keywords', 'title' => sprintf( __( 'Meta Keywords: %s', $domain ), '<code><meta></code>' ), 'type' => 'text' ); } /* If the current theme supports the 'custom-field-series' extension. */ if ( current_theme_supports( 'custom-field-series' ) ) $meta['series'] = array( 'name' => 'Series', 'title' => __( 'Series:', $domain ), 'type' => 'text' ); /* If the current theme supports the 'get-the-image' extension. */ if ( current_theme_supports( 'get-the-image' ) ) $meta['thumbnail'] = array( 'name' => 'Thumbnail', 'title' => __( 'Thumbnail:', $domain ), 'type' => 'text' ); /* If the current theme supports the 'post-stylesheets' extension. */ if ( current_theme_supports( 'post-stylesheets' ) ) $meta['stylesheet'] = array( 'name' => 'Stylesheet', 'title' => __( 'Stylesheet:', $domain ), 'type' => 'text' ); /* If the current theme supports the 'hybrid-core-template-hierarchy' and is not a page or attachment. */ if ( current_theme_supports( 'hybrid-core-template-hierarchy' ) && 'page' != $type && 'attachment' != $type ) { /* Get the post type object. */ $post_type_object = get_post_type_object( $type ); /* If the post type object returns a singular name or name. */ if ( !empty( $post_type_object->labels->singular_name ) || !empty( $post_type_object->name ) ) { /* Get a list of available custom templates for the post type. */ $templates = hybrid_get_post_templates( array( 'label' => array( "{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template" ) ) ); /* If templates found, allow user to select one. */ if ( 0 != count( $templates ) ) $meta['template'] = array( 'name' => "_wp_{$type}_template", 'title' => __( 'Template:', $domain ), 'type' => 'select', 'options' => $templates, 'use_key_and_value' => true ); } } /* $prefix_$type_meta_boxes filter is deprecated. Use $prefix_$type_meta_box_args instead. */ $meta = apply_filters( "{$prefix}_{$type}_meta_boxes", $meta ); /* Allow per-post_type filtering of the meta box arguments. */ return apply_filters( "{$prefix}_{$type}_meta_box_args", $meta ); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 1.2.0 */ function __construct() { /* Set the widget textdomain. */ $this->textdomain = hybrid_get_textdomain(); /* Set up the widget options. */ $widget_options = array('classname' => 'archives', 'description' => esc_html__('An advanced widget that gives you total control over the output of your archives.', $this->textdomain)); /* Set up the widget control options. */ $control_options = array('width' => 525, 'height' => 350); /* Create the widget. */ $this->WP_Widget('hybrid-archives', __('Archives', $this->textdomain), $widget_options, $control_options); }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 1.2.0 */ function __construct() { /* Set the widget prefix. */ $this->prefix = hybrid_get_prefix(); /* Set the widget textdomain. */ $this->textdomain = hybrid_get_textdomain(); /* Set up the widget options. */ $widget_options = array('classname' => 'calendar', 'description' => esc_html__('An advanced widget that gives you total control over the output of your calendar.', $this->textdomain)); /* Set up the widget control options. */ $control_options = array('width' => 200, 'height' => 350); /* Create the widget. */ $this->WP_Widget('hybrid-calendar', __('Calendar', $this->textdomain), $widget_options, $control_options); }
/** * Displays the post template meta box. * * @since 1.2.0 */ function hybrid_meta_box_post_display_template($object, $box) { /* Get the post type object. */ $post_type_object = get_post_type_object($object->post_type); /* If the post type object returns a singular name or name. */ if (!empty($post_type_object->labels->singular_name) || !empty($post_type_object->name)) { /* Get a list of available custom templates for the post type. */ $templates = hybrid_get_post_templates(array('label' => array("{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template"))); } ?> <input type="hidden" name="hybrid-core-post-meta-box-template" value="<?php echo wp_create_nonce(basename(__FILE__)); ?> " /> <p> <?php if (0 != count($templates)) { ?> <select name="hybrid-post-template" id="hybrid-post-template" class="widefat"> <option value=""></option> <?php foreach ($templates as $label => $template) { ?> <option value="<?php echo esc_attr($template); ?> " <?php selected(esc_attr(get_post_meta($object->ID, "_wp_{$post_type_object->name}_template", true)), esc_attr($template)); ?> ><?php echo esc_html($label); ?> </option> <?php } ?> </select> <?php } else { ?> <?php _e('No templates exist for this post type.', hybrid_get_textdomain()); ?> <?php } ?> </p> <?php }
/** * Displays the post SEO meta box. * * @since 1.2.0 */ function hybrid_meta_box_post_display_seo($object, $box) { $domain = hybrid_get_textdomain(); ?> <input type="hidden" name="hybrid-core-post-meta-box-seo" value="<?php echo wp_create_nonce(basename(__FILE__)); ?> " /> <div class="hybrid-post-settings"> <p> <label for="hybrid-document-title"><?php _e('Document Title:', $domain); ?> </label> <br /> <input type="text" name="hybrid-document-title" id="hybrid-document-title" value="<?php echo esc_attr(get_post_meta($object->ID, 'Title', true)); ?> " size="30" tabindex="30" style="width: 99%;" /> </p> <p> <label for="hybrid-meta-description"><?php _e('Meta Description:', $domain); ?> </label> <br /> <textarea name="hybrid-meta-description" id="hybrid-meta-description" cols="60" rows="2" tabindex="30" style="width: 99%;"><?php echo esc_textarea(get_post_meta($object->ID, 'Description', true)); ?> </textarea> </p> <p> <label for="hybrid-meta-keywords"><?php _e('Meta Keywords:', $domain); ?> </label> <br /> <input type="text" name="hybrid-meta-keywords" id="hybrid-meta-keywords" value="<?php echo esc_attr(get_post_meta($object->ID, 'Keywords', true)); ?> " size="30" tabindex="30" style="width: 99%;" /> </p> </div><!-- .form-table --><?php }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6 */ function Hybrid_Widget_Authors() { $this->prefix = hybrid_get_prefix(); $this->textdomain = hybrid_get_textdomain(); $widget_ops = array( 'classname' => 'authors', 'description' => __( 'An advanced widget that gives you total control over the output of your author lists.',$this->textdomain ) ); $control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-authors" ); $this->WP_Widget( "{$this->prefix}-authors", __( 'Authors', $this->textdomain ), $widget_ops, $control_ops ); add_action( 'delete_user', array( &$this, 'delete_transient' ) ); add_action( 'user_register', array( &$this, 'delete_transient' ) ); add_action( 'profile_update', array( &$this, 'delete_transient' ) ); add_action( 'save_post', array( &$this, 'delete_transient' ) ); add_action( 'deleted_post', array( &$this, 'delete_transient' ) ); }
/** * Filters the 'load_textdomain_mofile' filter hook so that we can change the directory and file name * of the mofile for translations. This allows child themes to have a folder called /languages with translations * of their parent theme so that the translations aren't lost on a parent theme upgrade. * * @since 0.9.0 * @param string $mofile File name of the .mo file. * @param string $domain The textdomain currently being filtered. */ function hybrid_load_textdomain($mofile, $domain) { /* If the $domain is for the parent or child theme, search for a $domain-$locale.mo file. */ if ($domain == hybrid_get_textdomain() || $domain == hybrid_get_child_textdomain()) { /* Check for a $domain-$locale.mo file in the parent and child 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; }
/** * Creates the settings for the post meta box depending on some things in how the theme is * set up. * * @since 0.7 * @param string $type The post_type of the current post in the post editor. */ function hybrid_post_meta_box_args( $type = '' ) { /* Get theme information. */ $prefix = hybrid_get_prefix(); $domain = hybrid_get_textdomain(); /* If no post type is given, default to 'post'. */ if ( empty( $type ) ) $type = 'post'; /* If the disable SEO plugin setting is not selected, allow the input of custom meta. */ if ( !hybrid_get_setting( 'seo_plugin' ) ) { $meta['title'] = array( 'name' => 'Title', 'title' => __( 'Title:', $domain ), 'type' => 'text' ); $meta['description'] = array( 'name' => 'Description', 'title' => __( 'Description:', $domain ), 'type' => 'textarea' ); $meta['keywords'] = array( 'name' => 'Keywords', 'title' => __( 'Keywords:', $domain ), 'type' => 'text' ); } /* Integrates with the custom field series extension. */ if ( function_exists( 'custom_field_series' ) ) $meta['series'] = array( 'name' => 'Series', 'title' => __( 'Series:', $domain ), 'type' => 'text' ); /* Input box for a custom thumbnail. */ $meta['thumbnail'] = array( 'name' => 'Thumbnail', 'title' => __( 'Thumbnail:', $domain ), 'type' => 'text' ); /* If there are any custom post templates, allow the user to select one. */ if ( 'page' != $type && 'attachment' != $type ) { $post_type_object = get_post_type_object( $type ); if ( $post_type_object->singular_label || $post_type_object->name ) { $templates = hybrid_get_post_templates( array( 'label' => array( "{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template" ) ) ); if ( 0 != count( $templates ) ) $meta['template'] = array( 'name' => "_wp_{$type}_template", 'title' => __( 'Template:', $domain ), 'type' => 'select', 'options' => $templates, 'use_key_and_value' => true ); } } /* Add post layouts option if current theme supports them. */ if ( current_theme_supports( 'post-layouts' ) ) $meta['post_layout'] = array( 'name' => 'Layout', 'title' => __( 'Layout:', $domain ), 'type' => 'select', 'options' => array( '1c', '2c-l', '2c-r', '3c-l', '3c-r', '3c-c' ) ); /* $prefix_$type_meta_boxes filter is deprecated. Use $prefix_$type_meta_box_args instead. */ $meta = apply_filters( "{$prefix}_{$type}_meta_boxes", $meta ); return apply_filters( "{$prefix}_{$type}_meta_box_args", $meta ); }
/** * Registers each widget area for the theme. This includes all of the asides * and the utility widget areas throughout the theme. * * @since 0.7 * @uses register_sidebar() Registers a widget area. */ function hybrid_register_sidebars() { $domain = hybrid_get_textdomain(); /* Register aside widget areas. */ register_sidebar( array( 'name' => __( 'Primary', $domain ), 'id' => 'primary', 'description' => __( 'The main (primary) widget area, most often used as a sidebar.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); register_sidebar( array( 'name' => __( 'Secondary', $domain ), 'id' => 'secondary', 'description' => __( 'The second most important widget area, most often used as a secondary sidebar', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); register_sidebar( array( 'name' => __( 'Subsidiary', $domain ), 'id' => 'subsidiary', 'description' => __( 'A widget area loaded in the footer of the site.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); /* Register utility widget areas. */ register_sidebar( array( 'name' => __( 'Utility: Before Content', $domain ), 'id' => 'utility-before-content', 'description' => __( 'Loaded before the page\'s main content area.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); register_sidebar( array( 'name' => __( 'Utility: After Content', $domain ), 'id' => 'utility-after-content', 'description' => __( 'Loaded after the page\'s main content area.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); register_sidebar( array( 'name' => __( 'Utility: After Singular', $domain ), 'id' => 'utility-after-singular', 'description' => __( 'Loaded on singular post (page, attachment, etc.) views before the comments area.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); /* Register template widget areas only if the templates are available. */ if ( locate_template( array( 'page-widgets.php' ) ) ) register_sidebar( array( 'name' => __( 'Widgets Template', $domain ), 'id' => 'utility-widgets-template', 'description' => __( 'Used as the content of the Widgets page template.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); if ( locate_template( array( '404.php' ) ) ) register_sidebar( array( 'name' => __( '404 Template', $domain ), 'id' => 'utility-404', 'description' => __( 'Replaces the default 404 error page content.', $domain ), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); }
/** * Sets up a default array of theme settings for use with the theme. Theme developers should filter the * "{$prefix}_default_theme_settings" hook to define any default theme settings. WordPress does not * provide a hook for default settings at this time. * * @since 1.0.0 */ function hybrid_get_default_theme_settings() { /* Set up some default variables. */ $settings = array(); $domain = hybrid_get_textdomain(); $prefix = hybrid_get_prefix(); /* Get theme-supported meta boxes for the settings page. */ $supports = get_theme_support('hybrid-core-theme-settings'); /* If the current theme supports the footer meta box and shortcodes, add default footer settings. */ if (is_array($supports[0]) && in_array('footer', $supports[0]) && current_theme_supports('hybrid-core-shortcodes')) { /* If there is a child theme active, add the [child-link] shortcode to the $footer_insert. */ if (is_child_theme()) { $settings['footer_insert'] = '<p class="copyright">' . __('Copyright © [the-year] [site-link].', $domain) . '</p>' . "\n\n" . '<p class="credit">' . __('Powered by [wp-link], [theme-link], and [child-link].', $domain) . '</p>'; } else { $settings['footer_insert'] = '<p class="copyright">' . __('Copyright © [the-year] [site-link].', $domain) . '</p>' . "\n\n" . '<p class="credit">' . __('Powered by [wp-link] and [theme-link].', $domain) . '</p>'; } } /* Return the $settings array and provide a hook for overwriting the default settings. */ return apply_filters("{$prefix}_default_theme_settings", $settings); }
/** * Registers the the framework's default menus based on the menus the theme has registered support for. * * @since 0.8.0 * @uses register_nav_menu() Registers a nav menu with WordPress. * @link http://codex.wordpress.org/Function_Reference/register_nav_menu */ function hybrid_register_menus() { /* Get theme-supported menus. */ $menus = get_theme_support('hybrid-core-menus'); /* If there is no array of menus IDs, return. */ if (!is_array($menus[0])) { return; } /* Register the 'primary' menu. */ if (in_array('primary', $menus[0])) { register_nav_menu('primary', _x('Primary', 'nav menu location', hybrid_get_textdomain())); } /* Register the 'secondary' menu. */ if (in_array('secondary', $menus[0])) { register_nav_menu('secondary', _x('Secondary', 'nav menu location', hybrid_get_textdomain())); } /* Register the 'subsidiary' menu. */ if (in_array('subsidiary', $menus[0])) { register_nav_menu('subsidiary', _x('Subsidiary', 'nav menu location', hybrid_get_textdomain())); } }
/** * Creates a settings box that allows users to customize their footer. A basic textarea is given that * allows HTML and shortcodes to be input. * * @since 1.2.0 */ function hybrid_meta_box_theme_display_footer() { $domain = hybrid_get_textdomain(); ?> <p> <span class="description"><?php _e('You can add custom <acronym title="Hypertext Markup Language">HTML</acronym> and/or shortcodes, which will be automatically inserted into your theme.', $domain); ?> </span> </p> <p> <textarea id="<?php echo hybrid_settings_field_id('footer_insert'); ?> " name="<?php echo hybrid_settings_field_name('footer_insert'); ?> " cols="60" rows="5"><?php echo esc_textarea(hybrid_get_setting('footer_insert')); ?> </textarea> </p> <?php if (current_theme_supports('hybrid-core-shortcodes')) { ?> <p> <?php printf(__('Shortcodes: %s', $domain), '<code>[the-year]</code>, <code>[site-link]</code>, <code>[wp-link]</code>, <code>[theme-link]</code>, <code>[child-link]</code>, <code>[loginout-link]</code>, <code>[query-counter]</code>'); ?> </p> <?php } }
/** * Set up the widget's unique name, ID, class, description, and other options. * @since 0.6.0 */ function Hybrid_Widget_Authors() { /* Set the widget prefix. */ $this->prefix = hybrid_get_prefix(); /* Set the widget textdomain. */ $this->textdomain = hybrid_get_textdomain(); /* Set up the widget options. */ $widget_options = array( 'classname' => 'authors', 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your author lists.', $this->textdomain ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-authors" ); /* Create the widget. */ $this->WP_Widget( "{$this->prefix}-authors", esc_attr__( 'Authors', $this->textdomain ), $widget_options, $control_options ); }
/** * Displays the theme settings page and calls do_meta_boxes() to allow additional settings * meta boxes to be added to the page. * * @since 0.7 * @global string $hybrid The global theme object. */ function hybrid_settings_page() { global $hybrid; /* Get the theme information. */ $prefix = hybrid_get_prefix(); $domain = hybrid_get_textdomain(); $theme_data = get_theme_data( TEMPLATEPATH . '/style.css' ); ?> <div class="wrap"> <h2><?php printf( __( '%1$s Theme Settings', $domain ), $theme_data['Name'] ); ?></h2> <?php if ( 'true' == esc_attr( $_GET['updated'] ) ) echo '<p class="updated fade below-h2" style="padding: 5px 10px;"><strong>' . __( 'Settings saved.', $domain ) . '</strong></p>'; ?> <div id="poststuff"> <form method="post" action="<?php admin_url( 'themes.php?page=theme-settings' ); ?>"> <?php wp_nonce_field( "{$prefix}-settings-page" ); ?> <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> <div class="metabox-holder"> <div class="post-box-container column-1 normal"><?php do_meta_boxes( $hybrid->settings_page, 'normal', $theme_data ); ?></div> <div class="post-box-container column-2 advanced"><?php do_meta_boxes( $hybrid->settings_page, 'advanced', $theme_data ); ?></div> <div class="post-box-container column-3 side"><?php do_meta_boxes( $hybrid->settings_page, 'side', $theme_data ); ?></div> </div> <p class="submit" style="clear: both;"> <input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Update Settings', $domain ); ?>" /> <input type="hidden" name="<?php echo "{$prefix}-settings-submit"; ?>" value="Y" /> <!-- deprecated --><input type="hidden" name="<?php echo "hybrid_submit_hidden"; ?>" value="Y" /> </p><!-- .submit --> <?php do_action( "{$prefix}_child_settings" ); // Hook for child settings (deprecated). ?> </form> </div><!-- #poststuff --> </div><!-- .wrap --><?php }
/** * Function for handling what the browser/search engine title should be. Attempts to handle every * possible situation WordPress throws at it for the best optimization. * * @since 0.1.0 * @global $wp_query */ function hybrid_document_title() { global $wp_query; /* Set up some default variables. */ $domain = hybrid_get_textdomain(); $doctitle = ''; $separator = ':'; /* If viewing the front page and posts page of the site. */ if ( is_front_page() && is_home() ) $doctitle = get_bloginfo( 'name' ) . $separator . ' ' . get_bloginfo( 'description' ); /* If viewing the posts page or a singular post. */ elseif ( is_home() || is_singular() ) { $post_id = $wp_query->get_queried_object_id(); $doctitle = get_post_meta( $post_id, 'Title', true ); if ( empty( $doctitle ) && is_front_page() ) $doctitle = get_bloginfo( 'name' ) . $separator . ' ' . get_bloginfo( 'description' ); elseif ( empty( $doctitle ) ) $doctitle = get_post_field( 'post_title', $post_id ); } /* If viewing any type of archive page. */ elseif ( is_archive() ) { /* If viewing a taxonomy term archive. */ if ( is_category() || is_tag() || is_tax() ) { if ( function_exists( 'single_term_title' ) ) { $doctitle = single_term_title( '', false ); } else { // 3.0 compat $term = $wp_query->get_queried_object(); $doctitle = $term->name; } } /* If viewing a post type archive. */ elseif ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) { $post_type = get_post_type_object( get_query_var( 'post_type' ) ); $doctitle = $post_type->labels->name; } /* If viewing an author/user archive. */ elseif ( is_author() ) $doctitle = get_the_author_meta( 'display_name', get_query_var( 'author' ) ); /* If viewing a date-/time-based archive. */ elseif ( is_date () ) { if ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) $doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'g:i a', $domain ) ) ); elseif ( get_query_var( 'minute' ) ) $doctitle = sprintf( __( 'Archive for minute %1$s', $domain ), get_the_time( __( 'i', $domain ) ) ); elseif ( get_query_var( 'hour' ) ) $doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'g a', $domain ) ) ); elseif ( is_day() ) $doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'F jS, Y', $domain ) ) ); elseif ( get_query_var( 'w' ) ) $doctitle = sprintf( __( 'Archive for week %1$s of %2$s', $domain ), get_the_time( __( 'W', $domain ) ), get_the_time( __( 'Y', $domain ) ) ); elseif ( is_month() ) $doctitle = sprintf( __( 'Archive for %1$s', $domain ), single_month_title( ' ', false) ); elseif ( is_year() ) $doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'Y', $domain ) ) ); } } /* If viewing a search results page. */ elseif ( is_search() ) $doctitle = sprintf( __( 'Search results for "%1$s"', $domain ), esc_attr( get_search_query() ) ); /* If viewing a 404 not found page. */ elseif ( is_404() ) $doctitle = __( '404 Not Found', $domain ); /* If the current page is a paged page. */ if ( ( ( $page = $wp_query->get( 'paged' ) ) || ( $page = $wp_query->get( 'page' ) ) ) && $page > 1 ) $doctitle = sprintf( __( '%1$s Page %2$s', $domain ), $doctitle . $separator, number_format_i18n( $page ) ); /* Apply the wp_title filters so we're compatible with plugins. */ $doctitle = apply_filters( 'wp_title', $doctitle, $separator, '' ); /* Print the title to the screen. */ echo apply_atomic( 'document_title', esc_attr( $doctitle ) ); }
<?php echo apply_atomic_shortcode('byline', '<div class="byline">' . __('By [entry-author] on [entry-published] [entry-edit-link before=" | "]', hybrid_get_textdomain()) . '</div>'); ?> <div class="entry-summary"> <?php the_excerpt(); ?> <?php wp_link_pages(array('before' => '<p class="page-links">' . __('Pages:', hybrid_get_textdomain()), 'after' => '</p>')); ?> </div><!-- .entry-summary --> <?php echo apply_atomic_shortcode('entry_meta', '<div class="entry-meta">' . __('[entry-terms taxonomy="category" before="Posted in "] [entry-terms before="| Tagged "] [entry-comments-link before=" | "]', hybrid_get_textdomain()) . '</div>'); ?> <?php do_atomic('close_entry'); // prototype_close_entry ?> </div><!-- .hentry --> <?php do_atomic('after_entry'); // prototype_after_entry ?> <?php
<div class="entry-content"> <ul class="category-list"> <?php foreach (get_the_category() as $category) { echo '<li><a href="' . get_category_link($category->term_id) . '" >' . $category->cat_name . '</a></li>'; } ?> </ul> <?php echo apply_atomic_shortcode('entry_title', '[entry-title]'); ?> <?php echo apply_atomic_shortcode('byline', '<div class="byline">' . __('[entry-author] <span>|</span> [entry-published] [entry-edit-link before=" <span>|</span> "]', hybrid_get_textdomain()) . '</div>'); ?> <?php the_excerpt(); ?> <div class="entry-meta"> <a href="<?php the_permalink(); ?> #respond" title="Comments"><?php comments_number('Comment', 'Comments (1)', 'Comments (%)'); ?> </a> <a href="<?php the_permalink();
?> <h1 class="entry-title"><span><?php the_title(); ?> </span></h1> <?php if (get_post_meta($post->ID, 'Quote', true)) { echo '<blockquote class="feature-quote">“' . get_post_meta($post->ID, 'Quote', true) . "”</blockquote>"; } ?> <div class="entry-content"> <?php the_content(__('Continue reading <span class="meta-nav">→</span>', hybrid_get_textdomain())); ?> </div><!-- .entry-content --> <div class="team-right"> <h2>Who’s here in 2010-2011</h2> <ul id="current-team-list"> <?php $temp_query = clone $wp_query; ?> <?php $counter = 1; ?>
" class="<?php hybrid_entry_class(); ?> "> <?php do_atomic('before_entry'); // hybrid_before_entry ?> <div class="entry-content"> <?php the_content(sprintf(__('Continue reading %1$s', hybrid_get_textdomain()), the_title(' "', '"', false))); ?> <?php wp_link_pages(array('before' => '<p class="page-links pages">' . __('Pages:', hybrid_get_textdomain()), 'after' => '</p>')); ?> </div><!-- .entry-content --> <?php do_atomic('after_entry'); // hybrid_after_entry ?> </div><!-- .hentry --> <?php if (is_singular()) { ?> <?php
get_the_image(array('meta_key' => 'Thumbnail', 'size' => 'thumbnail')); } ?> <?php echo apply_atomic_shortcode('entry_title', '[entry-title]'); ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php echo apply_atomic_shortcode('entry_meta', '<div class="entry-meta">' . sprintf(__('[entry-published] — %s', hybrid_get_textdomain()), '<code><a href="' . get_permalink() . '">' . get_permalink() . '</a></code>') . '</div>'); ?> <?php do_atomic('close_entry'); // trending_close_entry ?> </div><!-- .hentry --> <?php do_atomic('after_entry'); // trending_after_entry ?> <?php
/** * Message to display for removed functions. * @since 0.5.0 */ function hybrid_function_removed($func = '') { die(sprintf(__('<code>%1$s</code> — This function has been removed or replaced by another function.', hybrid_get_textdomain()), $func)); }
</div><!-- #header --> <?php do_atomic('after_header'); // prototype_after_header ?> <?php get_template_part('menu', 'secondary'); // Loads the menu-secondary.php template. ?> <?php do_atomic('before_main'); // prototype_before_main ?> <div id="main"> <div class="wrap"> <?php do_atomic('open_main'); // prototype_open_main ?> <?php if (current_theme_supports('breadcrumb-trail')) { breadcrumb_trail(array('before' => __('You are here:', hybrid_get_textdomain()))); }