updated theme GeneratePress
version 3.0.2
This commit is contained in:
@ -9,160 +9,41 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Display HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_do_element_classes( $context, $class = '' ) {
|
||||
echo 'class="' . join( ' ', generate_get_element_classes( $context, $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
* @return array Array of classes.
|
||||
*/
|
||||
function generate_get_element_classes( $context, $class = '' ) {
|
||||
$classes = array();
|
||||
|
||||
if ( ! empty( $class ) ) {
|
||||
if ( ! is_array( $class ) ) {
|
||||
$class = preg_split( '#\s+#', $class );
|
||||
}
|
||||
|
||||
$classes = array_merge( $classes, $class );
|
||||
}
|
||||
|
||||
$classes = array_map( 'esc_attr', $classes );
|
||||
|
||||
return apply_filters( "generate_{$context}_class", $classes, $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any necessary microdata.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element to target.
|
||||
* @return string Our final attribute to add to the element.
|
||||
*/
|
||||
function generate_get_microdata( $context ) {
|
||||
$data = false;
|
||||
|
||||
if ( 'microdata' !== apply_filters( 'generate_schema_type', 'microdata' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'body' === $context ) {
|
||||
$type = 'WebPage';
|
||||
|
||||
if ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) {
|
||||
$type = 'Blog';
|
||||
}
|
||||
|
||||
if ( is_search() ) {
|
||||
$type = 'SearchResultsPage';
|
||||
}
|
||||
|
||||
$type = apply_filters( 'generate_body_itemtype', $type );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'header' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
|
||||
}
|
||||
|
||||
if ( 'navigation' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
|
||||
}
|
||||
|
||||
if ( 'article' === $context ) {
|
||||
$type = apply_filters( 'generate_article_itemtype', 'CreativeWork' );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'post-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-body' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/Comment" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'sidebar' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
|
||||
}
|
||||
|
||||
if ( $data ) {
|
||||
return apply_filters( "generate_{$context}_microdata", $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output our microdata for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param $context The element to target.
|
||||
* @return string The microdata.
|
||||
*/
|
||||
function generate_do_microdata( $context ) {
|
||||
echo generate_get_microdata( $context ); // WPCS: XSS ok, sanitization ok.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_body_classes' ) ) {
|
||||
add_filter( 'body_class', 'generate_body_classes' );
|
||||
/**
|
||||
* Adds custom classes to the array of body classes.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_body_classes( $classes ) {
|
||||
$sidebar_layout = generate_get_layout();
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
|
||||
$header_layout = generate_get_option( 'header_layout_setting' );
|
||||
$header_alignment = generate_get_option( 'header_alignment_setting' );
|
||||
$content_layout = generate_get_option( 'content_layout_setting' );
|
||||
$footer_widgets = generate_get_footer_widgets();
|
||||
$sidebar_layout = generate_get_layout();
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
|
||||
$header_alignment = generate_get_option( 'header_alignment_setting' );
|
||||
$content_layout = generate_get_option( 'content_layout_setting' );
|
||||
|
||||
// These values all have defaults, but we like to be extra careful.
|
||||
$classes[] = ( $sidebar_layout ) ? $sidebar_layout : 'right-sidebar';
|
||||
$classes[] = ( $navigation_location ) ? $navigation_location : 'nav-below-header';
|
||||
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
|
||||
$classes[] = ( $content_layout ) ? $content_layout : 'separate-containers';
|
||||
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$footer_widgets = generate_get_footer_widgets();
|
||||
$header_layout = generate_get_option( 'header_layout_setting' );
|
||||
|
||||
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
|
||||
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
|
||||
}
|
||||
|
||||
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
|
||||
$classes[] = 'nav-search-enabled';
|
||||
}
|
||||
|
||||
// Only necessary for nav before or after header.
|
||||
if ( 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
|
||||
if ( ! generate_is_using_flexbox() && 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
|
||||
if ( 'center' === $navigation_alignment ) {
|
||||
$classes[] = 'nav-aligned-center';
|
||||
} elseif ( 'right' === $navigation_alignment ) {
|
||||
@ -219,6 +100,7 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_top_bar_classes( $classes ) {
|
||||
@ -226,7 +108,10 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
|
||||
|
||||
if ( 'contained' === generate_get_option( 'top_bar_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
$classes[] = 'top-bar-align-' . esc_attr( generate_get_option( 'top_bar_alignment' ) );
|
||||
@ -240,33 +125,38 @@ if ( ! function_exists( 'generate_right_sidebar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the right sidebar.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_right_sidebar_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
|
||||
$classes[] = 'widget-area';
|
||||
$classes[] = 'grid-' . $right_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'sidebar';
|
||||
$classes[] = 'is-right-sidebar';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'both-left' :
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-' . $right_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'both-left':
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,39 +169,44 @@ if ( ! function_exists( 'generate_left_sidebar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the left sidebar.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_left_sidebar_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
$classes[] = 'widget-area';
|
||||
$classes[] = 'grid-' . $left_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'sidebar';
|
||||
$classes[] = 'is-left-sidebar';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'left-sidebar' :
|
||||
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
case 'both-sidebars' :
|
||||
case 'both-left' :
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-' . $left_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'left-sidebar':
|
||||
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-sidebars':
|
||||
case 'both-left':
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,62 +219,66 @@ if ( ! function_exists( 'generate_content_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the content container.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_content_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
$classes[] = 'content-area';
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
case 'right-sidebar' :
|
||||
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
|
||||
case 'left-sidebar' :
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
case 'no-sidebar' :
|
||||
$classes[] = 'grid-100';
|
||||
$classes[] = 'tablet-grid-100';
|
||||
break;
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
|
||||
case 'both-sidebars' :
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'right-sidebar':
|
||||
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-right' :
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'left-sidebar':
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-left' :
|
||||
$classes[] = 'push-' . $total_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'no-sidebar':
|
||||
$classes[] = 'grid-100';
|
||||
$classes[] = 'tablet-grid-100';
|
||||
break;
|
||||
|
||||
case 'both-sidebars':
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-right':
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-left':
|
||||
$classes[] = 'push-' . $total_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,6 +291,7 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_header_classes( $classes ) {
|
||||
@ -399,7 +299,14 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
|
||||
|
||||
if ( 'contained-header' === generate_get_option( 'header_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( generate_has_inline_mobile_toggle() ) {
|
||||
$classes[] = 'has-inline-mobile-toggle';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -411,6 +318,7 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to inside the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_inside_header_classes( $classes ) {
|
||||
@ -418,7 +326,10 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'header_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -430,29 +341,65 @@ if ( ! function_exists( 'generate_navigation_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the navigation.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_navigation_classes( $classes ) {
|
||||
$classes[] = 'main-navigation';
|
||||
|
||||
if ( 'contained-nav' === generate_get_option( 'nav_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
|
||||
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
|
||||
$nav_layout = generate_get_option( 'nav_position_setting' );
|
||||
|
||||
switch ( $nav_layout ) {
|
||||
case 'nav-below-header':
|
||||
case 'nav-above-header':
|
||||
case 'nav-float-right':
|
||||
case 'nav-float-left':
|
||||
$classes[] = 'sub-menu-left';
|
||||
break;
|
||||
if ( 'nav-float-right' !== $navigation_location && 'nav-float-left' !== $navigation_location ) {
|
||||
$classes[] = 'grid-container';
|
||||
}
|
||||
} else {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$nav_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
|
||||
if ( 'center' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-center';
|
||||
} elseif ( 'right' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-right';
|
||||
} elseif ( is_rtl() && 'left' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-left';
|
||||
}
|
||||
|
||||
if ( generate_has_menu_bar_items() ) {
|
||||
$classes[] = 'has-menu-bar-items';
|
||||
}
|
||||
}
|
||||
|
||||
$submenu_direction = 'right';
|
||||
|
||||
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
|
||||
$submenu_direction = 'left';
|
||||
}
|
||||
|
||||
if ( 'nav-left-sidebar' === generate_get_navigation_location() ) {
|
||||
$submenu_direction = 'right';
|
||||
|
||||
if ( 'both-right' === generate_get_layout() ) {
|
||||
$submenu_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'nav-right-sidebar' === generate_get_navigation_location() ) {
|
||||
$submenu_direction = 'left';
|
||||
|
||||
if ( 'both-left' === generate_get_layout() ) {
|
||||
$submenu_direction = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
$classes[] = 'sub-menu-' . $submenu_direction;
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
@ -462,6 +409,7 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the inner navigation.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_inside_navigation_classes( $classes ) {
|
||||
@ -469,7 +417,10 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'nav_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -481,6 +432,7 @@ if ( ! function_exists( 'generate_menu_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the menu.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_menu_classes( $classes ) {
|
||||
@ -496,6 +448,7 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the footer.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_footer_classes( $classes ) {
|
||||
@ -503,7 +456,10 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
|
||||
|
||||
if ( 'contained-footer' === generate_get_option( 'footer_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_active_sidebar( 'footer-bar' ) ) {
|
||||
@ -520,6 +476,7 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the footer.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_inside_footer_classes( $classes ) {
|
||||
@ -527,7 +484,10 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -538,6 +498,8 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
|
||||
add_filter( 'generate_main_class', 'generate_main_classes' );
|
||||
/**
|
||||
* Adds custom classes to the <main> element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function generate_main_classes( $classes ) {
|
||||
@ -547,16 +509,57 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_page_class', 'generate_do_page_container_classes' );
|
||||
/**
|
||||
* Adds custom classes to the #page element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_page_container_classes( $classes ) {
|
||||
$classes[] = 'site';
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'container';
|
||||
|
||||
if ( generate_is_using_hatom() ) {
|
||||
$classes[] = 'hfeed';
|
||||
}
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter( 'generate_comment-author_class', 'generate_do_comment_author_classes' );
|
||||
/**
|
||||
* Adds custom classes to the comment author element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_comment_author_classes( $classes ) {
|
||||
$classes[] = 'comment-author';
|
||||
|
||||
if ( generate_is_using_hatom() ) {
|
||||
$classes[] = 'vcard';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_post_classes' ) ) {
|
||||
add_filter( 'post_class', 'generate_post_classes' );
|
||||
/**
|
||||
* Adds custom classes to the <article> element.
|
||||
* Remove .hentry class from pages to comply with structural data guidelines.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.3.39
|
||||
*/
|
||||
function generate_post_classes( $classes ) {
|
||||
if ( 'page' == get_post_type() ) {
|
||||
if ( 'page' === get_post_type() || ! generate_is_using_hatom() ) {
|
||||
$classes = array_diff( $classes, array( 'hentry' ) );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user