element attributes
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_header( $attr, $context ) {
if ( isset( $attr['class'] ) )
$class = $attr['class'];
$class .= ' header-layout-primary-' . hoot_get_mod( 'primary_menuarea' );
$class .= ' header-layout-secondary-' . hoot_get_mod( 'secondary_menu_location' );
$attr['class'] = $class;
return $attr;
}
/**
* Modify header part attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_header_part( $attr, $context ) {
$attr['id'] = 'header-' . $context;
$class = 'header-part';
if ( $context == 'primary' ) {
$class .= ' header-primary-' . hoot_get_mod( 'primary_menuarea' );
} elseif ( $context == 'supplementary' ) {
$class .= ' header-supplementary-' . hoot_get_mod( 'secondary_menu_location' );
$class .= ' header-supplementary-' . hoot_get_mod( 'secondary_menu_align' );
}
if ( isset( $attr['class'] ) )
$attr['class'] .= ' ' . $class;
else
$attr['class'] = $class;
return $attr;
}
/**
* Modify Main content container of the page attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_content( $attr ) {
$layout_class = hoot_main_layout_class( 'content' );
if ( !empty( $layout_class ) ) {
if ( isset( $attr['class'] ) )
$attr['class'] .= ' ' . $layout_class;
else
$attr['class'] = $layout_class;
}
return $attr;
}
/**
* Modify Sidebar attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_sidebar( $attr, $context ) {
if ( !empty( $context ) && ( $context == 'primary' || $context == 'secondary' ) ) {
$layout_class = hoot_main_layout_class( "sidebar" );
if ( !empty( $layout_class ) ) {
if ( isset( $attr['class'] ) )
$attr['class'] .= ' ' . $layout_class;
else
$attr['class'] = $layout_class;
}
}
return $attr;
}
/**
* Page wrapper attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_page_wrapper( $attr ) {
$attr['id'] = 'page-wrapper';
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
// Set site layout class
$site_layout = hoot_get_mod( 'site_layout' );
$attr['class'] .= ( $site_layout == 'boxed' ) ? ' grid site-boxed' : ' site-stretch';
$attr['class'] .= ' page-wrapper';
// Set sidebar layout class
global $hoot_theme;
if ( empty( $hoot_theme->currentlayout ) )
hoot_main_layout('');
if ( !empty( $hoot_theme->currentlayout['layout'] ) ) :
$attr['class'] .= ' sitewrap-'. $hoot_theme->currentlayout['layout'];
switch( $hoot_theme->currentlayout['layout'] ) {
case 'none' :
case 'full' :
case 'full-width' :
$attr['class'] .= ' sidebars0';
break;
case 'narrow-right' :
case 'wide-right' :
case 'narrow-left' :
case 'wide-left' :
$attr['class'] .= ' has-sidebar sidebars1';
break;
case 'narrow-left-left' :
case 'narrow-left-right' :
case 'narrow-right-left' :
case 'narrow-right-right' :
$attr['class'] .= ' has-sidebar sidebars2';
break;
}
endif;
return $attr;
}
/**
* Topbar attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_topbar( $attr ) {
$attr['id'] = 'topbar';
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
// Set site layout class
$attr['class'] .= ' topbar';
return $attr;
}
/**
* Main content container of the page attributes when a page template is being displayed
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_page_template_content( $attr, $context ) {
if ( is_page_template() && $context == 'none' ) {
$attr['id'] = 'content';
$attr['class'] = 'content no-sidebar layout-none';
$attr['role'] = 'main';
$attr['itemprop'] = 'mainContentOfPage';
$template_slug = basename( get_page_template(), '.php' );
$attr['class'] .= ' ' . sanitize_html_class( 'content-' . $template_slug );
} elseif ( function_exists( 'hoot_attr_content' ) ) {
// Get page attributes for main content container of a non-template regular page
$attr = apply_filters( "hoot_attr_content", $attr, $context );
}
return $attr;
}
/**
* Below Header attributes.
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_below_header( $attr ) {
$attr['id'] = 'below-header';
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
// Set site layout class
$attr['class'] .= ' below-header';
return $attr;
}
/**
* Widgetized Template Area
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_widgetized_template_area( $attr, $context ) {
$key = $context;
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
$module_bg = hoot_get_mod( "widgetized_template_sectionbg_{$key}-type", 'none' );
if ( $module_bg == 'image' ) {
$module_bg_img = hoot_get_mod( "widgetized_template_sectionbg_{$key}-image", '' );
if ( !empty( $module_bg_img ) ) {
$module_bg_parallax = hoot_get_mod( "widgetized_template_sectionbg_{$key}-parallax", 0 );
$attr['class'] .= ( $module_bg_parallax ) ? ' bg-fixed' : ' bg-scroll';
if ( $module_bg_parallax ) {
$attr['data-parallax'] = 'scroll';
// $attr['data-speed'] = '0.4'; // Default is 0.2 :: range [0-1]
$attr['data-image-src'] = esc_url($module_bg_img);
} else {
$attr['style'] = 'background-image:url(' . esc_attr($module_bg_img) . ');';
}
}
}
return $attr;
}
/**
* Content Block Image
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_content_block_img( $attr ) {
$attr['alt'] = __( 'Content Image', 'brigsby' );
$attr['itemprop'] = 'image';
return $attr;
}
/**
* Social Icons Widget - Icons
*
* @since 1.0
* @access public
* @param array $attr
* @param string $context
* @return array
*/
function hoot_theme_attr_social_icons_icon( $attr, $context ) {
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
$attr['class'] .= ' social-icons-icon';
if ( $context != 'fa-envelope' )
$attr['target'] = '_blank';
return $attr;
}
/**
* Page wrapper attributes for external plugins
*
* @since 1.0
* @access public
* @param array $attr
* @return array
*/
function hoot_theme_attr_page_wrapper_plugins( $attr ) {
$attr['class'] = ( empty( $attr['class'] ) ) ? '' : $attr['class'];
$classes = apply_filters( 'hoot_theme_attr_page_wrapper_plugins', array( 'hoot-cf7-style', 'hoot-mapp-style', 'hoot-jetpack-style' ) );
$classes = array_map( 'sanitize_html_class', $classes );
foreach ( $classes as $class ) {
$attr['class'] .= ' ' . $class;
}
return $attr;
}