>>>> absolute_weaver_area_class <<<<<
function absolute_weaver_area_class( $area, $p_default = 'pad', $sides = '', $margin = '' ) {
$class = '';
$cols = absolute_weaver_getopt_default( $area . '_cols_int', 1 );
if ( $cols > 1 ) {
$l_smart = ' widget-smart-rm';
$m_smart = ' m-widget-smart-rm';
if ( absolute_weaver_getopt( $area . '_no_widget_margins' ) ) {
$l_smart = '';
$m_smart = '';
}
$l_class = 'widget-cols-' . $cols;
$m_class = ' m-widget-cols-2';
if ( absolute_weaver_getopt( '_' . $area . '_lw_cols_list' ) != '' ) {
$l_class = '';
$l_smart = '';
}
if ( absolute_weaver_getopt( '_' . $area . '_mw_cols_list' ) != '' ) {
$m_class = '';
$m_smart = '';
}
$class = $l_class . $l_smart . $m_class . $m_smart;
}
// top/bottom margin
// border
if ( absolute_weaver_getopt( $area . '_border' ) ) {
$class .= ' border';
}
// shadow
$val = absolute_weaver_getopt( $area . '_shadow' );
if ( $val && $val != '-0' ) {
$class .= ' shadow' . $val;
}
// rounded
$val = absolute_weaver_getopt( $area . '_rounded' );
if ( $val && $val != 'none' ) {
$class .= ' rounded' . $val;
}
// font-size
$val = absolute_weaver_getopt( $area . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= ' ' . $val;
}
// font-family
$val = absolute_weaver_getopt( $area . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= absolute_weaver_get_bold_italic( $area, 'bold' );
$class .= absolute_weaver_get_bold_italic( $area, 'italic' );
// hide
$val = absolute_weaver_getopt( $area . '_hide' );
if ( $val && $val != 'hide-none' ) {
$class .= ' ' . $val;
}
// align
$align = absolute_weaver_getopt_default( $area . '_align', 'float-left' );
if ( $align != 'float-left' ) {
if ( $align == 'center' ) {
$align = 'align-center';
}
$class .= ' ' . $align;
}
// eq height
if ( absolute_weaver_getopt( $area . '_eq_widgets' ) ) {
$class .= ' widget-eq';
}
// extend bg
if ( absolute_weaver_getopt( $area . '_extend_width' ) ) {
$class .= ' wvrx-fullwidth';
}
// expand area
if ( absolute_weaver_getopt_expand( 'expand_' . $area ) ) {
$class .= ' wvrx-expand-full';
} elseif ( ( $area == 'header' || $area == 'footer' ) && absolute_weaver_is_checked_page_opt( "_pp_{$area}_full" ) ) { // look for per page settings for header and footer
$class .= ' wvrx-expand-full';
}
// add classes
$val = absolute_weaver_getopt( $area . '_add_class' );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace( ',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim( $val );
}
// add classes
$val = absolute_weaver_get_per_page_value( "_pp_{$area}_add_class" );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace( ',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim( $val );
}
return trim( $class );
}
//--
// >>>>> absolute_weaver_get_bold_italic <<<<<
function absolute_weaver_get_bold_italic( $area, $which ) {
if ( $which == 'bold' ) {
$val = absolute_weaver_getopt( "{$area}_normal" ); // if have a normal, there won't be a 'bold'
if ( $val ) {
return " font-weight-normal";
}
$val = absolute_weaver_getopt( "{$area}_bold" );
if ( $val == 'on' ) {
return " font-bold";
} else {
return '';
}
}
$val = absolute_weaver_getopt( "{$area}_italic" );
if ( $val == 'on' ) {
return " font-italic";
}
return '';
}
// >>>>> absolute_weaver_area_div <<<<<
function absolute_weaver_area_div( $who, $x_class = '' ) {
$c_class = $who . ' ' . absolute_weaver_area_class( $who, 'not-pad', '', '' );
if ( $x_class ) {
$c_class .= ' ' . $x_class;
}
absolute_weaver_echo_sanitized_html( "\n" . '
' . "\n" );
}
//--
// >>>>> absolute_weaver_container_div <<<<<
function absolute_weaver_container_div( $who ) {
$full = ''; // handle parallax options
if ( $who == 'page' ) {
$fi_loc = absolute_weaver_get_per_page_value( '_pp_fi_location' );
if ( ! $fi_loc ) {
$fi_loc = absolute_weaver_getopt( 'page_fi_location' );
}
if ( strpos( $fi_loc, 'parallax' ) !== false ) // parallax
{
$full = 'wvrx-parallax ';
}
if ( strpos( $fi_loc, '-full' ) !== false ) // full parallax
{
$full .= 'wvrx-fullwidth ';
}
} elseif ( $who == 'single' ) {
$fi_loc = absolute_weaver_get_per_post_value( '_pp_post_fi_location' );
if ( ! $fi_loc ) {
$fi_loc = absolute_weaver_getopt( 'post_fi_location' );
}
if ( strpos( $fi_loc, 'parallax-full' ) !== false ) // full parallax
{
$full = 'wvrx-parallax wvrx-fullwidth ';
} elseif ( strpos( $fi_loc, 'parallax' ) !== false ) // full parallax
{
$full = 'wvrx-parallax ';
}
} elseif ( $who == 'page-builder' ) { // make the area full width, no padding/margins
$full = 'wvrx-expand-full container-expand ';
}
$class = 'class="container container-' . $who . " relative {$full}"
. absolute_weaver_area_class( 'container', 'not-pad', '', '' ) . '"';
absolute_weaver_echo_sanitized_html( "\n" . '
' . "\n" );
}
//--
// >>>>> absolute_weaver_content_class <<<<<
function absolute_weaver_content_class( $sb_layout, $who, $echo = true ) {
$c_class = absolute_weaver_area_class( 'content', 'pad', '-rbl', '' );
$smart = '';
if ( absolute_weaver_getopt( 'content_smartmargin' ) ) {
$smart = '-m';
}
$class = 'content ';
switch ( $sb_layout ) {
case 'right':
case 'right-top':
$l_content = 'l-content-rsb' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'left':
case 'left-top':
$l_content = 'l-content-lsb' . $smart;
$class .= $l_content . ' m-full s-full sb-float-right ' . $c_class;
break;
case 'split':
$l_content = 'l-content-ssb' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'split-top':
$l_content = 'l-content-ssbs' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'one-column':
$l_content = 'l-content' . $smart;
$class .= $l_content . ' ' . $c_class;
break;
}
$class = ' class="' . trim( $class ) . '"';
if ( $echo ) {
echo esc_attr( $class );
}
return $class;
}
//--
// >>>>> absolute_weaver_menu_class <<<<<
function absolute_weaver_menu_class( $who, $no_hide = false ) {
// for the main menu bar - submenus must be done via CSS...
$class = '';
// font-size
$val = absolute_weaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= $val;
}
// font-family
$val = absolute_weaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= absolute_weaver_get_bold_italic( $who, 'bold' );
$class .= absolute_weaver_get_bold_italic( $who, 'italic' );
// border
if ( absolute_weaver_getopt( $who . '_border' ) ) {
$class .= ' border';
}
// shadow
$val = absolute_weaver_getopt( $who . '_shadow' );
if ( $val && $val != '-0' ) {
$class .= ' shadow' . $val;
}
// rounded
$val = absolute_weaver_getopt( $who . '_rounded' );
if ( $val && $val != 'none' ) {
$class .= ' rounded' . $val;
}
if ( absolute_weaver_getopt( $who . '_extend_width' ) ) {
$class .= ' wvrx-fullwidth';
}
// hide - subject to override by [show_if]
$val = absolute_weaver_getopt( $who . '_hide' );
if ( $val && $val != 'hide-none' && ! $no_hide ) {
$class .= ' ' . $val;
}
// expand
// fullwidth
$wide = absolute_weaver_getopt( $who . '_align' ); // added V 4.0
if ( strpos( $wide, 'alignwide' ) !== false ) {
$class .= ' alignwide';
} elseif ( strpos( $wide, 'alignfull' ) !== false ) {
$class .= ' alignfull';
}
if ( absolute_weaver_getopt_expand( 'expand_' . $who ) ) {
$class .= ' wvrx-expand-full';
}
// add classes - !important - do these LAST so will override other classes
$val = absolute_weaver_getopt( $who . '_add_class' );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace( ',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim( $val );
}
return trim( $class );
}
//--
// >>>>> absolute_weaver_page_lead <<<<<
function absolute_weaver_page_lead( $who, $archive = false ) {
// common lead in for all pages with infobar and top widget area
$GLOBALS['absolute_weaver_page_who'] = $who;
$GLOBALS['absolute_weaver_page_is_archive'] = $archive;
get_header( $who );
if ( $who == 'woocommerce' ) {
$body_classes = get_body_class();
if ( in_array( 'single-product', $body_classes ) ) { // Single product page - treat as page
$sb_layout = absolute_weaver_sb_layout( $who );
} else { // Archive like page
$sb_layout = absolute_weaver_sb_layout_archive( $who );
}
} elseif ( $archive ) {
$sb_layout = absolute_weaver_sb_layout_archive( $who );
} else {
$sb_layout = absolute_weaver_sb_layout( $who );
}
absolute_weaver_container_div( $who ); // #container
if ( $who != 'page-builder' ) {
get_template_part( 'template-parts/infobar' );
}
absolute_weaver_sidebar_before( $sb_layout, $who ); // sidebars if top-stacking
do_action( 'absolute_weaver_per_page' );
absolute_weaver_echo_sanitized_html( '
" . "\n" );
return $sb_layout;
}
//--
// >>>>> absolute_weaver_page_tail <<<<<
function absolute_weaver_page_tail( $who, $sb_layout ) {
echo "\n
\n"; // do not clear:both!
absolute_weaver_sidebar_after( $sb_layout, $who ); // sidebars after content
echo "\n
\n";
get_footer( $who );
}
//--
// >>>>> absolute_weaver_title_class <<<<<
function absolute_weaver_title_class( $who, $class_only = false, $front = '' ) {
$class = $front;
// font-size
$val = absolute_weaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= ' ' . $val . '-title';
}
// font-family
$val = absolute_weaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= absolute_weaver_get_bold_italic( $who, 'bold' );
$class .= absolute_weaver_get_bold_italic( $who, 'italic' );
if ( $class ) {
return $class_only ? trim( $class ) : ' class="' . trim( $class ) . '"';
} else {
return '';
}
}
//--
// >>>>> absolute_weaver_text_class <<<<<
function absolute_weaver_text_class( $who, $class_only = true ) {
// 'title' option used for plain text
$class = '';
// font-size
$val = absolute_weaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= $val;
}
// font-family
$val = absolute_weaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= absolute_weaver_get_bold_italic( $who, 'bold' );
$class .= absolute_weaver_get_bold_italic( $who, 'italic' );
if ( $class ) {
return $class_only ? ' ' . trim( $class ) : ' class="' . trim( $class ) . '"';
} else {
return '';
}
}
//--
// ================================= sidebars ======================================
// >>>>> absolute_weaver_sb_layout <<<<<
function absolute_weaver_sb_layout( $who, $is_index = false ) {
// get sb layout for page-like content: 'layout_default', 'layout_page', 'layout_blog', 'layout_single'
//
// possible values: 'right', 'right-top', 'left', 'left-top', 'split', 'split-top', 'one-column'
$per_page = $is_index ? '' : absolute_weaver_get_per_page_value( '_pp_page_layout' );
if ( $who == '404' ) {
$who = 'search';
} // sigh - they are the same layout
if ( $who == 'page-builder' ) {
$who = 'page'; // page builder same as page
if ( $per_page == '' || $per_page == 'default' ) {
$per_page = 'one-column';
} // default to one-column for page-builder
}
$layout = ( $per_page ) ? $per_page : absolute_weaver_getopt_default( 'layout_' . $who, 'default' );
if ( $who == 'woocommerce' ) {
$layout = absolute_weaver_getopt( 'layout_page', 'default' );
}
if ( $layout == 'default' ) {
$layout = absolute_weaver_getopt( 'layout_default', 'right' );
}
return apply_filters( 'absolute_weaver_sb_layout', $layout, $who );
}
//--
// >>>>> absolute_weaver_sb_layout_archive <<<<<
function absolute_weaver_sb_layout_archive( $who ) {
// get sb layout for archive-like content: 'layout_default_archive', 'layout_archive', 'layout_category', 'layout_tag'
// 'layout_author', 'layout_search', 'layout_image'
// same possible values
if ( $who == '404' ) {
$who = 'search';
} // they are the same layout
$layout = absolute_weaver_getopt_default( 'layout_' . $who, 'default' );
if ( $layout == 'default' ) {
if ( $who == 'blog' ) {
$layout = absolute_weaver_getopt( 'layout_default' );
if ( ! $layout ) {
$layout = 'right';
} // fallback
} else {
$layout = absolute_weaver_getopt( 'layout_default_archive' );
if ( ! $layout ) {
$layout = 'one-column';
} // fallback
}
}
return apply_filters( 'absolute_weaver_sb_layout_archive', $layout, $who );
}
//---
// >>>>> absolute_weaver_sidebar_before <<<<<
function absolute_weaver_sidebar_before( $sb_layout, $who ) {
switch ( $sb_layout ) {
case 'right-top': // for "top" sidebars, emit the upper sidebar before the content
case 'split-top':
case 'left-top':
get_sidebar( $sb_layout );
break;
default:
break;
}
}
//--
// >>>>> absolute_weaver_sidebar_after <<<<<
function absolute_weaver_sidebar_after( $sb_layout, $who ) {
switch ( $sb_layout ) {
case 'right': // for non-top sidebars, both upper and lower get emitted here together
case 'left':
case 'split':
get_sidebar( $sb_layout );
break;
case 'right-top': // for "top" sidebars, only the lower one gets emitted here
get_sidebar( 'bottom' );
break;
case 'split-top':
get_sidebar( 'split-bottom' );
break;
case 'left-top':
get_sidebar( 'left-bottom' );
break;
default: // 'one-column'
break;
}
}
//--
function absolute_weaver_put_widgetarea( $area_name, $class = '', $area_class_name = '' ) {
$area = $area_name;
if ( isset( $GLOBALS['absolute_weaver_page_is_archive'] ) && ! $GLOBALS['absolute_weaver_page_is_archive'] && absolute_weaver_is_checked_page_opt( '_pp_' . $area_name ) ) {
return;
} // hide area option checked
unset( $GLOBALS['absolute_weaver_widget_number'] ); // clear for each widget
$GLOBALS['absolute_weaver_widget_number'] = false;
if ( $area_class_name ) {
$class .= ' widget-area-' . $area_class_name;
}
$class = ' ' . $class;
if ( is_active_sidebar( $area ) ) { /* add top and bottom widget areas */
ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */
$success = dynamic_sidebar( $area ); // assume dynamic_sidebar generates safe escaped html
$content = ob_get_clean();
if ( $success && $content ) {
?>
'primary',
'secondary-widget-area' => 'secondary',
'sitewide-top-widget-area' => 'top',
'page-top-widget-area' => 'top',
'postpages-widget-area' => 'top',
'blog-top-widget-area' => 'top',
'sitewide-bottom-widget-area' => 'bottom',
'page-bottom-widget-area' => 'bottom',
'blog-bottom-widget-area' => 'bottom',
'header-widget-area' => 'header_sb',
'footer-widget-area' => 'footer_sb',
'primary' => 'primary',
'secondary' => 'secondary',
'widget' => 'widget',
'header' => 'header_sb',
'footer' => 'footer_sb',
'top' => 'top',
'bottom' => 'bottom' // these to simplify [extra_widget_area]
);
$opt_name = 'widget'; // default styling option name: widget-xxx
$search_sb_id = $sb_id;
if ( absolute_weaver_t_get( 'use_widget_area' ) ) // map from replacement area or [extra_widget_area]
{
$search_sb_id = absolute_weaver_t_get( 'use_widget_area' );
}
foreach ( $area_map as $area => $opt ) { // need to find name to use for option values
if ( $search_sb_id == $area ) {
$opt_name = $opt;
break;
}
}
$cols = absolute_weaver_getopt( $opt_name . '_cols_int' );
if ( ! $cols || $cols < 1 ) {
$cols = 1;
}
if ( $cols > 8 ) {
$cols = 8;
} // sanity check
$show_evenodd = true;
if ( ! isset( $arr_registered_widgets[ $sb_id ] ) || ! is_array( $arr_registered_widgets[ $sb_id ] ) ) {
return $params;
}
if ( empty( $GLOBALS['absolute_weaver_widget_number'] ) || ! isset( $GLOBALS['absolute_weaver_widget_number'] ) || ! $GLOBALS['absolute_weaver_widget_number'] ) { // global to keep track of which widget this is
$GLOBALS['absolute_weaver_widget_number'] = array();
}
if ( isset( $GLOBALS['absolute_weaver_widget_number'][ $sb_id ] ) ) { // initialize or bump widget number
$GLOBALS['absolute_weaver_widget_number'][ $sb_id ] ++;
} else {
$GLOBALS['absolute_weaver_widget_number'][ $sb_id ] = 1;
}
$is_sidebar = in_array( $sb_id,
array( 'primary-widget-area', 'secondary-widget-area' ) ); // this is a vertical widget
$no_smart = absolute_weaver_getopt( $opt_name . '_no_widget_margins' );
$is_vert = ( $cols == 1 );
$per_row_tail = ( $is_vert || $no_smart ) ? ' ' : '-m ';
$class = '';
$sides = ( $is_sidebar ) ? '-b' : '-rb';
$cur_widget = $GLOBALS['absolute_weaver_widget_number'][ $sb_id ];
$widget_count = count( $arr_registered_widgets[ $sb_id ] );
$first = ( $cur_widget == 1 );
$last = ( $cur_widget == $widget_count );
$def_bottom = 'margin-bottom';
if ( $opt_name == 'header_sb' ) {
$def_bottom = 'no-margin-vertical ';
}
$area_class = absolute_weaver_area_class( 'widget', 'not-pad', $sides, $def_bottom ) . ' ';
if ( $area_class ) {
$class .= $area_class;
}
if ( ! $is_vert ) {
$class .= 'per-row-' . $cols . $per_row_tail;
$end_of_row = ( $cur_widget % $cols ) == 0;
if ( $widget_count > 1 && ! $end_of_row && ! $no_smart ) {
$class .= 'smart-rm ';
}
if ( $end_of_row ) {
$class .= 'end-of-row ';
}
if ( ( $cur_widget % $cols ) == 1 ) {
$class .= 'begin-of-row ';
}
}
$class .= 'widget-' . $GLOBALS['absolute_weaver_widget_number'][ $sb_id ] . ' ';
if ( $is_vert ) {
$widget_first = 'widget-first widget-first-vert ';
$widget_last = 'widget-last widget-last-vert ';
} else {
$widget_first = 'widget-first ';
$widget_last = 'widget-last ';
}
if ( $first ) {
$class .= $widget_first;
}
if ( $last ) {
$class .= $widget_last;
}
if ( $show_evenodd ) {
$widget_even = 'widget-even ';
$widget_odd = 'widget-odd ';
$class .= ( ( $cur_widget % 2 ) ? $widget_odd : $widget_even );
}
// need no-margin-bottom if $cols > 1
$params[0]['before_widget'] = str_replace( '">', ' ' . trim( $class ) . '">', $params[0]['before_widget'] );
$title_class = absolute_weaver_title_class( 'widget_title', true );
if ( $title_class ) {
$params[0]['before_title'] = str_replace( '">', ' ' . trim( $title_class ) . '">', $params[0]['before_title'] );
}
return $params;
}
//--
// >>>>> absolute_weaver_no_sidebars <<<<<
function absolute_weaver_no_sidebars( $class ) {
?>
>>>> absolute_weaver_has_widgetarea <<<<<
function absolute_weaver_has_widgetarea( $area_name ) {
// see if a widget area is available to show...
if ( isset( $GLOBALS['absolute_weaver_page_is_archive'] ) && ! $GLOBALS['absolute_weaver_page_is_archive'] && absolute_weaver_is_checked_page_opt( '_pp_' . $area_name ) ) {
return false; // hide area option checked
}
if ( is_active_sidebar( $area_name ) ) {
return true;
}
return false;
}
//--
?>