tag in
* This function is for backward compatibility only. For WP version greater than 4.1, theme
* support for 'title-tag' is added in /hoot-theme/hoot-theme.php
*
* @since 2.0
* @access public
* @return void
*/
function chromaticfw_title_tag() {
echo "\n";
?>' . "\n";
}
}
/**
* Displays the branding logo
*
* @since 1.0
* @access public
* @return void
*/
function chromaticfw_logo() {
$display = '';
$chromaticfw_logo = chromaticfw_get_option( 'logo' );
if ( 'text' == $chromaticfw_logo ) {
$title_icon = chromaticfw_get_option( 'site_title_icon', NULL );
$class = ( $title_icon ) ? ' class="site-logo-with-icon"' : '';
$display .= '';
if ( $title_icon )
$title_icon = '';
$display .= chromaticfw_get_site_title( $title_icon );
if ( chromaticfw_get_option( 'show_tagline' ) )
$display .= chromaticfw_get_site_description();
$display .= '
';
} elseif ( 'image' == $chromaticfw_logo ) {
$display .= chromaticfw_get_logo_image();
}
echo apply_filters( 'chromaticfw_display_logo', $display );
}
/**
* Returns the image logo
*
* @since 1.0
* @access public
* @return void
*/
function chromaticfw_get_logo_image() {
$logo_image = chromaticfw_get_option( 'logo_image' );
$title = get_bloginfo( 'name' );
if ( !empty( $logo_image ) ) {
return '';
}
}
/**
* Display a friendly reminder to update outdated browser
*
* @since 2.0
* @access public
*/
function chromaticfw_update_browser() {
$notice = '';
echo apply_filters( 'chromaticfw_update_browser_notice', $notice );
}
/**
* Display the meta information HTML for single post/page
*
* @since 1.0
* @access public
* @param array $display information to display
* @return void
*/
function chromaticfw_meta_info_blocks( $display = array() ) {
$default_display = array(
'author' => true,
'date' => true,
'cats' => true,
'tags' => true,
'comments' => true,
);
$display = wp_parse_args( $display, $default_display );
if ( !is_singular() && !empty( $display['date'] ) ) : ?>
>
"attachment-$thumbnail_size $custom_class" ) );
}
/**
* Utility function to extract border class for widget based on user option.
*
* @since 1.0
* @access public
* @param string $val string value separated by spaces
* @param int $index index for value to extract from $val
* @prefix string $prefix prefixer for css class to return
* @return void
*/
function chromaticfw_widget_border_class( $val, $index=0, $prefix='' ) {
$val = explode( " ", trim( $val ) );
if ( isset( $val[ $index ] ) )
return $prefix . trim( $val[ $index ] );
else
return '';
}
/**
* Utility function to map footer sidebars structure to CSS span architecture.
*
* @since 1.0
* @access public
* @return void
*/
function chromaticfw_footer_structure() {
$footers = chromaticfw_get_option( 'footer' );
$structure = array(
'1-1' => array( 12, 12, 12, 12 ),
'2-1' => array( 6, 6, 12, 12 ),
'2-2' => array( 4, 8, 12, 12 ),
'2-3' => array( 8, 4, 12, 12 ),
'3-1' => array( 4, 4, 4, 12 ),
'3-2' => array( 6, 3, 3, 12 ),
'3-3' => array( 3, 6, 3, 12 ),
'3-4' => array( 3, 3, 6, 12 ),
'4-1' => array( 3, 3, 3, 3 ),
);
if ( isset( $structure[ $footers ] ) )
return $structure[ $footers ];
else
return array( 12, 12, 12, 12 );
}
/**
* Utility function to map 2 column widths to CSS span architecture.
*
* @since 1.0
* @access public
* @return void
*/
function chromaticfw_2_col_width_to_span( $col_width ) {
$return = array();
switch( $col_width ):
case '33-66':
$return[0] = 'grid-span-4';
$return[1] = 'grid-span-8';
break;
case '66-33':
$return[0] = 'grid-span-8';
$return[1] = 'grid-span-4';
break;
case '25-75':
$return[0] = 'grid-span-3';
$return[1] = 'grid-span-9';
break;
case '75-25':
$return[0] = 'grid-span-9';
$return[1] = 'grid-span-3';
break;
case '50-50': default:
$return[0] = $return[1] = 'grid-span-6';
endswitch;
return $return;
}
/**
* Wrapper function for chromaticfw_main_layout() to get the class names for current context.
* Can only be used after 'posts_selection' action hook i.e. in 'wp' hook or later.
*
* @since 2.0
* @access public
* @param string $context content|primary-sidebar|sidebar|sidebar-primary
* @return string
*/
function chromaticfw_main_layout_class( $context ) {
return chromaticfw_main_layout( $context, 'class' );
}
/**
* Utility function to return layout size or classes for the context.
* Can only be used after 'posts_selection' action hook i.e. in 'wp' hook or later.
*
* @since 1.0
* @access public
* @param string $context content|primary-sidebar|sidebar|sidebar-primary
* @param string $return class|size return class name or just the span size integer
* @return string
*/
function chromaticfw_main_layout( $context, $return = 'size' ) {
// Set layout
global $chromaticfw_theme;
if ( !isset( $chromaticfw_theme->currentlayout ) )
chromaticfw_set_main_layout();
$span_sidebar = $chromaticfw_theme->currentlayout['sidebar'];
$span_content = $chromaticfw_theme->currentlayout['content'];
// Return Class or Span Size for the Content/Sidebar
if ( $context == 'content' ) {
if ( $return == 'class' ) {
$extra_class = ( empty( $span_sidebar ) ) ? ' no-sidebar' : '';
return ' grid-span-' . $span_content . $extra_class . ' ';
} elseif ( $return == 'size' ) {
return intval( $span_content );
}
} elseif ( $context == 'primary-sidebar' || $context == 'sidebar' || $context == 'sidebar-primary' ) {
if ( $return == 'class' ) {
if ( !empty( $span_sidebar ) )
return ' grid-span-' . $span_sidebar . ' ';
else
return '';
} elseif ( $return == 'size' ) {
return intval( $span_sidebar );
}
}
return '';
}
/**
* Utility function to calculate and set main (content+aside) layout according to the sidebar layout
* set by user for the current view.
* Can only be used after 'posts_selection' action hook i.e. in 'wp' hook or later.
*
* @since 2.0
* @access public
*/
function chromaticfw_set_main_layout() {
if ( is_singular( 'post' ) ) {
// Apply Sidebar Layout for Posts
$sidebar = chromaticfw_get_option( 'sidebar_posts' );
} elseif ( is_page() ) {
if ( chromaticfw_is_404() )
// Apply 'Full Width' if this page is being displayed as a custom 404 page
$sidebar = 'none';
else
// Apply Sidebar Layout for Pages
$sidebar = chromaticfw_get_option( 'sidebar_pages' );
} elseif ( is_attachment() ) {
// Apply 'Full Width'
$sidebar = 'none';
} else {
// Apply Sidebar Layout for Site
$sidebar = chromaticfw_get_option( 'sidebar' );
}
/* Allow for custom manipulation of the layout by child themes */
$sidebar = apply_filters( 'chromaticfw_main_layout', $sidebar );
$spans = apply_filters( 'chromaticfw_main_layout_spans', array(
'none' => array(
'content' => 9,
'sidebar' => 0,
),
'narrow-right' => array(
'content' => 9,
'sidebar' => 3,
),
'wide-right' => array(
'content' => 8,
'sidebar' => 4,
),
'default' => array(
'content' => 8,
'sidebar' => 4,
),
) );
/* Finally, set the layout for current view */
global $chromaticfw_theme;
if ( isset( $spans[ $sidebar ] ) ) {
$chromaticfw_theme->currentlayout['content'] = $spans[ $sidebar ]['content'];
$chromaticfw_theme->currentlayout['sidebar'] = $spans[ $sidebar ]['sidebar'];
} else {
$chromaticfw_theme->currentlayout['content'] = $spans['default']['content'];
$chromaticfw_theme->currentlayout['sidebar'] = $spans['default']['sidebar'];
}
}