first commit
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Topbar content
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get the template.
|
||||
$template = get_theme_mod( 'ocean_top_bar_template' );
|
||||
|
||||
// Check if page is Elementor page.
|
||||
$elementor = get_post_meta( $template, '_elementor_edit_mode', true );
|
||||
|
||||
// Get content.
|
||||
$get_content = oceanwp_topbar_template_content();
|
||||
|
||||
// Get topbar content.
|
||||
$content = get_theme_mod( 'ocean_top_bar_content' );
|
||||
$content = oceanwp_tm_translation( 'ocean_top_bar_content', $content );
|
||||
|
||||
// Display topbar content.
|
||||
if ( ! empty( $template )
|
||||
|| $content
|
||||
|| has_nav_menu( 'topbar_menu' )
|
||||
|| is_customize_preview() ) : ?>
|
||||
|
||||
<div id="top-bar-content" class="<?php echo esc_attr( oceanwp_topbar_content_classes() ); ?>">
|
||||
|
||||
<?php
|
||||
// Get topbar menu.
|
||||
if ( has_nav_menu( 'topbar_menu' ) ) {
|
||||
get_template_part( 'partials/topbar/nav' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// If template.
|
||||
if ( ! empty( $template ) ) {
|
||||
?>
|
||||
|
||||
<div id="topbar-template">
|
||||
|
||||
<?php
|
||||
// If Elementor.
|
||||
if ( OCEANWP_ELEMENTOR_ACTIVE && $elementor ) {
|
||||
|
||||
OceanWP_Elementor::get_topbar_content();
|
||||
|
||||
// If Beaver Builder.
|
||||
} elseif ( OCEANWP_BEAVER_BUILDER_ACTIVE && ! empty( $template ) ) {
|
||||
|
||||
echo do_shortcode( '[fl_builder_insert_layout id="' . $template . '"]' );
|
||||
|
||||
// Else.
|
||||
} else {
|
||||
|
||||
// Display template content.
|
||||
echo do_shortcode( $get_content );
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Check if there is content for the topbar.
|
||||
if ( $content
|
||||
|| is_customize_preview() ) :
|
||||
?>
|
||||
|
||||
<span class="topbar-content">
|
||||
|
||||
<?php
|
||||
// Display top bar content.
|
||||
echo do_shortcode( $content );
|
||||
?>
|
||||
|
||||
</span>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</div><!-- #top-bar-content -->
|
||||
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Topbar layout
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Classes.
|
||||
$classes = array( 'clr' );
|
||||
|
||||
// Add container class if the top bar is not full width.
|
||||
if ( true !== get_theme_mod( 'ocean_top_bar_full_width', false ) ) {
|
||||
$classes[] = 'container';
|
||||
}
|
||||
|
||||
// If no content.
|
||||
if ( ! get_theme_mod( 'ocean_top_bar_content' ) ) {
|
||||
$classes[] = 'has-no-content';
|
||||
}
|
||||
|
||||
// Turn classes into space seperated string.
|
||||
$classes = implode( ' ', $classes );
|
||||
|
||||
?>
|
||||
|
||||
<?php do_action( 'ocean_before_top_bar' ); ?>
|
||||
|
||||
<div id="top-bar-wrap" class="<?php echo esc_attr( oceanwp_topbar_classes() ); ?>">
|
||||
|
||||
<div id="top-bar" class="<?php echo esc_attr( $classes ); ?>">
|
||||
|
||||
<?php do_action( 'ocean_before_top_bar_inner' ); ?>
|
||||
|
||||
<div id="top-bar-inner" class="clr">
|
||||
|
||||
<?php
|
||||
// Get content.
|
||||
get_template_part( 'partials/topbar/content' );
|
||||
|
||||
// Get social.
|
||||
if ( true === get_theme_mod( 'ocean_top_bar_social', true ) ) {
|
||||
get_template_part( 'partials/topbar/social' );
|
||||
}
|
||||
?>
|
||||
|
||||
</div><!-- #top-bar-inner -->
|
||||
|
||||
<?php do_action( 'ocean_after_top_bar_inner' ); ?>
|
||||
|
||||
</div><!-- #top-bar -->
|
||||
|
||||
</div><!-- #top-bar-wrap -->
|
||||
|
||||
<?php do_action( 'ocean_after_top_bar' ); ?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Topbar menu displays inside the topbar "content" area
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="top-bar-nav" class="navigation clr">
|
||||
|
||||
<?php
|
||||
// Menu Location.
|
||||
$menu_location = apply_filters( 'ocean_topbar_menu_location', 'topbar_menu' );
|
||||
|
||||
if ( has_nav_menu( $menu_location ) || $ms_global_menu ) :
|
||||
|
||||
// Display menu.
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => $menu_location,
|
||||
'fallback_cb' => false,
|
||||
'container' => false,
|
||||
'menu_class' => 'top-bar-menu dropdown-menu sf-menu',
|
||||
'walker' => new OceanWP_Custom_Nav_Walker(),
|
||||
)
|
||||
);
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* Topbar social profiles
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get social options array.
|
||||
$social_options = oceanwp_social_options();
|
||||
|
||||
// Return if array is empty.
|
||||
if ( empty( $social_options ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add classes based on topbar style.
|
||||
$classes = '';
|
||||
$topbar_style = get_theme_mod( 'ocean_top_bar_style', 'one' );
|
||||
if ( 'one' === $topbar_style ) {
|
||||
$classes = 'top-bar-right';
|
||||
} elseif ( 'two' === $topbar_style ) {
|
||||
$classes = 'top-bar-left';
|
||||
} elseif ( 'three' === $topbar_style ) {
|
||||
$classes = 'top-bar-centered';
|
||||
}
|
||||
|
||||
// Get ID.
|
||||
$get_id = get_theme_mod( 'ocean_top_bar_social_alt_template' );
|
||||
|
||||
// Check if page is Elementor page.
|
||||
$elementor = get_post_meta( $get_id, '_elementor_edit_mode', true );
|
||||
|
||||
// Get content.
|
||||
$get_content = oceanwp_top_bar_social_alt_content();
|
||||
|
||||
// Display Social alternative.
|
||||
if ( $get_id ) : ?>
|
||||
|
||||
<div id="top-bar-social-alt" class="clr <?php echo esc_attr( $classes ); ?>">
|
||||
<?php
|
||||
// If Elementor.
|
||||
if ( OCEANWP_ELEMENTOR_ACTIVE && $elementor ) {
|
||||
|
||||
OceanWP_Elementor::get_topbar_social_alt_content();
|
||||
|
||||
// If Beaver Builder.
|
||||
} elseif ( OCEANWP_BEAVER_BUILDER_ACTIVE && ! empty( $get_id ) ) {
|
||||
|
||||
echo do_shortcode( '[fl_builder_insert_layout id="' . $get_id . '"]' );
|
||||
|
||||
// Else.
|
||||
} else {
|
||||
|
||||
// Display template content.
|
||||
echo do_shortcode( $get_content );
|
||||
|
||||
}
|
||||
?>
|
||||
</div><!-- #top-bar-social-alt -->
|
||||
|
||||
<?php
|
||||
return;
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Return if there aren't any profiles defined and define var.
|
||||
if ( ! $profiles = get_theme_mod( 'ocean_top_bar_social_profiles' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get theme mods.
|
||||
$link_target = get_theme_mod( 'ocean_top_bar_social_target', 'blank' );
|
||||
$link_target = $link_target ? $link_target : 'blank';
|
||||
|
||||
$link_rel = '';
|
||||
if ( 'blank' === $link_target ) {
|
||||
$link_rel = 'rel="noopener noreferrer"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="top-bar-social" class="clr <?php echo esc_attr( $classes ); ?>">
|
||||
|
||||
<ul class="clr" aria-label="<?php echo esc_attr__( 'Social links', 'oceanwp' ); ?>">
|
||||
|
||||
<?php
|
||||
// Loop through social options.
|
||||
foreach ( $social_options as $key => $val ) {
|
||||
|
||||
// Get URL from the theme mods.
|
||||
$url = isset( $profiles[ $key ] ) ? $profiles[ $key ] : '';
|
||||
|
||||
$esc_url = esc_url( $url );
|
||||
|
||||
// Get correct label.
|
||||
$label = ! empty( $val['label'] ) ? esc_attr( $val['label'] ) : '';
|
||||
if ( 'blank' === $link_target ) {
|
||||
$aria_label = 'aria-label="' . $label . ' ' . esc_attr__( '(opens in a new tab)', 'oceanwp' ) . '"';
|
||||
} else {
|
||||
$aria_label = 'aria-label="' . $label . '"';
|
||||
}
|
||||
|
||||
// Display if there is a value defined.
|
||||
if ( $url ) {
|
||||
|
||||
// Display link.
|
||||
echo '<li class="oceanwp-' . esc_attr( $key ) . '">';
|
||||
|
||||
if ( in_array( $key, array( 'skype' ), true ) ) {
|
||||
echo '<a href="skype:' . esc_attr( $url ) . '?call" aria-label="' . esc_attr__( 'Skype (opens in your application)', 'oceanwp' ) . '" target="_self">';
|
||||
} elseif ( in_array( $key, array( 'email' ), true ) ) {
|
||||
echo '<a href="mailto:' . antispambot( esc_attr( $url ) ) . '" aria-label="' . esc_attr__( 'Send email (opens in your application)', 'oceanwp' ) . '" target="_self">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
echo '<a href="' . $esc_url . '" ' . $aria_label . ' target="_' . esc_attr( $link_target ) . '" ' . $link_rel . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
echo '<span class="' . esc_attr( $val['icon_class'] ) . '" aria-hidden="true"></span>';
|
||||
|
||||
echo '</a>';
|
||||
|
||||
echo '</li>';
|
||||
|
||||
} // End url check.
|
||||
} // End loop
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div><!-- #top-bar-social -->
|
||||
Reference in New Issue
Block a user