__( 'Top Bar Menu', '1io' ),
'header' => __( 'Header Menu', '1io' ),
'footer' => __( 'Footer Menu', '1io' ),
);
if ( $location && isset( $locations[ $location ] ) ) {
return $locations[ $location ];
}
return $locations;
}
/**
* Enqueues theme styles and scripts.
*
* @since 1.0
* @return void
*/
static public function enqueue_scripts() {
// Fonts
switch ( self::get_setting( 'fl-awesome' ) ) {
case 'fa5':
self::enqueue_fontawesome();
break;
case 'fa4':
self::enqueue_fontawesome_legacy();
break;
}
// jQuery
wp_enqueue_script( 'jquery-throttle', FL_THEME_URL . '/js/jquery.throttle.min.js', array( 'jquery' ), FL_THEME_VERSION, true );
if ( 'fadein' != self::get_setting( 'fl-fixed-header' ) ) {
global $wp_version;
if ( version_compare( $wp_version, '4.6', '<' ) ) {
wp_register_script( 'imagesloaded', FL_THEME_URL . '/js/jquery.imagesloaded.min.js', array( 'jquery' ), FL_THEME_VERSION, true );
}
wp_enqueue_script( 'imagesloaded' );
}
// Lightbox
if ( self::get_setting( 'fl-lightbox' ) == 'enabled' ) {
wp_enqueue_style( 'jquery-magnificpopup', FL_THEME_URL . '/css/jquery.magnificpopup.css', array(), FL_THEME_VERSION );
wp_enqueue_script( 'jquery-magnificpopup', FL_THEME_URL . '/js/jquery.magnificpopup.min.js', array(), FL_THEME_VERSION, true );
}
// FitVids
$body_classes = get_body_class();
if ( ! in_array( '1io', $body_classes ) ) {
wp_enqueue_script( 'jquery-fitvids', FL_THEME_URL . '/js/jquery.fitvids.js', array(), FL_THEME_VERSION, true );
}
// Threaded Comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Preview JS
if ( FLCustomizer::is_preset_preview() ) {
wp_enqueue_script( '1io-preview', FL_THEME_URL . '/js/preview.js', array(), FL_THEME_VERSION, true );
wp_localize_script( '1io-preview', 'preview', array(
'preset' => $_GET['fl-preview'],
) );
}
// Layout Framework
FLLayout::enqueue_framework();
// Core theme JS
wp_enqueue_script( '1io', FL_THEME_URL . '/js/theme' . ( self::is_debug() ? '' : '.min' ) . '.js', array(), FL_THEME_VERSION, true );
/**
* JS Options for breakpoints
* @see fl_theme_breakpoint_opts
*/
wp_localize_script( '1io', 'themeopts', self::get_theme_breakpoints() );
// Skin
if ( 'file' == FLTheme::get_asset_enqueue_method() ) {
wp_enqueue_style( '1io-skin', FLCustomizer::css_url(), array(), FL_THEME_VERSION );
} else {
wp_enqueue_style( 'bb-theme-style', get_stylesheet_uri() );
wp_add_inline_style( 'bb-theme-style', self::get_cached_css( true == FLCustomizer::is_customizer_preview() ? 'customizer' : 'skin' ) );
}
// RTL Support
if ( is_rtl() ) {
wp_enqueue_style( '1io-rtl', FL_THEME_URL . '/css/rtl.css', array(), FL_THEME_VERSION );
}
}
/**
* Return array of theme breakpoints
* @since 1.7.3
*/
static public function get_theme_breakpoints() {
$args = array(
'medium_breakpoint' => get_theme_mod( 'fl-medium-breakpoint' ) ? get_theme_mod( 'fl-medium-breakpoint' ) : 992,
'mobile_breakpoint' => get_theme_mod( 'fl-mobile-breakpoint' ) ? get_theme_mod( 'fl-mobile-breakpoint' ) : 768,
);
return apply_filters( 'fl_theme_breakpoint_opts', $args );
}
/**
* Fetch CSS from cache
* @since 1.7
*/
static public function get_cached_css( $slug ) {
$css = get_option( 'fl-theme-' . $slug );
return $css ? $css : FLCustomizer::refresh_css();
}
/**
* Save CSS to cache
* @since 1.7
*/
static public function update_cached_css( $slug, $css ) {
update_option( 'fl-theme-' . $slug, $css );
}
/**
* Determine cache method.
* @since 1.7
*/
static public function get_asset_enqueue_method() {
if ( class_exists( 'FLBuilderModel' ) && method_exists( 'FLBuilderModel', 'get_asset_enqueue_method' ) ) {
$method = FLBuilderModel::get_asset_enqueue_method();
} else {
$method = 'file';
}
return $method;
}
/**
* Enqueues Font Awesome 5.
*
* @since 1.7
* @return void
*/
static public function enqueue_fontawesome() {
if ( class_exists( 'FLBuilder' ) && method_exists( 'FLBuilder', 'get_fa5_url' ) ) {
wp_enqueue_style( 'font-awesome-5' );
} else {
$url = self::$fa5_url;
wp_enqueue_style( 'font-awesome-5', $url, array(), FL_THEME_VERSION );
}
}
/**
* Enqueues Font Awesome 5.
*
* @since 1.7
* @return void
*/
static public function enqueue_fontawesome_legacy() {
if ( class_exists( 'FLBuilder' ) && method_exists( 'FLBuilder', 'get_fa5_url' ) ) {
if ( isset( FLBuilder::$fa4_url ) && '' == FLBuilder::$fa4_url ) {
wp_enqueue_style( 'font-awesome' );
return;
}
}
wp_enqueue_style( 'font-awesome', self::$fa4_url, array(), FL_THEME_VERSION );
}
/**
* Initializes theme sidebars.
*
* @since 1.0
* @return void
*/
static public function widgets_init() {
$footer_widgets_display = self::get_setting( 'fl-footer-widgets-display' );
$woo_layout = self::get_setting( 'fl-woo-layout' );
// Primary Sidebar
register_sidebar(array(
'name' => __( 'Primary Sidebar', '1io' ),
'id' => 'blog-sidebar',
'before_widget' => '',
'before_title' => '
',
));
// Footer Widgets
if ( 'disabled' != $footer_widgets_display ) {
register_sidebars( 4, array(
/* translators: %d: order number of the auto-created sidebar */
'name' => _x( 'Footer Column %d', 'Sidebar title. %d stands for the order number of the auto-created sidebar, 4 in total.', '1io' ),
'id' => 'footer-col',
'before_widget' => '',
'before_title' => '',
) );
}
// WooCommerce Sidebar
if ( 'no-sidebar' != $woo_layout && self::is_plugin_active( 'woocommerce' ) ) {
register_sidebar( array(
'name' => __( 'WooCommerce Sidebar', '1io' ),
'id' => 'woo-sidebar',
'before_widget' => '',
'before_title' => '',
) );
}
// After Post Widget
register_sidebar( array(
'name' => __( 'After Post Widget', '1io' ),
'id' => 'after-post-widget',
'before_widget' => '',
'before_title' => '',
) );
}
/**
* Renders the favicon tags.
*
* @since 1.0
* @since 1.3.1.3 Only show the deprecated favicon if we don't have a core Site Icon saved.
* @return void
*/
static public function favicon() {
if ( false === get_option( 'site_icon', false ) ) {
$favicon = self::get_setting( 'fl-favicon' );
$apple = self::get_setting( 'fl-apple-touch-icon' );
if ( ! empty( $favicon ) ) {
echo ' ' . "\n";
}
if ( ! empty( $apple ) ) {
echo ' ' . "\n";
}
}
}
/**
* Adds and renders the tags for fonts.
*
* @since 1.0
* @return void
*/
static public function fonts() {
$settings = self::get_settings();
self::add_font( $settings['fl-body-font-family'], apply_filters( 'fl_body_font_family', array( 300, 400, 700 ) ) );
self::add_font( $settings['fl-heading-font-family'], $settings['fl-heading-font-weight'] );
self::add_font( $settings['fl-title-font-family'], $settings['fl-title-font-weight'] );
self::add_font( $settings['fl-nav-font-family'], $settings['fl-nav-font-weight'] );
self::add_font( $settings['fl-button-font-family'], $settings['fl-button-font-weight'] );
if ( 'text' == $settings['fl-logo-type'] ) {
self::add_font( $settings['fl-logo-font-family'], $settings['fl-logo-font-weight'] );
}
self::render_fonts();
}
/**
* Adds data to the $fonts array for a font to be rendered.
*
* @since 1.0
* @param string $name The name key of the font to add.
* @param array $variants An array of weight variants.
* @return void
*/
static public function add_font( $name, $variants = array() ) {
$google_fonts_domain = apply_filters( 'fl_theme_google_fonts_domain', 'https://fonts.googleapis.com/' );
$google_url = $google_fonts_domain . 'css?family=';
if ( isset( self::$fonts[ $name ] ) ) {
foreach ( (array) $variants as $variant ) {
if ( ! in_array( $variant, self::$fonts[ $name ]['variants'] ) ) {
self::$fonts[ $name ]['variants'][] = $variant;
}
}
} else {
$google = FLFontFamilies::get_google();
self::$fonts[ $name ] = array(
'url' => isset( $google[ $name ] ) ? $google_url . $name : '',
'variants' => (array) $variants,
);
}
}
/**
* Renders the tag for all fonts in the $fonts array.
*
* @since 1.0
* @since 1.5.3 Changed the rendering of fonts from echoing to wp_enqueue_style
* @return void
*/
static public function render_fonts() {
foreach ( self::$fonts as $name => $font ) {
if ( ! empty( $font['url'] ) ) {
$subset = apply_filters( 'fl_font_subset', '', $name );
$google_font_url = $font['url'] . ':' . implode( ',', $font['variants'] ) . $subset;
wp_enqueue_style( 'fl-builder-google-fonts-' . md5( $google_font_url ), $google_font_url, array() );
}
}
}
/**
* Renders the tags for theme CSS and any custom head code.
*
* @since 1.0
* @return void
*/
static public function head() {
$settings = self::get_settings();
// CSS
if ( isset( $settings['fl-css-code'] ) && ( ! empty( $settings['fl-css-code'] ) || FLCustomizer::is_customizer_preview() ) ) {
echo '' . "\n";
}
// JS
if ( ! empty( $settings['fl-js-code'] ) ) {
echo '' . "\n";
}
// Head
if ( ! empty( $settings['fl-head-code'] ) ) {
echo $settings['fl-head-code'] . "\n";
}
do_action( 'fl_head' );
}
/**
* Adds custom CSS classes to the tag.
* Called by the body_class filter.
*
* @since 1.0
* @param array $classes An array of the existing classes.
* @return array
*/
static public function body_class( $classes ) {
$preset = self::get_setting( 'fl-preset' );
$header_enabled = apply_filters( 'fl_header_enabled', true );
// Preset
if ( empty( $preset ) ) {
$classes[] = 'fl-preset-default';
} else {
$classes[] = 'fl-preset-' . $preset;
}
// Width
if ( self::get_setting( 'fl-layout-width' ) == 'full-width' ) {
$classes[] = 'fl-full-width';
} else {
$classes[] = 'fl-fixed-width';
}
// Header classes
if ( $header_enabled ) {
// Nav Vertical Left
if ( self::get_setting( 'fl-header-layout' ) == 'vertical-left' ) {
$classes[] = 'fl-nav-vertical fl-nav-vertical-left';
}
// Nav Vertical Right
if ( self::get_setting( 'fl-header-layout' ) == 'vertical-right' ) {
$classes[] = 'fl-nav-vertical fl-nav-vertical-right';
}
// Nav Left
if ( self::get_setting( 'fl-header-layout' ) == 'left' ) {
$classes[] = 'fl-nav-left';
}
// Responsive Nav Layout (Offcanvas)
if ( self::get_setting( 'fl-nav-mobile-layout' ) != 'dropdown' ) {
$nav_layout = self::get_setting( 'fl-nav-mobile-layout' );
$nav_layout_position = self::get_setting( 'fl-nav-mobile-layout-position' );
$classes[] = 'fl-nav-mobile-offcanvas fl-offcanvas-' . $nav_layout . '-' . $nav_layout_position;
}
// Shrink Fixed Header
if ( ( self::get_setting( 'fl-fixed-header' ) == 'shrink' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-left' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-right' ) ) {
$classes[] = 'fl-shrink';
}
// Fixed Header
if ( ( self::get_setting( 'fl-fixed-header' ) == 'fixed' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-left' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-right' ) ) {
$classes[] = 'fl-fixed-header';
}
// Hide Header Until Scroll
if ( ( self::get_setting( 'fl-hide-until-scroll-header' ) == 'enable' ) && ( self::get_setting( 'fl-fixed-header' ) == 'hidden' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-left' ) && ( self::get_setting( 'fl-header-layout' ) != 'vertical-right' ) ) {
$classes[] = 'fl-fixed-header';
$classes[] = 'fl-scroll-header';
}
}
// Footer Parallax Effect
if ( ( self::get_setting( 'fl-footer-parallax-effect' ) == 'enable' ) && ( self::get_setting( 'fl-layout-width' ) == 'full-width' ) ) {
$classes[] = 'fl-footer-effect';
}
// Scroll To Top Button
if ( self::get_setting( 'fl-scroll-to-top' ) == 'enable' ) {
$classes[] = 'fl-scroll-to-top';
}
// Search Active
if ( self::get_setting( 'fl-header-nav-search' ) == 'visible' ) {
$classes[] = 'fl-search-active';
}
// WooCommerce Columns
if ( class_exists( 'woocommerce' ) && is_woocommerce() ) {
$fl_woo_columns = self::get_setting( 'fl-woo-columns' );
$classes[] = 'woo-' . $fl_woo_columns;
}
// Submenu Indicator
if ( self::get_setting( 'fl-nav-submenu-indicator' ) == 'enable' ) {
FLTheme::enqueue_fontawesome();
$classes[] = 'fl-submenu-indicator';
}
// Submenu Toggle
if ( self::get_setting( 'fl-nav-submenu-toggle' ) == 'enable' ) {
$classes[] = 'fl-submenu-toggle';
}
// Responsive collapse menu items
if ( self::get_setting( 'fl-nav-collapse-menu' ) == '1' ) {
$classes[] = 'fl-nav-collapse-menu';
}
// Gutenberg support.
// If this is a vanilla Gutenberg page and it has blocks add has-blocks class.
if ( is_singular() && function_exists( 'has_block' ) && has_blocks() && ! has_block( 'fl-builder/layout' ) ) {
$classes[] = 'has-blocks';
}
return $classes;
}
/**
* Renders the markup for the top bar's first column.
*
* @since 1.0
* @return void
*/
static public function top_bar_col1() {
$settings = self::get_settings();
$layout = $settings['fl-topbar-layout'];
$col_layout = $settings['fl-topbar-col1-layout'];
$col_text = $settings['fl-topbar-col1-text'];
include locate_template( 'includes/top-bar-col1.php' );
}
/**
* Renders the markup for the top bar's second column.
*
* @since 1.0
* @return void
*/
static public function top_bar_col2() {
$settings = self::get_settings();
$layout = $settings['fl-topbar-layout'];
$col_layout = $settings['fl-topbar-col2-layout'];
$col_text = $settings['fl-topbar-col2-text'];
include locate_template( 'includes/top-bar-col2.php' );
}
/**
* Renders the markup for the top bar.
*
* @since 1.0
* @return void
*/
static public function top_bar() {
$top_bar_layout = self::get_setting( 'fl-topbar-layout' );
$top_bar_enabled = apply_filters( 'fl_topbar_enabled', true );
if ( 'none' != $top_bar_layout && $top_bar_enabled ) {
get_template_part( 'includes/top-bar' );
}
}
/**
* Renders the custom code that is displayed before the page header.
*
* @since 1.0
* @return void
*/
static public function header_code() {
echo self::get_setting( 'fl-header-code' );
}
/**
* Renders the markup for the fixed header.
*
* @since 1.0
* @return void
*/
static public function fixed_header() {
$header_layout = self::get_setting( 'fl-fixed-header' );
$nav_layout = self::get_setting( 'fl-header-layout' );
$header_enabled = apply_filters( 'fl_fixed_header_enabled', true );
if ( 'fadein' == $header_layout && $header_enabled && 'vertical-left' != $nav_layout && 'vertical-right' != $nav_layout ) {
get_template_part( 'includes/fixed-header' );
}
}
/**
* Renders the fixed header logo if one exists.
* Otherwise, falls back to the standard logo.
*
* @since 1.6.5
* @return void
*/
static public function fixed_header_logo() {
$logo_type = self::get_setting( 'fl-logo-type' );
$sticky_logo = self::get_setting( 'fl-sticky-header-logo' );
$sticky_retina = self::get_setting( 'fl-sticky-header-logo-retina' );
$header_fixed = self::get_setting( 'fl-fixed-header' );
if ( $sticky_logo && 'fadein' == $header_fixed && 'image' == $logo_type ) {
$logo_text = apply_filters( 'fl_logo_text', get_bloginfo( 'name' ) );
echo ' ';
echo ' ';
} else {
self::logo();
}
}
/**
* Renders the markup for the main header.
*
* @since 1.0
* @return void
*/
static public function header_layout() {
$header_layout = self::get_setting( 'fl-header-layout' );
$header_enabled = apply_filters( 'fl_header_enabled', true );
if ( 'none' != $header_layout && $header_enabled ) {
get_template_part( 'includes/nav-' . $header_layout );
}
}
/**
* Renders additional classes for the main header based on the
* selected header layout and mobile nav toggle.
*
* @since 1.3.1
* @return void
*/
static public function header_classes() {
$header_layout = self::get_setting( 'fl-header-layout' );
$nav_toggle_type = self::get_setting( 'fl-mobile-nav-toggle' );
$nav_breakpoint = self::get_setting( 'fl-nav-breakpoint' );
echo ' fl-page-nav-' . $header_layout;
echo ' fl-page-nav-toggle-' . $nav_toggle_type;
echo ' fl-page-nav-toggle-visible-' . $nav_breakpoint;
}
/**
* Renders additional data attributes for the main header
*
* @since 1.5
* @return void
*/
static public function header_data_attrs() {
// Scroll Distance
if ( self::get_setting( 'fl-hide-until-scroll-header' ) == 'enable' ) {
$scroll_distance = self::get_setting( 'fl-scroll-distance' );
echo ' data-fl-distance=' . $scroll_distance;
}
}
/**
* Renders the markup for the header content section.
*
* @since 1.0
* @return void
*/
static public function header_content() {
$settings = self::get_settings();
$layout = $settings['fl-header-content-layout'];
$text = $settings['fl-header-content-text'];
do_action( 'fl_header_content_open' );
if ( 'text' == $layout || 'social-text' == $layout ) {
echo '';
}
if ( 'social' == $layout || 'social-text' == $layout ) {
self::social_icons();
}
do_action( 'fl_header_content_close' );
}
/**
* Renders the header logo text or image.
*
* @since 1.0
* @deprecated 1.6.3 Use 'fl_logo_text' instead
* @return void
*/
static public function logo() {
$logo_type = self::get_setting( 'fl-logo-type' );
$logo_image = self::get_setting( 'fl-logo-image' );
$logo_retina = self::get_setting( 'fl-logo-image-retina' );
$mobile_logo = self::get_setting( 'fl-mobile-header-logo' );
if ( function_exists( 'apply_filters_deprecated' ) ) {
$logo_text = apply_filters_deprecated( 'fl-logo-text', array( self::get_setting( 'fl-logo-text' ) ), '1.6.3', 'fl_logo_text' );
} else {
$logo_text = apply_filters( 'fl-logo-text', self::get_setting( 'fl-logo-text' ) ); // @codingStandardsIgnoreLine
}
if ( 'image' == $logo_type ) {
$logo_text = apply_filters( 'fl_logo_text', get_bloginfo( 'name' ) );
echo ' ';
echo ' ';
} else {
echo '' . do_shortcode( $logo_text ) . '
';
}
}
/**
* Get the WP tagline.
* @return string
* @since 1.7
*/
static public function get_tagline() {
if ( self::get_setting( 'fl-theme-tagline' ) ) {
return '' . get_bloginfo( 'description' ) . '
';
}
}
/**
* Callback method for the nav menu fallback when no menu
* has been selected.
*
* @since 1.0
* @param array $args An array of args for the menu.
* @return void
*/
static public function nav_menu_fallback( $args ) {
$url = current_user_can( 'edit_theme_options' ) ? admin_url( 'nav-menus.php' ) : esc_url( home_url( '/' ) );
$url = apply_filters( 'fl_nav_menu_fallback_url', $url );
$text = current_user_can( 'edit_theme_options' ) ? __( 'Choose Menu', '1io' ) : __( 'Home', '1io' );
echo '';
}
/**
* Renders the nav search icon and form.
*
* @since 1.0
* @return void
*/
static public function nav_search() {
$nav_search = self::get_setting( 'fl-header-nav-search' );
if ( 'visible' == $nav_search ) {
FLTheme::enqueue_fontawesome();
get_template_part( 'includes/nav-search' );
}
}
/**
* Renders the text for the mobile nav toggle button.
*
* @since 1.0
* @return void
*/
static public function nav_toggle_text() {
$type = self::get_setting( 'fl-mobile-nav-toggle' );
$menu = self::get_setting( 'fl-mobile-nav-text' );
if ( 'icon' == $type ) {
FLTheme::enqueue_fontawesome();
$text = ' ';
} else {
$text = '' != $menu ? $menu : _x( 'Menu', 'Mobile navigation toggle button text.', '1io' );
}
echo apply_filters( 'fl_nav_toggle_text', $text );
}
/**
* Renders a group of social icons whose URL has been set in the Customizer.
*
* @since 1.0
* @param bool $circle Whether to use circle icons or not.
* @return void
*/
static public function social_icons( $circle = true ) {
$settings = self::get_settings();
$icons = apply_filters( 'fl_social_icons', array(
'facebook',
'twitter',
'google',
'snapchat',
'linkedin',
'yelp',
'xing',
'pinterest',
'tumblr',
'vimeo',
'youtube',
'flickr',
'instagram',
'skype',
'dribbble',
'500px',
'blogger',
'github',
'rss',
'email',
) );
FLTheme::enqueue_fontawesome();
include locate_template( 'includes/social-icons.php' );
}
/**
* Checks to see if the footer widgets and footer sections
* are enabled.
*
* @since 1.0
* @return bool
*/
static public function has_footer() {
$footer_layout = self::get_setting( 'fl-footer-layout' );
$footer_enabled = apply_filters( 'fl_footer_enabled', true );
return $footer_enabled && ( self::has_footer_widgets() || 'none' != $footer_layout );
}
/**
* Renders the footer widgets section.
*
* @since 1.0
* @return void
*/
static public function footer_widgets() {
if ( self::has_footer_widgets() ) {
get_template_part( 'includes/footer-widgets' );
}
}
/**
* Checks to see if any footer widgets exist.
*
* @since 1.0
* @return bool
*/
static public function has_footer_widgets() {
$show = self::get_setting( 'fl-footer-widgets-display' );
if ( 'disabled' == $show || ( ! is_front_page() && 'home' == $show ) ) {
return false;
}
for ( $i = 1; $i <= 4; $i++ ) {
$id = 1 == $i ? 'footer-col' : 'footer-col-' . $i;
if ( is_active_sidebar( $id ) ) {
return true;
}
}
return false;
}
/**
* Renders the columns and widgets for the footer widgets section.
*
* @since 1.0
* @return void
*/
static public function display_footer_widgets() {
$active = array();
$num_active = 0;
for ( $i = 1; $i <= 4; $i++ ) {
$id = 1 == $i ? 'footer-col' : 'footer-col-' . $i;
if ( is_active_sidebar( $id ) ) {
$active[] = $id;
$num_active++;
}
}
if ( $num_active > 0 ) {
$col_length = 12 / $num_active;
for ( $i = 0; $i < $num_active; $i++ ) {
$sm_class = FLLayout::get_col_class( 'sm', $col_length );
$md_class = FLLayout::get_col_class( 'md', $col_length );
echo '';
dynamic_sidebar( $active[ $i ] );
echo '
';
}
}
}
/**
* Renders the footer.
*
* @since 1.0
* @return void
*/
static public function footer() {
$footer_layout = self::get_setting( 'fl-footer-layout' );
if ( 'none' != $footer_layout ) {
get_template_part( 'includes/footer' );
}
}
/**
* Renders the footer's first column.
*
* @since 1.0
* @return void
*/
static public function footer_col1() {
$settings = self::get_settings();
$layout = $settings['fl-footer-layout'];
$col_layout = $settings['fl-footer-col1-layout'];
$col_text = $settings['fl-footer-col1-text'];
include locate_template( 'includes/footer-col1.php' );
}
/**
* Renders the footer's second column.
*
* @since 1.0
* @return void
*/
static public function footer_col2() {
$settings = self::get_settings();
$layout = $settings['fl-footer-layout'];
$col_layout = $settings['fl-footer-col2-layout'];
$col_text = $settings['fl-footer-col2-text'];
include locate_template( 'includes/footer-col2.php' );
}
/**
* Renders custom code that is displayed after the footer.
*
* @since 1.0
* @return void
*/
static public function footer_code() {
echo self::get_setting( 'fl-footer-code' );
}
/**
* Renders a theme sidebar.
*
* @since 1.0
* @param string $position The sidebar position, either left or right.
* @param string $section The section this sidebar belongs to.
* @return void
*/
static public function sidebar( $position, $section = 'blog' ) {
$size = self::get_setting( 'fl-' . $section . '-sidebar-size' );
$display = self::get_setting( 'fl-' . $section . '-sidebar-display' );
$layout = self::get_setting( 'fl-' . $section . '-layout' );
if ( strstr( $layout, $position ) && self::is_sidebar_enabled( $section ) ) {
include locate_template( 'sidebar.php' );
}
}
/**
* Check to see if the sidebar is enabled for blog, single post, shop & single product.
*
* @since 1.5.3
* @param string $section The section this sidebar belongs to.
* @return boolean
*/
static public function is_sidebar_enabled( $section = 'blog' ) {
$locations = FLCustomizer::sanitize_checkbox_multiple( self::get_setting( 'fl-' . $section . '-sidebar-location' ) );
$post_types = FLCustomizer::sanitize_checkbox_multiple( self::get_setting( 'fl-' . $section . '-sidebar-location-post-types' ) );
$is_woo = ( 'woo' == $section && class_exists( 'WooCommerce' ) ) ? true : false;
$show_sidebar = false;
$get_post_type = get_query_var( 'post_type' );
if ( in_array( 'single', $locations ) && is_single() ) {
$show_sidebar = true;
if ( in_array( 'all', $post_types ) ) {
$show_sidebar = true;
} elseif ( ! is_singular( $post_types ) ) {
$show_sidebar = false;
}
}
if ( in_array( 'blog', $locations ) && is_home() ) {
$show_sidebar = true;
}
if ( in_array( 'search', $locations ) && is_search() ) {
$show_sidebar = true;
}
if ( in_array( 'archive', $locations ) && is_archive() ) {
$show_sidebar = true;
if ( in_array( 'all', $post_types ) ) {
$show_sidebar = true;
} elseif ( ! empty( $get_post_type ) && ! is_post_type_archive( $post_types ) ) {
$show_sidebar = false;
}
}
// do we show sidebars on pages?
// @since 1.6.3
if ( is_page() ) {
$page_template = basename( get_page_template() );
switch ( $page_template ) {
case 'tpl-full-width.php':
$show_sidebar = false;
break;
default:
$show_sidebar = true;
}
}
if ( $is_woo && is_shop() && in_array( 'shop', $locations ) ) {
$show_sidebar = true;
}
if ( $is_woo && is_product() && in_array( 'single', $locations ) ) {
$show_sidebar = true;
}
if ( $is_woo && is_product_category() && in_array( 'archive', $locations ) ) {
$show_sidebar = true;
}
return $show_sidebar;
}
/**
* This method is only here for backwards compatibility with
* child theme files that used this method before the FLLayout
* class existed.
*
* @since 1.0
* @param string $section The section this content belongs to.
* @return void
*/
static public function content_class( $section = 'blog' ) {
echo FLLayout::content_class( $section );
}
/**
* Renders the content header for post archives.
*
* @since 1.0
* @return void
*/
static public function archive_page_header() {
// Category
if ( is_category() ) {
$page_title = single_cat_title( '', false );
} elseif ( is_tag() ) {
/* translators: %s: Archive title tag */
$page_title = sprintf( _x( 'Posts Tagged ‘%s’', 'Archive title: tag.', '1io' ), single_tag_title( '', false ) );
} elseif ( is_day() ) { // Day
/* translators: %s: Archive title day */
$page_title = sprintf( _x( 'Archive for %s', 'Archive title: day.', '1io' ), get_the_date() );
} elseif ( is_month() ) { // Month
/* translators: %s: Archive title month */
$page_title = sprintf( _x( 'Archive for %s', 'Archive title: month.', '1io' ), single_month_title( ' ', false ) );
} elseif ( is_year() ) { // Year
/* translators: %s: Archive title year */
$page_title = sprintf( _x( 'Archive for %s', 'Archive title: year.', '1io' ), get_the_time( 'Y' ) );
} elseif ( is_author() ) { // Author
/* translators: %s: Archive title author */
$page_title = sprintf( _x( 'Posts by %s', 'Archive title: author.', '1io' ), get_the_author() );
} elseif ( is_search() ) { // Search
/* translators: %s: Search results title */
$page_title = sprintf( _x( 'Search results for: %s', 'Search results title.', '1io' ), get_search_query() );
} elseif ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) { // Paged
$page_title = _x( 'Archives', 'Archive title: paged archive.', '1io' );
} else { // Index
$page_title = '';
}
if ( ! empty( $page_title ) ) {
include locate_template( 'includes/archive-header.php' );
}
}
/**
* Renders the nav for post archives.
*
* @since 1.0
* @return void
*/
static public function archive_nav() {
global $wp_query;
if ( function_exists( 'wp_pagenavi' ) ) {
wp_pagenavi();
} elseif ( $wp_query->max_num_pages > 1 ) {
echo '';
echo '' . get_previous_posts_link( __( '« Newer Posts', '1io' ) ) . '
';
echo '' . get_next_posts_link( __( 'Older Posts »', '1io' ) ) . '
';
echo ' ';
}
}
/**
* Renders the excerpt more text.
*
* @since 1.0
* @param string $more The existing more text.
* @return string
*/
static public function excerpt_more( $more ) {
return '…';
}
/**
* Checks to see if the markup for the post content header
* should be rendered or not.
*
* @since 1.0
* @return bool
*/
static public function show_post_header() {
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
$global_settings = FLBuilderModel::get_global_settings();
if ( ! $global_settings->show_default_heading ) {
return false;
}
}
return true;
}
/**
* Renders the markup for the post top meta.
*
* @since 1.0
* @return void
*/
static public function post_top_meta() {
global $post;
$settings = self::get_settings();
$show_author = 'visible' == $settings['fl-blog-post-author'] ? true : false;
$show_date = 'visible' == $settings['fl-blog-post-date'] ? true : false;
$comments = comments_open() || '0' != get_comments_number();
$comment_count = 'visible' == $settings['fl-blog-comment-count'] ? true : false;
include locate_template( 'includes/post-top-meta.php' );
}
/**
* Renders the markup for the post bottom meta.
*
* @since 1.0
* @return void
*/
static public function post_bottom_meta() {
$settings = self::get_settings();
$show_full = $settings['fl-archive-show-full'];
$show_cats = 'visible' == $settings['fl-posts-show-cats'] ? true : false;
$show_tags = 'visible' == $settings['fl-posts-show-tags'] && get_the_tags() ? true : false;
$comments = comments_open() || '0' != get_comments_number();
include locate_template( 'includes/post-bottom-meta.php' );
}
/**
* Renders the markup for schema structured data.
*
* @since 1.4.1
* @return void
*/
static public function post_schema_meta() {
if ( ! self::is_schema_enabled() ) {
return false;
}
// General Schema Meta
echo ' ';
echo ' ';
echo ' ';
// Publisher Schema Meta
echo '';
echo '
';
if ( 'image' == self::get_setting( 'fl-logo-type' ) ) {
echo '
';
echo ' ';
echo '
';
}
echo '
';
// Author Schema Meta
echo '';
echo ' ';
echo ' ';
echo '
';
// Image Schema Meta
if ( has_post_thumbnail() ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
if ( is_array( $image ) ) {
echo '';
echo ' ';
echo ' ';
echo ' ';
echo '
';
}
}
// Comment Schema Meta
echo '';
echo ' ';
echo ' ';
echo '
';
}
/**
* Renders the post nav for single post pages.
*
* @since 1.0
* @return void
*/
static public function post_navigation() {
$show_nav = self::get_setting( 'fl-posts-show-nav' );
if ( 'visible' == $show_nav ) {
echo '';
previous_post_link( '%link ', '← %title' );
next_post_link( '%link ', '%title →' );
echo '
';
}
}
/**
* Renders the markup for each comment in a comments list.
*
* @since 1.0
* @return void
*/
static public function display_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
include locate_template( 'includes/comment.php' );
}
/**
* Initializes WooCommerce layout support.
*
* @since 1.0
* @return void
*/
static public function init_woocommerce() {
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
add_action( 'woocommerce_before_main_content', 'FLTheme::woocommerce_wrapper_start', 10 );
add_action( 'woocommerce_after_main_content', 'FLTheme::woocommerce_wrapper_end', 10 );
}
/**
* Renders the opening markup for WooCommerce pages.
*
* @since 1.0
* @return void
*/
static public function woocommerce_wrapper_start() {
$layout = self::get_setting( 'fl-woo-layout' );
$col_size = ( 'no-sidebar' == $layout ) ? '12' : '8';
$container_class = FLLayout::get_container_class();
$row_class = FLLayout::get_row_class();
echo '';
echo '
';
self::sidebar( 'left', 'woo' );
echo '
';
}
/**
* Renders the closing markup for WooCommerce pages.
*
* @since 1.0
* @return void
*/
static public function woocommerce_wrapper_end() {
$layout = self::get_setting( 'fl-woo-layout' );
echo '
';
self::sidebar( 'right', 'woo' );
echo '
';
echo '
';
}
/**
* Checks to see if a plugin is currently active.
*
* @since 1.0
* @param string $slug The slug of the plugin to check.
* @return bool
*/
static public function is_plugin_active( $slug ) {
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
return is_plugin_active( $slug . '/' . $slug . '.php' );
}
/**
* Renders scroll to top button for wp_footer.
*
* @since 1.5
* @return void
*/
static public function go_to_top() {
if ( self::get_setting( 'fl-scroll-to-top' ) == 'enable' ) {
FLTheme::enqueue_fontawesome();
echo ' ';
}
}
/**
* Add custom widget after post content on single post.
*
* @since 1.6
* @return void
*/
static public function after_post_widget() {
if ( is_active_sidebar( 'after-post-widget' ) && is_single() ) {
echo '';
dynamic_sidebar( 'after-post-widget' );
echo '
';
}
}
/**
* Add author box after post content on single post.
*
* @since 1.6
* @return void
*/
static public function post_author_box() {
$allowable_types = apply_filters( 'post_author_box_types', array( 'post' ) );
if ( self::get_setting( 'fl-post-author-box' ) == 'visible' && is_single() && in_array( get_post_type(), $allowable_types ) ) {
get_template_part( 'content', 'author' );
}
}
/**
* Renders number of columns for WooCommerce.
*
* @since 1.5.4
* @return void
*/
static public function woocommerce_columns() {
$columns = self::get_setting( 'fl-woo-columns' );
return $columns; // Products per row
}
/**
* Filter comment form fields.
* @since 1.6.6
*/
static public function comment_form_default_fields( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$fields['author'] = '' . _x( 'Name', 'Comment form label: comment author name.', '1io' ) . ( $req ? __( ' (required)', '1io' ) : '' ) . '
';
$fields['email'] = '' . _x( 'Email (will not be published)', 'Comment form label: comment author email.', '1io' ) . ( $req ? __( ' (required)', '1io' ) : '' ) . '
';
$fields['url'] = '' . _x( 'Website', 'Comment form label: comment author website.', '1io' ) . '
';
return $fields;
}
/**
* Filter woocommerce mobile breakpoint.
*
* @param $px The current breakpoint.
* @since 1.7
*/
static public function woo_mobile_breakpoint( $px ) {
$px = '767px';
return $px;
}
/**
* @since 1.7.1
*/
static public function pingback_url() {
if ( is_singular() && pings_open() ) {
printf( ' ' . "\n", get_bloginfo( 'pingback_url' ) );
}
}
/**
* Filters a menu item's starting output for submenu indicator.
*
* @param string $item_output The menu item's starting HTML output.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @since 1.7.3
*/
static public function nav_menu_start_el( $item_output, $item, $depth, $args ) {
if ( ! in_array( 'fl-theme-menu', explode( ' ', $args->menu_class ) ) ) {
return $item_output;
}
if ( ! in_array( 'menu-item-has-children', $item->classes ) ) {
return $item_output;
}
$icon = '';
$item_output = str_replace( '', '' . $icon, $item_output );
return $item_output;
}
/**
* @since 1.7.3
*/
static public function is_schema_enabled() {
/**
* Disable all schema.
* @see fl_theme_disable_schema
*/
if ( false !== apply_filters( 'fl_theme_disable_schema', false ) ) {
return false;
} else {
return true;
}
}
/**
* @since 2.2.3
*/
static public function print_schema( $schema, $echo = true ) {
if ( self::is_schema_enabled() ) {
if ( $echo ) {
echo $schema;
} else {
return $schema;
}
}
}
}