first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
@@ -0,0 +1,458 @@
<?php
/**
* AMP support for Theme
*
* @package OceanWP WordPress theme
*
* @author Amit Singh (apprimit@gmail.com)
* @since 1.8.7
*/
// Start and run class.
if ( ! class_exists( 'OceanWP_AMP' ) ) {
/**
* OceanWP AMP Setup
*/
class OceanWP_AMP {
/**
* Main Class Constructor
*/
public function __construct() {
add_action( 'wp', array( $this, 'oceanwp_amp_config' ) );
}
/**
* It will add required functions to enable AMP support if AMP endpoinnt is detected.
*
* @return void
*/
public function oceanwp_amp_config() {
if ( ! OCEANWP_Theme_Class::oceanwp_is_amp() ) {
return;
}
add_filter( 'oceanwp_schema_location_html', array( $this, 'oceanwp_body_id' ) );
add_filter( 'oceanwp_menu_toggle_data_attrs', array( $this, 'oceanwp_menu_taggle_attrs' ) );
add_action( 'wp_footer', array( $this, 'render_amp_states' ) );
add_filter( 'oceanwp_attrs_mobile_dropdown', array( $this, 'oceanwp_dropdown_menu_wrapper' ) );
add_filter( 'oceanwp_attrs_mobile_fullscreen', array( $this, 'oceanwp_fullscreen_menu_wrapper' ) );
add_filter( 'oceanwp_attrs_mobile_fullscreen_close', array( $this, 'oceanwp_fullscreen_menu_close' ) );
add_filter( 'walker_nav_menu_start_el', array( $this, 'mobile_submenu_icon' ), 20, 4 );
add_filter( 'oceanwp_toggle_submenu_icon', array( $this, 'toggle_submenu_icon' ), 20, 2 );
add_filter( 'owp_attr_submenu-toggle', array( $this, 'menu_toggle_button' ), 20, 3 );
add_filter( 'oceanwp_attrs_search_bar', array( $this, 'oceanwp_menu_search_bar' ) );
add_filter( 'oceanwp_attrs_overlay_search_bar', array( $this, 'oceanwp_menu_overlay_search_bar' ) );
add_filter( 'oceanwp_attrs_nav_search_bar', array( $this, 'oceanwp_nav_item_search_bar' ) );
add_filter( 'oceanwp_attrs_main_nav', array( $this, 'oceanwp_attrs_nav_wrapper' ) );
add_filter( 'oceanwp_attrs_vertical_header_style', array( $this, 'oceanwp_attrs_vertical_header_toggle' ) );
add_filter( 'ocean_head_css', array( $this, 'oceanwp_amp_css' ) );
// Woocommerce AMP.
if ( OCEANWP_WOOCOMMERCE_ACTIVE ) {
add_filter( 'ocean_menu_cart_style', array( $this, 'oceanwp_amp_mini_cart_style' ) );
}
}
/**
* Show body attrs.
*
* @since 1.8.7
* @param String $schema markup returned from theme.
* @return String
*/
public function oceanwp_body_id( $schema ) {
return $schema . 'id="oceanwp-body"';
}
/**
* Get CSS
*
* @param obj $output css output.
*/
public function oceanwp_amp_css( $output ) {
$css = '';
$css .= '#mobile-dropdown.opened {
display: block;
}
.menu-item {
display: flex;
position: relative;
align-item: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-moz-box-orient: vertical;
-moz-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.menu-item-has-children > button.submenu-toggle {
display: inline-block;
position: absolute;
background-color: transparent;
color: #555;
border: 0;
font-size: 20px;
top: .3em;
right: 20px;
cursor: pointer;
webkit-font-smoothing: antialiased;
moz-osx-font-smoothing: grayscale;
padding: 0 1em;
font-weight: normal;
line-height: inherit;
}
.menu-item-has-children > button.submenu-toggle::before {
content: "+";
display: inline-block;
}
.menu-item-has-children > button.submenu-toggle.submenu-open+ul.sub-menu {
display: block !important;
}
.menu-item-has-children > button.submenu-toggle.submenu-open::before {
content: "-";
}';
$amp_menu_breakpoint = get_theme_mod( 'ocean_mobile_menu_breakpoints', '959' );
$amp_menu_custom_breakpoint = get_theme_mod( 'ocean_mobile_menu_custom_breakpoint' );
$amp_vheader_style_width = get_theme_mod( 'ocean_vertical_header_width', '300' );
if ( 'custom' === $amp_menu_breakpoint && ! empty( $amp_menu_custom_breakpoint ) ) {
$amp_menu_breakpoint = $amp_menu_custom_breakpoint;
}
if ( ! empty( $amp_menu_breakpoint ) ) {
$css .= '@media (min-width: ' . $amp_menu_breakpoint . 'px) {
#site-header:not(.vertical-header) .menu-item-has-children > button.submenu-toggle {
display: none;
}
body.vertical-header-style.default-collapse.left-header #site-header.vertical-header {
left: -' . ( $amp_vheader_style_width - 36 ) . 'px;
}
body.vertical-header-style.default-collapse.left-header.amp-vertical-header #site-header.vertical-header {
left: 0;
}
body.vertical-header-style.default-collapse.right-header #site-header.vertical-header {
right: -' . ( $amp_vheader_style_width - 36 ) . 'px;
}
body.vertical-header-style.default-collapse.right-header.amp-vertical-header #site-header.vertical-header {
right: 0;
}
}';
}
$css .= '#mobile-fullscreen.opened {
display: block;
}
#mobile-fullscreen {
overflow-y: auto;
}
.fullscreen-mobile .oceanwp-mobile-menu-icon a.mobile-menu.opened .oceanwp-text {
display: inherit;
}';
$css .= '#searchform-overlay.active {
display: block;
}';
if ( OCEANWP_WOOCOMMERCE_ACTIVE ) {
$css .= '.woocommerce ul.products li.product:not(.product-category) .woo-entry-buttons li a.owp-quick-view,
.owp-quick-view {
display: none;
}
.woocommerce .oceanwp-grid-list {
display: none;
}
@media only screen and (max-width: 480px) {
.woocommerce .oceanwp-grid-list {
display: none;
}
}
';
}
// Return CSS.
if ( ! empty( $css ) ) {
$output .= '/* OceanWP AMP CSS */' . $css;
}
// Return output css.
return $output;
}
/**
* Menu Toggle attributes
*
* @param string $input the data attrs already existing in nav toggle.
* @return string
*/
public function oceanwp_menu_taggle_attrs( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpMenuExpanded: ! owpAmpMenuExpanded } ),oceanwp-body.toggleClass(class=mobile-dropdown)" ';
$input .= ' [class]="\'mobile-menu\' + ( owpAmpMenuExpanded ? \' opened\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpMenuExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the mobile dropdown menu wrapper.
*
* @param string $input the data attrs already existing in nav toggle.
* @return string
*/
public function oceanwp_dropdown_menu_wrapper( $input ) {
$input .= ' [class]="\'clr\' + ( owpAmpMenuExpanded ? \' opened\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpMenuExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the fullscreen menu wrapper.
*
* @param string $input the data attrs already existing in nav toggle.
* @return string
*/
public function oceanwp_fullscreen_menu_wrapper( $input ) {
$input .= ' [class]="\'clr\' + ( owpAmpMenuExpanded ? \' opened\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpMenuExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the fullscreen menu close wrapper.
*
* @param string $input the data attrs already existing in nav toggle.
* @return string
*/
public function oceanwp_fullscreen_menu_close( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpMenuExpanded: ! owpAmpMenuExpanded } ),oceanwp-body.toggleClass(class=clr)" ';
$input .= ' [class]="\'close\' + ( owpAmpMenuExpanded ? \' false\' : \'\' )" ';
return $input;
}
/**
* Add AMP attributes to the Vertical header toggle.
*
* @param string $input the data attrs already existing in nav toggle.
* @return string
*/
public function oceanwp_attrs_vertical_header_toggle( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpVhMenuExpanded: ! owpAmpVhMenuExpanded } ),oceanwp-body.toggleClass(class=amp-vertical-header)" ';
$input .= ' [class]="\'hamburger hamburger--spin\' + ( owpAmpVhMenuExpanded ? \' is-active\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpVhMenuExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add amp states to the dom.
*/
public function render_amp_states() {
echo '<amp-state id="owpAmpMenuExpanded">';
echo '<script type="application/json">false</script>';
echo '</amp-state>';
}
/**
* Set AMP State for eeach sub menu toggle.
*
* @param String $item_output HTML markup for the menu item.
* @param WP_Post $item Post object for the navigation menu.
*
* @return String HTML MArkup for the menu including the AML State.
*/
public function toggle_submenu_icon( $item_output, $item ) {
$item_output .= '<amp-state id="owpNavMenuItemExpanded' . esc_attr( $item->ID ) . '"><script type="application/json">false</script></amp-state>';
return $item_output;
}
/**
* Add AMP attribites to the toggle button.
*
* @param array $attr Attribute to load default.
* @param string $context The context, to build filter name.
* @param array $args Optional. Custom data to pass to filter.
*
* @return Array updated HTML attributes.
*/
public function menu_toggle_button( $attr, $context, $args ) {
$attr['[class]'] = '( owpNavMenuItemExpanded' . $args->ID . ' ? \' submenu-toggle submenu-open\' : \'submenu-toggle\')';
$attr['on'] = 'tap:AMP.setState( { owpNavMenuItemExpanded' . $args->ID . ': ! owpNavMenuItemExpanded' . $args->ID . ' } )';
return $attr;
}
/**
* Add submenu toggle icon for AMP version.
*
* @param string $item_output Menu item's HTML output.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item.
* @param stdClass $args An object of wp_nav_menu() arguments.
*
* @return String Menu item's starting markup.
*/
public function mobile_submenu_icon( $item_output, $item, $depth, $args ) {
if ( true === is_object( $args ) ) {
if ( isset( $args->theme_location ) &&
( 'main_menu' === $args->theme_location ||
'mobile_menu' === $args->theme_location )
) {
if ( isset( $item->classes ) && in_array( 'menu-item-has-children', $item->classes, true ) ) {
$item_output = $this->menu_arrow_button_markup( $item_output, $item );
}
}
} else {
if ( isset( $item->post_parent ) && 0 === $item->post_parent ) {
$item_output = $this->menu_arrow_button_markup( $item_output, $item );
}
}
return $item_output;
}
/**
* Submenu item's toggle icon HTML markup
*
* @param string $item_output Menu item's HTML output.
* @param WP_Post $item Menu item data object.
*
* @return string Submenu toggle icon.
*/
public function menu_arrow_button_markup( $item_output, $item ) {
$item_output = apply_filters( 'oceanwp_toggle_submenu_icon', $item_output, $item );
$item_output .= '<button ' . owp_attr(
'submenu-toggle',
array(
'aria-expanded' => 'false',
),
$item
) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'oceanwp' ) . '</span></button>';
return $item_output;
}
/**
* Add AMP attributes to the nav search item.
*
* @param string $input the data attrs already existing in search toggle.
* @return string
*/
public function oceanwp_nav_item_search_bar( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpSearchExpanded: ! owpAmpSearchExpanded } )" ';
$input .= ' [class]="( owpAmpSearchExpanded ? \'search-toggle-li active\' : \'search-toggle-li\' )" ';
$input .= ' aria-expanded="false" [aria-expanded]="owpAmpSearchExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the search bar wrapper.
*
* @param string $input the data attrs already existing in search toggle.
* @return string
*/
public function oceanwp_menu_search_bar( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpSearchExpanded: ! owpAmpSearchExpanded } )" ';
$input .= ' [class]="\'header-searchform-wrap clr\' + ( owpAmpSearchExpanded ? \' show\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpSearchExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the overlay search bar wrapper.
*
* @param string $input the data attrs already existing in search toggle.
* @return string
*/
public function oceanwp_menu_overlay_search_bar( $input ) {
$input .= ' on="tap:AMP.setState( { owpAmpSearchExpanded: ! owpAmpSearchExpanded } )" ';
$input .= ' [class]="\'header-searchform-wrap clr\' + ( owpAmpSearchExpanded ? \' active\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpSearchExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Add AMP attributes to the oceanwp nav wrapper.
*
* @param string $input the data attrs already existing in search toggle.
* @return string
*/
public function oceanwp_attrs_nav_wrapper( $input ) {
if ( 'header_replace' !== get_theme_mod( 'ocean_menu_search_style', 'drop_down' ) ) {
return;
}
$inner_classes = oceanwp_header_menu_classes( 'inner' );
$input .= ' [class]="\'' . $inner_classes . '\' + ( owpAmpSearchExpanded ? \' hide\' : \'\' )" ';
$input .= ' aria-expanded="false" ';
$input .= ' [aria-expanded]="owpAmpSearchExpanded ? \'true\' : \'false\'" ';
return $input;
}
/**
* Woocommerce mini cart amp style
*
* @param obj $style Return mini cart style.
*/
public function oceanwp_amp_mini_cart_style( $style ) {
$style = 'custom_link';
return $style;
}
}
}
return new OceanWP_AMP();
@@ -0,0 +1,39 @@
<?php
/**
* bbPress class
*
* @package OceanWP WordPress theme
*/
// If bbPress plugins doesn't exist then return.
if ( ! class_exists( 'bbPress' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_bbPress' ) ) :
class OceanWP_bbPress {
/**
* Setup class.
*
* @since 1.4.0
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_css' ) );
}
/**
* Load custom CSS file
*
* @since 1.4.3
*/
public static function add_custom_css() {
wp_enqueue_style( 'oceanwp-bbpress', OCEANWP_CSS_DIR_URI .'third/bbpress.min.css' );
}
}
endif;
return new OceanWP_bbPress();
@@ -0,0 +1,160 @@
<?php
/**
* Beaver Themer class
*
* @package OceanWP WordPress theme
*/
// If Beaver Builder or Beaver Themer plugins doesn't exist then return.
if ( ! OCEANWP_BEAVER_BUILDER_ACTIVE
|| ! class_exists( 'FLThemeBuilderLoader' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_Beaver_Themer' ) ) :
class OceanWP_Beaver_Themer {
/**
* Setup class.
*
* @since 1.2.5
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'header_footer_support' ) );
add_action( 'wp', array( $this, 'header_footer_render' ) );
add_action( 'wp', array( $this, 'page_content_render' ) );
add_filter( 'fl_theme_builder_part_hooks', array( $this, 'register_part_hooks' ) );
}
/**
* Add theme support
*
* @since 1.2.5
*/
public function header_footer_support() {
add_theme_support( 'fl-theme-builder-headers' );
add_theme_support( 'fl-theme-builder-footers' );
add_theme_support( 'fl-theme-builder-parts' );
}
/**
* Update header/footer with Beaver template
*
* @since 1.2.5
*/
public function header_footer_render() {
// Get the header ID.
$header_ids = FLThemeBuilderLayoutData::get_current_page_header_ids();
// If we have a header, remove the theme top bar and header and hook in Theme Builder's.
if ( ! empty( $header_ids ) ) {
remove_action( 'ocean_top_bar', 'oceanwp_top_bar_template' );
remove_action( 'ocean_header', 'oceanwp_header_template' );
add_action( 'ocean_header', 'FLThemeBuilderLayoutRenderer::render_header' );
}
// Get the footer ID.
$footer_ids = FLThemeBuilderLayoutData::get_current_page_footer_ids();
// If we have a footer, remove the theme footer and hook in Theme Builder's.
if ( ! empty( $footer_ids ) ) {
remove_action( 'ocean_footer', 'oceanwp_footer_template' );
add_action( 'ocean_footer', 'FLThemeBuilderLayoutRenderer::render_footer' );
}
}
/**
* Remove page header if page's content layouts with Beaver template
*
* @since 1.2.5
*/
public function page_content_render() {
// Get the page ID.
$page_ids = FLThemeBuilderLayoutData::get_current_page_content_ids();
// If we have a content layout, remove the theme page header.
if ( ! empty( $page_ids ) ) {
remove_action( 'ocean_page_header', 'oceanwp_page_header_template' );
}
}
/**
* Register hooks
*
* @since 1.2.5
*/
public function register_part_hooks() {
return array(
array(
'label' => esc_html__( 'Page', 'oceanwp' ),
'hooks' => array(
'ocean_before_outer_wrap' => esc_html__( 'Before Page', 'oceanwp' ),
'ocean_after_outer_wrap' => esc_html__( 'After Page', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Top Bar', 'oceanwp' ),
'hooks' => array(
'ocean_before_top_bar' => esc_html__( 'Before Top Bar', 'oceanwp' ),
'ocean_before_top_bar_inner' => esc_html__( 'Before Top Bar Inner', 'oceanwp' ),
'ocean_after_top_bar_inner' => esc_html__( 'After Top Bar Inner', 'oceanwp' ),
'ocean_after_header' => esc_html__( 'After Top Bar', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Header', 'oceanwp' ),
'hooks' => array(
'ocean_before_header' => esc_html__( 'Before Header', 'oceanwp' ),
'ocean_before_header_inner' => esc_html__( 'Before Header Inner', 'oceanwp' ),
'ocean_after_header_inner' => esc_html__( 'After Header Inner', 'oceanwp' ),
'ocean_after_header' => esc_html__( 'After Header', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Page Header', 'oceanwp' ),
'hooks' => array(
'ocean_before_page_header' => esc_html__( 'Before Page Header', 'oceanwp' ),
'ocean_before_page_header_inner' => esc_html__( 'Before Page Header Inner', 'oceanwp' ),
'ocean_after_page_header_inner' => esc_html__( 'After Page Header Inner', 'oceanwp' ),
'ocean_after_page_header' => esc_html__( 'After Page Header', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Content', 'oceanwp' ),
'hooks' => array(
'ocean_before_content' => esc_html__( 'Before Content', 'oceanwp' ),
'ocean_before_content_inner' => esc_html__( 'Before Content Inner', 'oceanwp' ),
'ocean_after_content_inner' => esc_html__( 'After Content Inner', 'oceanwp' ),
'ocean_after_content' => esc_html__( 'After Content', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Sidebar', 'oceanwp' ),
'hooks' => array(
'ocean_before_sidebar' => esc_html__( 'Before Sidebar', 'oceanwp' ),
'ocean_before_sidebar_inner' => esc_html__( 'Before Sidebar Inner', 'oceanwp' ),
'ocean_after_sidebar_inner' => esc_html__( 'After Sidebar Inner', 'oceanwp' ),
'ocean_after_sidebar' => esc_html__( 'After Sidebar', 'oceanwp' ),
),
),
array(
'label' => esc_html__( 'Footer', 'oceanwp' ),
'hooks' => array(
'ocean_before_footer' => esc_html__( 'Before Footer', 'oceanwp' ),
'ocean_before_footer_inner' => esc_html__( 'Before Footer Inner', 'oceanwp' ),
'ocean_after_footer_inner' => esc_html__( 'After Footer Inner', 'oceanwp' ),
'ocean_after_footer' => esc_html__( 'After Footer', 'oceanwp' ),
),
),
);
}
}
endif;
return new OceanWP_Beaver_Themer();
@@ -0,0 +1,39 @@
<?php
/**
* BuddyPress class
*
* @package OceanWP WordPress theme
*/
// If BuddyPress plugins doesn't exist then return.
if ( ! class_exists( 'BuddyPress' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_BuddyPress' ) ) :
class OceanWP_BuddyPress {
/**
* Setup class.
*
* @since 1.4.0
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_css' ) );
}
/**
* Load custom CSS file
*
* @since 1.4.3
*/
public static function add_custom_css() {
wp_enqueue_style( 'oceanwp-buddypress', OCEANWP_CSS_DIR_URI .'third/buddypress.min.css' );
}
}
endif;
return new OceanWP_BuddyPress();
@@ -0,0 +1,460 @@
<?php
/**
* Elementor class
*
* @package OceanWP WordPress theme
*/
// If Elementor plugins doesn't exist then return.
if ( ! OCEANWP_ELEMENTOR_ACTIVE
&& version_compare( PHP_VERSION, '5.6', '>=' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_Elementor' ) ) :
class OceanWP_Elementor {
/**
* Setup class.
*
* @since 1.4.0
*/
public function __construct() {
add_action( 'elementor/preview/enqueue_styles', array( $this, 'preview_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
}
/**
* Get the top bar content ID.
*
* @since 1.4.0
*/
public static function get_topbar_content_id() {
// Template
$id = get_theme_mod( 'ocean_top_bar_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the top bar social alternative ID.
*
* @since 1.4.0
*/
public static function get_topbar_social_alt_id() {
// Template
$id = get_theme_mod( 'ocean_top_bar_social_alt_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the vertical header ID.
*
* @since 1.4.0
*/
public static function get_vertical_header_id() {
// Template
$id = get_theme_mod( 'ocean_vertical_header_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the vertical header bottom ID.
*
* @since 1.4.0
*/
public static function get_vertical_header_bottom_id() {
// Template
$id = get_theme_mod( 'ocean_vertical_header_bottom_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the header ID.
*
* @since 1.4.0
*/
public static function get_header_id() {
// Template
$id = oceanwp_custom_header_template();
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the nav ID.
*
* @since 1.4.7
*/
public static function get_nav_id() {
// Template
$id = oceanwp_custom_nav_template();
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the social menu ID.
*
* @since 1.4.0
*/
public static function get_social_menu_id() {
// Template
$id = get_theme_mod( 'ocean_menu_social_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the footer ID.
*
* @since 1.4.0
*/
public static function get_footer_id() {
// Template
$id = oceanwp_custom_footer_template();
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Get the 404 error page ID.
*
* @since 1.4.0
*/
public static function get_error_page_id() {
// Template
$id = get_theme_mod( 'ocean_error_page_template' );
// If template is selected
if ( ! empty( $id ) ) {
// Get Polylang Translation of template
if ( function_exists( 'pll_get_post' )) {
$id_polylang = pll_get_post( $id, pll_current_language() );
if ( ! empty( $id_polylang ) ) {
$id = $id_polylang;
}
}
return $id;
}
// Return
return false;
}
/**
* Preview styles
*
* @since 1.5.21
*/
public static function preview_styles() {
wp_enqueue_style( 'oceanwp-elementor-preview', OCEANWP_CSS_DIR_URI .'third/elementor-editor.min.css' );
}
/**
* Enqueue styles
*
* @since 1.4.0
*/
public static function enqueue_styles() {
if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
$topbar_id = self::get_topbar_content_id();
$topbar_social_alt_id = self::get_topbar_social_alt_id();
$vertical_header_id = self::get_vertical_header_id();
$vertical_header_bottom_id = self::get_vertical_header_bottom_id();
$header_id = self::get_header_id();
$nav_id = self::get_nav_id();
$social_menu_id = self::get_social_menu_id();
$footer_id = self::get_footer_id();
$error_id = self::get_error_page_id();
// Enqueue top bar content css file
if ( false != $topbar_id ) {
$topbar_css = new \Elementor\Core\Files\CSS\Post( $topbar_id );
$topbar_css->enqueue();
}
// Enqueue top bar social alternative css file
if ( false != $topbar_social_alt_id ) {
$topbar_social_alt_css = new \Elementor\Core\Files\CSS\Post( $topbar_social_alt_id );
$topbar_social_alt_css->enqueue();
}
// Enqueue vertical header css file
if ( false != $vertical_header_id ) {
$vertical_header_css = new \Elementor\Core\Files\CSS\Post( $vertical_header_id );
$vertical_header_css->enqueue();
}
// Enqueue vertical header bottom css file
if ( false != $vertical_header_bottom_id ) {
$vertical_header_bottom_css = new \Elementor\Core\Files\CSS\Post( $vertical_header_bottom_id );
$vertical_header_bottom_css->enqueue();
}
// Enqueue header css file
if ( false != $header_id ) {
$header_css = new \Elementor\Core\Files\CSS\Post( $header_id );
$header_css->enqueue();
}
// Enqueue nav css file
if ( false != $nav_id ) {
$nav_css = new \Elementor\Core\Files\CSS\Post( $nav_id );
$nav_css->enqueue();
}
// Enqueue social menu css file
if ( false != $social_menu_id ) {
$social_menu_css = new \Elementor\Core\Files\CSS\Post( $social_menu_id );
$social_menu_css->enqueue();
}
// Enqueue footer css file
if ( false != $footer_id ) {
$footer_css = new \Elementor\Core\Files\CSS\Post( $footer_id );
$footer_css->enqueue();
}
// Enqueue 404 error page css file
if ( false != $error_id ) {
$error_css = new \Elementor\Core\Files\CSS\Post( $error_id );
$error_css->enqueue();
}
}
}
/**
* Prints the top bar content.
*
* @since 1.4.0
*/
public static function get_topbar_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_topbar_content_id() );
}
/**
* Prints the top bar social alternative content.
*
* @since 1.4.0
*/
public static function get_topbar_social_alt_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_topbar_social_alt_id() );
}
/**
* Prints the vertical header content.
*
* @since 1.4.0
*/
public static function get_vertical_header_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_vertical_header_id() );
}
/**
* Prints the vertical header bottom content.
*
* @since 1.4.0
*/
public static function get_vertical_header_bottom_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_vertical_header_bottom_id() );
}
/**
* Prints the header content.
*
* @since 1.4.0
*/
public static function get_header_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_header_id() );
}
/**
* Prints the nav content.
*
* @since 1.4.7
*/
public static function get_nav_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_nav_id() );
}
/**
* Prints the social menu content.
*
* @since 1.4.0
*/
public static function get_social_menu_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_social_menu_id() );
}
/**
* Prints the footer content.
*
* @since 1.4.0
*/
public static function get_footer_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_footer_id() );
}
/**
* Prints the 404 error page content.
*
* @since 1.4.0
*/
public static function get_error_page_content() {
echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( self::get_error_page_id() );
}
}
endif;
return new OceanWP_Elementor();
@@ -0,0 +1,39 @@
<?php
/**
* Generate Dynamic CSS for Gutenberg Editor
*
* @package OceanWP WordPress theme
*/
// Start and run class
if( ! class_exists( 'OceanWP_Gutenberg_Editor' ) ) {
class OceanWP_Gutenberg_Editor {
/**
* Main Class Constructor
*
* @since 1.5.33
*/
public function __construct() {
// After setup theme - Gutenberg
add_action( 'after_setup_theme', array( $this, 'gutenberg_support' ), 10 );
}
public static function gutenberg_support() {
// Adding Gutenberg support
add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_editor_style( 'assets/css/gutenberg/gutenberg-editor.min.css' );
}
}
}
return new OceanWP_Gutenberg_Editor();
@@ -0,0 +1,312 @@
<?php
/**
* LearnDash class
*
* @package OceanWP WordPress theme
*/
// If LearnDash plugins doesn't exist then return.
if ( ! class_exists( 'SFWD_LMS' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_LearnDash' ) ) :
class OceanWP_LearnDash {
/**
* Setup class.
*
* @since 1.2.10
*/
public function __construct() {
// Body classes
add_filter( 'body_class', array( $this, 'body_class' ) );
add_action( 'ocean_main_metaboxes_post_types', array( $this, 'add_metabox' ), 20 );
// Post Layout Class
add_filter( 'ocean_post_layout_class', array( $this, 'layouts' ) );
// Set correct both sidebars layout style
add_filter( 'ocean_both_sidebars_style', array( $this, 'bs_class' ) );
// Set correct mobile sidebar order
add_filter( 'ocean_sidebar_order', array( $this, 'sidebar_order' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_scripts' ) );
// Fix for the OceanWP Settings values not saved
if ( OCEAN_EXTRA_ACTIVE ) {
add_action( 'learndash_metabox_after_save_learndash-course-options', array( $this, 'butterbean_fix' ) );
}
// Distraction free learning
add_filter( 'ocean_display_top_bar', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_navigation', array( $this, 'distraction_free' ), 11 );
add_filter( 'osh_enable_sticky_header', array( $this, 'distraction_free' ), 11 );
add_filter( 'osp_display_side_panel', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_page_header', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_footer_widgets', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_scroll_up_button', array( $this, 'distraction_free' ), 11 );
add_filter( 'osh_header_sticky_logo', array( $this, 'distraction_free' ), 11 );
add_filter( 'ofc_display_footer_callout', array( $this, 'distraction_free' ), 11 );
// Define accents
add_filter( 'ocean_primary_texts', array( $this, 'primary_texts' ) );
add_filter( 'ocean_primary_borders', array( $this, 'primary_borders' ) );
add_filter( 'ocean_primary_backgrounds', array( $this, 'primary_backgrounds' ) );
add_filter( 'ocean_hover_primary_backgrounds', array( $this, 'hover_primary_backgrounds' ) );
add_filter( 'ocean_border_color_elements', array( $this, 'border_color_elements' ) );
// Add new typography settings
add_filter( 'ocean_typography_settings', array( $this, 'typography_settings' ) );
}
/**
* Add the OceanWP Settings metabox into the custom post types
*
* @since 1.2.10
*/
public static function add_metabox( $types ) {
$types[] = 'sfwd-courses';
$types[] = 'sfwd-lessons';
$types[] = 'sfwd-quiz';
$types[] = 'sfwd-topic';
return $types;
}
/**
* Body classes
*
* @since 1.5.0
*/
public static function body_class( $classes ) {
if( ( is_singular( array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic' ) ) )
&& true == get_theme_mod( 'ocean_ld_distraction_free_learning', false ) ) {
$classes[] = 'ld-distraction-free';
}
if ( is_singular( array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic' ) ) || is_tax( array( 'ld_course_category', 'ld_course_tag', 'ld_lesson_category', 'ld_lesson_tag', 'ld_topic_category', 'ld_topic_tag' ) ) ) {
$classes[] = 'ld-global-layout';
}
return $classes;
}
/**
* Tweaks the post layouts for LearnDash Course and Lesson
*
* @since 1.0.0
*/
public static function layouts( $class ) {
if ( is_singular( array( 'sfwd-quiz' ) ) || is_tax( array( 'ld_course_category', 'ld_course_tag', 'ld_lesson_category', 'ld_lesson_tag', 'ld_topic_category', 'ld_topic_tag' ) ) ) {
$class = get_theme_mod( 'ocean_ld_global_layout', 'full-width' );
}
elseif ( is_singular( array( 'sfwd-lessons', 'sfwd-topic' ) ) ) {
$class = get_theme_mod( 'ocean_ld_lesson_layout', 'left-sidebar' );
} elseif ( is_singular( 'sfwd-courses' ) ) {
$class = get_theme_mod( 'ocean_ld_course_layout', 'left-sidebar' );
}
return $class;
}
/**
* Set correct both sidebars layout style.
*
* @since 1.4.0
*/
public static function bs_class( $class ) {
if ( is_singular( array( 'sfwd-quiz', 'sfwd-topic' ) ) || is_tax( array( 'ld_course_category', 'ld_course_tag', 'ld_lesson_category', 'ld_lesson_tag', 'ld_topic_category', 'ld_topic_tag' ) ) ) {
$class = get_theme_mod( 'ocean_ld_global_both_sidebars_style', 'scs-style' );
}
elseif ( is_singular( array( 'sfwd-lessons', 'sfwd-topic' ) ) ) {
$class = get_theme_mod( 'ocean_ld_lesson_both_sidebars_style', 'scs-style' );
} elseif ( is_singular( 'sfwd-courses' ) ) {
$class = get_theme_mod( 'ocean_ld_course_both_sidebars_style', 'scs-style' );
}
return $class;
}
/**
* Set correct mobile sidebar order.
*
* @since 1.6
*/
public static function sidebar_order( $order ) {
if ( is_singular( array( 'sfwd-quiz' ) ) || is_tax( array( 'ld_course_category', 'ld_course_tag', 'ld_lesson_category', 'ld_lesson_tag', 'ld_topic_category', 'ld_topic_tag' ) ) ) {
$order = get_theme_mod( 'ocean_ld_global_sidebar_order', 'content-sidebar' );
}
elseif ( is_singular( array( 'sfwd-lessons', 'sfwd-topic' ) ) ) {
$order = get_theme_mod( 'ocean_ld_lesson_sidebar_order', 'content-sidebar' );
} elseif ( is_singular( 'sfwd-courses' ) ) {
$order = get_theme_mod( 'ocean_ld_course_sidebar_order', 'content-sidebar' );
}
return $order;
}
/**
* Add Custom LLMS scripts.
*
* @since 1.0.0
*/
public static function add_custom_scripts() {
wp_enqueue_style( 'oceanwp-learndash', OCEANWP_CSS_DIR_URI .'learndash/learndash.min.css' );
}
/**
* Distraction free learning
*
* @since 1.5.0
*/
public static function distraction_free( $return ) {
if( ( is_singular( array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic' ) ) )
&& true == get_theme_mod( 'ocean_ld_distraction_free_learning', false ) ) {
$return = false;
}
return $return;
}
/**
* Fix for the OceanWP Settings values not saved
*
* @since 1.2.10
*/
public static function butterbean_fix( $post_id ) {
butterbean()->update( $post_id );
}
/**
* Add typography options for the LearnDash product title
*
* @since 1.0.0
*/
public static function typography_settings( $settings ) {
$settings['learndash_course_title'] = array(
'label' => esc_html__( 'LearnDash Titles', 'oceanwp' ),
'target' => '.single-sfwd-courses .entry-title, .single-sfwd-lessons .entry-title, .single-sfwd-topic .entry-title, .single-sfwd-quiz .entry-title, .single-sfwd-certificates .entry-title, .single-sfwd-assignment .entry-title',
'defaults' => array(
'font-size' => '34',
'color' => '#333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['learndash_table_heading'] = array(
'label' => esc_html__( 'LearnDash Table Heading', 'oceanwp' ),
'target' => '#learndash_lessons #lesson_heading, #learndash_profile .learndash_profile_heading, #learndash_quizzes #quiz_heading, #learndash_lesson_topics_list div>strong',
'defaults' => array(
'font-size' => '18',
'color' => '#fff',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['learndash_table_item'] = array(
'label' => esc_html__( 'LearnDash Table Item', 'oceanwp' ),
'target' => '#lessons_list>div h4>a, #course_list>div h4>a, #quiz_list>div h4>a',
'defaults' => array(
'font-size' => '34',
'color' => '#333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['learndash_buy_button'] = array(
'label' => esc_html__( 'LearnDash Take Course Button', 'oceanwp' ),
'target' => '.learndash_checkout_button .btn-join',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12',
'line-height' => '1',
),
);
return $settings;
}
/**
* Adds color accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_texts( $texts ) {
return array_merge( array(
'.learndash a:hover',
'#learndash_lessons a:hover',
'#learndash_quizzes a:hover',
'.expand_collapse a:hover',
'.learndash_topic_dots a:hover',
'.learndash_topic_dots a:hover > span',
'#learndash_lesson_topics_list span a:hover',
'.learndash .completed:before',
'.learndash .notcompleted:before',
'#learndash_profile .completed:before',
'#learndash_profile .notcompleted:before',
), $texts );
}
/**
* Adds border accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_borders( $borders ) {
return array_merge( array(
'.learndash-instructor-info .learndash-instructors .learndash-author' => array( 'top' ),
'.learndash-notification' => array( 'top' ),
'.learndash-instructor-info .learndash-instructors .learndash-author .avatar',
), $borders );
}
/**
* Adds background accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_backgrounds( $backgrounds ) {
return array_merge( array(
'.learndash-button-action',
'#learndash_lessons #lesson_heading',
'#learndash_profile .learndash_profile_heading',
'#learndash_quizzes #quiz_heading',
'#learndash_lesson_topics_list div>strong',
'dd.course_progress div.course_progress_blue',
'body #ld_course_list .btn',
), $backgrounds );
}
/**
* Adds background hover accents for LLMS styles.
*
* @since 1.0.0
*/
public static function hover_primary_backgrounds( $hover ) {
return array_merge( array(
'.learndash-button-action:hover',
'body #ld_course_list .btn:hover',
), $hover );
}
/**
* Adds border color elements for LLMS styles.
*
* @since 1.0.0
*/
public static function border_color_elements( $elements ) {
return array_merge( array(
'.learndash-sd-notification-center .learndash-notification',
), $elements );
}
}
endif;
return new OceanWP_LearnDash();
@@ -0,0 +1,547 @@
<?php
/**
* LifterLMS class
*
* @package OceanWP WordPress theme
*/
// If LifterLMS plugins doesn't exist then return.
if ( ! class_exists( 'LifterLMS' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_LifterLMS' ) ) :
class OceanWP_LifterLMS {
/**
* Setup class.
*
* @since 1.2.10
*/
public function __construct() {
// Body classes
add_filter( 'body_class', array( $this, 'body_class' ) );
add_action( 'ocean_main_metaboxes_post_types', array( $this, 'add_metabox' ), 20 );
add_action( 'after_setup_theme', array( $this, 'theme_support' ) );
add_filter( 'llms_get_theme_default_sidebar', array( $this, 'llms_sidebar' ) );
// Post Layout Class
add_filter( 'ocean_post_layout_class', array( $this, 'layouts' ) );
// Set correct both sidebars layout style
add_filter( 'ocean_both_sidebars_style', array( $this, 'bs_class' ) );
// Set correct mobile sidebar order
add_filter( 'ocean_sidebar_order', array( $this, 'sidebar_order' ) );
add_filter( 'lifterlms_show_page_title', '__return_false' );
// Remove Content Wrappers
remove_action( 'lifterlms_before_main_content', 'lifterlms_output_content_wrapper', 10 );
remove_action( 'lifterlms_after_main_content', 'lifterlms_output_content_wrapper_end', 10 );
remove_action( 'lifterlms_sidebar', 'lifterlms_get_sidebar' );
// Add Content Wrappers
add_action( 'lifterlms_before_main_content', array( $this, 'before_main_content_start' ) );
add_action( 'lifterlms_after_main_content', array( $this, 'before_main_content_end' ) );
add_filter( 'llms_builder_register_custom_fields', array( $this, 'quiz_settings' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_scripts' ) );
add_action( 'wp', array( $this, 'course_details' ) );
// Fix for the OceanWP Settings values not saved
if ( OCEAN_EXTRA_ACTIVE ) {
add_action( 'llms_metabox_after_save_lifterlms-course-options', array( $this, 'butterbean_fix' ) );
}
// Distraction free checkout
add_filter( 'ocean_display_top_bar', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_navigation', array( $this, 'distraction_free' ), 11 );
add_filter( 'osh_enable_sticky_header', array( $this, 'distraction_free' ), 11 );
add_filter( 'osp_display_side_panel', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_page_header', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_footer_widgets', array( $this, 'distraction_free' ), 11 );
add_filter( 'ocean_display_scroll_up_button', array( $this, 'distraction_free' ), 11 );
add_filter( 'osh_header_sticky_logo', array( $this, 'distraction_free' ), 11 );
add_filter( 'ofc_display_footer_callout', array( $this, 'distraction_free' ), 11 );
// Grid.
add_filter( 'lifterlms_loop_columns', array( $this, 'archive_columns' ) );
add_filter( 'llms_get_loop_list_classes', array( $this, 'archive_responsive_columns' ), 999 );
// Define accents
add_filter( 'ocean_primary_texts', array( $this, 'primary_texts' ) );
add_filter( 'ocean_primary_borders', array( $this, 'primary_borders' ) );
add_filter( 'ocean_primary_backgrounds', array( $this, 'primary_backgrounds' ) );
add_filter( 'ocean_hover_primary_backgrounds', array( $this, 'hover_primary_backgrounds' ) );
add_filter( 'ocean_border_color_elements', array( $this, 'border_color_elements' ) );
// Add new typography settings
add_filter( 'ocean_typography_settings', array( $this, 'typography_settings' ) );
}
/**
* Add the OceanWP Settings metabox into the custom post types
*
* @since 1.2.10
*/
public static function add_metabox( $types ) {
$types[] = 'course';
$types[] = 'lesson';
$types[] = 'llms_question';
$types[] = 'llms_review';
return $types;
}
/**
* Declare explicit theme support for LifterLMS course and lesson sidebars
*
* @since 1.2.10
*/
public static function theme_support() {
add_theme_support( 'lifterlms-sidebars' );
}
/**
* Display LifterLMS Course and Lesson sidebars
* on courses and lessons in place of the sidebar returned by
* this function
*
* @since 1.2.10
*/
public static function llms_sidebar( $id ) {
$id = 'sidebar';
return $id;
}
/**
* Body classes
*
* @since 1.5.0
*/
public static function body_class( $classes ) {
// Distraction free class
if ( is_llms_checkout()
&& true == get_theme_mod( 'ocean_llms_distraction_free_checkout', false ) ) {
$classes[] = 'llms-distraction-free';
}
if( ( is_course() || is_lesson() )
&& true == get_theme_mod( 'ocean_llms_distraction_free_learning', false ) ) {
$classes[] = 'llms-distraction-free';
}
if( is_llms_account_page() || is_membership() || is_memberships() || is_quiz() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
$classes[] = 'llms-global-layout';
}
return $classes;
}
/**
* Tweaks the post layouts for LifterLMS Course and Lesson
*
* @since 1.0.0
*/
public static function layouts( $class ) {
if ( is_llms_account_page() || is_membership() || is_memberships() || is_quiz() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
$class = get_theme_mod( 'ocean_llms_global_layout', 'full-width' );
}
elseif ( is_lesson() ) {
$class = get_theme_mod( 'ocean_llms_lesson_layout', 'left-sidebar' );
} elseif ( is_course() ) {
$class = get_theme_mod( 'ocean_llms_course_layout', 'left-sidebar' );
}
return $class;
}
/**
* Set correct both sidebars layout style.
*
* @since 1.4.0
*/
public static function bs_class( $class ) {
if ( is_llms_account_page() || is_membership() || is_memberships() || is_quiz() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
$class = get_theme_mod( 'ocean_llms_global_both_sidebars_style', 'scs-style' );
}
elseif ( is_lesson() ) {
$class = get_theme_mod( 'ocean_llms_lesson_both_sidebars_style', 'scs-style' );
} elseif ( is_course() ) {
$class = get_theme_mod( 'ocean_llms_course_both_sidebars_style', 'scs-style' );
}
return $class;
}
/**
* Set correct mobile sidebar order.
*
* @since 1.6
*/
public static function sidebar_order( $order ) {
if ( is_llms_account_page() || is_membership() || is_memberships() || is_quiz() || is_courses() || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
$order = get_theme_mod( 'ocean_llms_global_sidebar_order', 'content-sidebar' );
}
elseif ( is_lesson() ) {
$order = get_theme_mod( 'ocean_llms_lesson_sidebar_order', 'content-sidebar' );
} elseif ( is_course() ) {
$order = get_theme_mod( 'ocean_llms_course_sidebar_order', 'content-sidebar' );
}
return $order;
}
/**
* Add Custom LLMS scripts.
*
* @since 1.0.0
*/
public static function add_custom_scripts() {
wp_enqueue_style( 'oceanwp-llms', OCEANWP_CSS_DIR_URI .'llms/llms.min.css' );
}
/**
* Add start of wrapper
*
* @since 1.2.0
* @return void
*/
function before_main_content_start() {
do_action( 'ocean_before_content_wrap' ); ?>
<div id="content-wrap" class="container clr">
<?php do_action( 'ocean_before_primary' ); ?>
<div id="primary" class="content-area clr">
<?php do_action( 'ocean_before_content' ); ?>
<div id="content" class="site-content clr">
<?php do_action( 'ocean_before_content_inner' );
}
/**
* Add end of wrapper
*
* @since 1.2.0
* @return void
*/
function before_main_content_end() {
?>
</div><!-- #content -->
<?php do_action( 'ocean_after_content' ); ?>
</div><!-- #primary -->
<?php do_action( 'ocean_after_primary' ); ?>
</div><!-- #content-wrap -->
<?php do_action( 'ocean_after_content_wrap' );
}
/**
* Course Details
*
* @since 1.2.0
* @return void
*/
function course_details(){
$details = get_theme_mod( 'ocean_llms_course_details', array( 'image', 'description', 'meta', 'author', 'progress', 'syllabus' ) );
if( in_array( 'image', $details) ) {
}
if( ! in_array( 'description', $details ) ) {
add_filter( 'the_excerpt', '__return_empty_string', 9 );
add_filter( 'the_content', '__return_empty_string', 9 );
}
if( ! in_array( 'meta', $details) ) {
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_length', 10 );
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_difficulty', 20 );
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_tracks', 25 );
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_categories', 30 );
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_tags', 35 );
}
if( ! in_array( 'author', $details) ) {
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_course_author', 40 );
}
if( ! ( in_array( 'meta', $details ) && in_array( 'author', $details ) ) ){
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_meta_wrapper_start', 5 );
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_meta_wrapper_end', 50 );
}
if( ! in_array( 'progress', $details) ) {
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_progress', 60 );
}
if( ! in_array( 'syllabus', $details) ) {
remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_syllabus', 90 );
}
}
/**
* Add quiz custom fields
*
* @since 1.1.15
* @return void
*/
function quiz_settings( $fields ) {
$fields['quiz']['layout'] = array(
'title' => esc_html__( 'OceanWP Theme Setting', 'oceanwp' ),
'toggleable' => true,
'fields' => array(
array(
array(
'attribute' => 'ocean_post_layout',
'label' => esc_html__( 'Layout', 'oceanwp' ),
'type' => 'select',
'options' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'right-sidebar' => esc_html__( 'Right Sidebar', 'oceanwp' ),
'left-sidebar' => esc_html__( 'Left Sidebar', 'oceanwp' ),
'full-width' => esc_html__( 'Full Width', 'oceanwp' ),
'full-screen' => esc_html__( 'Full Screen', 'oceanwp' ),
'both-sidebars' => esc_html__( 'Both Sidebar', 'oceanwp' ),
),
),
),
),
);
return $fields;
}
/**
* Distraction free on cart/checkout
*
* @since 1.5.0
*/
public static function distraction_free( $return ) {
if ( is_llms_checkout()
&& true == get_theme_mod( 'ocean_llms_distraction_free_checkout', false ) ) {
$return = false;
}
if( ( is_course() || is_lesson() )
&& true == get_theme_mod( 'ocean_llms_distraction_free_learning', false ) ) {
$return = false;
}
return $return;
}
/**
* LLMS Courses and Membership Page Columns.
*
* @since 1.0.0
* @param number $columns default number of columns (3).
* @return number
*/
function archive_columns( $columns ) {
if ( is_post_type_archive( 'course' ) || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track' ) ) ) {
$columns = get_theme_mod( 'ocean_llms_courses_columns', 3 );
$columns = $columns ? $columns : '3';
return $columns;
} elseif ( is_post_type_archive( 'llms_membership' ) || is_tax( array( 'membership_tag', 'membership_cat' ) ) ) {
$columns = get_theme_mod( 'ocean_llms_membership_columns', 3 );
$columns = $columns ? $columns : '3';
return $columns;
}
}
/**
* LLMS Courses and Membership Page Responsive Columns.
*
* @since 1.0.0
* @param number $columns default number of columns (3).
* @return number
*/
function archive_responsive_columns( $classes ) {
if ( is_post_type_archive( 'course' ) || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track' ) ) ) {
// Responsive columns
$tablet_columns = get_theme_mod( 'ocean_llms_tablet_courses_columns' );
$mobile_columns = get_theme_mod( 'ocean_llms_mobile_courses_columns' );
if ( ! empty( $tablet_columns ) ) {
$classes[] = 'tablet-col';
$classes[] = 'tablet-' . $tablet_columns . '-col';
}
if ( ! empty( $mobile_columns ) ) {
$classes[] = 'mobile-col';
$classes[] = 'mobile-' . $mobile_columns . '-col';
}
} elseif ( is_post_type_archive( 'llms_membership' ) || is_tax( array( 'membership_tag', 'membership_cat' ) ) ) {
// Responsive columns
$tablet_columns = get_theme_mod( 'ocean_llms_tablet_membership_columns' );
$mobile_columns = get_theme_mod( 'ocean_llms_mobile_membership_columns' );
if ( ! empty( $tablet_columns ) ) {
$classes[] = 'tablet-col';
$classes[] = 'tablet-' . $tablet_columns . '-col';
}
if ( ! empty( $mobile_columns ) ) {
$classes[] = 'mobile-col';
$classes[] = 'mobile-' . $mobile_columns . '-col';
}
}
return $classes;
}
/**
* Fix for the OceanWP Settings values not saved
*
* @since 1.2.10
*/
public static function butterbean_fix( $post_id ) {
butterbean()->update( $post_id );
}
/**
* Add typography options for the LifterLMS product title
*
* @since 1.0.0
*/
public static function typography_settings( $settings ) {
$settings['lifterlms_course_title'] = array(
'label' => esc_html__( 'LifterLMS Course/Lesson Title', 'oceanwp' ),
'target' => '.single-course .entry-title, .single-lesson .entry-title',
'defaults' => array(
'font-size' => '34',
'color' => '#333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['lifterlms_section_title'] = array(
'label' => esc_html__( 'LifterLMS Section Title', 'oceanwp' ),
'target' => '.llms-syllabus-wrapper .llms-section-title',
'defaults' => array(
'font-size' => '18',
'color' => '#fff',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['lifterlms_lesson_title'] = array(
'label' => esc_html__( 'LifterLMS Lesson Title', 'oceanwp' ),
'target' => '.single-lesson .entry-title',
'defaults' => array(
'font-size' => '34',
'color' => '#333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
);
$settings['lifterlms_buy_button'] = array(
'label' => esc_html__( 'LifterLMS Buy Button', 'oceanwp' ),
'target' => '.llms-access-plan-footer .llms-button-action',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12',
'line-height' => '1',
),
);
return $settings;
}
/**
* Adds color accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_texts( $texts ) {
return array_merge( array(
'.llms-course-navigation .llms-pre-text',
'.llms-lesson-preview.is-free .llms-lesson-complete',
'.llms-lesson-preview.is-complete .llms-lesson-complete',
'.llms-loop-item-content .llms-loop-title:hover',
'.llms-meta-info .llms-meta a:hover',
), $texts );
}
/**
* Adds border accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_borders( $borders ) {
return array_merge( array(
'.llms-instructor-info .llms-instructors .llms-author' => array( 'top' ),
'.llms-notification' => array( 'top' ),
'.llms-instructor-info .llms-instructors .llms-author .avatar',
), $borders );
}
/**
* Adds background accents for LLMS styles.
*
* @since 1.0.0
*/
public static function primary_backgrounds( $backgrounds ) {
return array_merge( array(
'.llms-button-action',
'.llms-button-secondary',
'.llms-field-button',
'.llms-button-primary',
'.llms-progress .progress-bar-complete',
'.llms-instructor-info .llms-instructors .llms-author .avatar',
'.llms-syllabus-wrapper .llms-section-title',
'.llms-access-plan-title',
'.llms-access-plan .stamp',
'.llms-lesson-preview .llms-icon-free',
'.llms-student-dashboard .llms-status.llms-active',
'.llms-student-dashboard .llms-status.llms-completed',
'.llms-student-dashboard .llms-status.llms-txn-succeeded',
'.llms-checkout-wrapper .llms-form-heading',
), $backgrounds );
}
/**
* Adds background hover accents for LLMS styles.
*
* @since 1.0.0
*/
public static function hover_primary_backgrounds( $hover ) {
return array_merge( array(
'.llms-button-action:hover',
'.llms-button-secondary:hover',
'.llms-field-button:hover',
'.llms-button-primary:hover',
'.llms-button-action:focus',
'.llms-button-secondary:focus',
'.llms-field-button:focus',
'.llms-button-primary:focus',
), $hover );
}
/**
* Adds border color elements for LLMS styles.
*
* @since 1.0.0
*/
public static function border_color_elements( $elements ) {
return array_merge( array(
'.llms-sd-notification-center .llms-notification',
), $elements );
}
}
endif;
return new OceanWP_LifterLMS();
@@ -0,0 +1,69 @@
<?php
/**
* PWA support for Theme
*
* @package OceanWP WordPress theme
*
* @author Amit Singh (apprimit@gmail.com)
* @since 1.8.8
*/
// Start and run class.
if ( ! class_exists( 'OceanWP_PWA' ) ) {
/**
* OceanWP AMP Setup
*/
class OceanWP_PWA {
/**
* Main Class Constructor
*/
public function __construct() {
if ( ! $this->oceanwp_is_pwa() ) {
return;
}
add_action( 'ocean_do_offline', array( $this, 'offline_default_template' ) );
add_action( 'oceanwp_do_server_error', array( $this, 'server_error_default_template' ) );
}
/**
* Check if plugin exist or not.
*/
private function oceanwp_is_pwa() {
return defined( 'PWA_VERSION' ) && function_exists( 'wp_service_worker_error_details_template' ) && function_exists( 'pwa_get_header' ) && function_exists( 'wp_service_worker_error_message_placeholder' ) && function_exists( 'pwa_get_footer' );
}
/**
* Offline default template.
*/
public function offline_default_template() {
?>
<main>
<h1><?php esc_html_e( 'Oops! It looks like you&#8217;re offline. Please check the network connection.', 'oceanwp' ); ?></h1>
<?php wp_service_worker_error_message_placeholder(); ?>
</main>
<?php
}
/**
* Server error template.
*/
public function server_error_default_template() {
?>
<main>
<h1><?php esc_html_e( 'Oops! Something went wrong. Please try again.', 'oceanwp' ); ?></h1>
<?php wp_service_worker_error_message_placeholder(); ?>
<?php wp_service_worker_error_details_template(); ?>
</main>
<?php
}
}
}
return new OceanWP_PWA();
@@ -0,0 +1,208 @@
<?php
/**
* Sensei class
*
* @package OceanWP WordPress theme
*/
// If Sensei plugins doesn't exist then return.
if ( ! class_exists( 'Sensei_Main' ) ) {
return;
}
if ( ! class_exists( 'OceanWP_Sensei' ) ) :
class OceanWP_Sensei {
/**
* Setup class.
*
* @since 1.4.0
*/
public function __construct() {
global $woothemes_sensei;
add_action( 'after_setup_theme', array( $this, 'declare_sensei_support' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_css' ) );
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
add_action( 'sensei_before_main_content', array( $this, 'wrapper_start' ), 10 );
add_action( 'sensei_after_main_content', array( $this, 'wrapper_end' ), 10 );
add_action( 'ocean_main_metaboxes_post_types', array( $this, 'add_metabox' ), 20 );
add_filter( 'ocean_primary_backgrounds', array( $this, 'primary_backgrounds' ) );
add_filter( 'ocean_hover_primary_backgrounds', array( $this, 'hover_primary_backgrounds' ) );
}
/**
* Declare Sensei support
*
* @since 1.4.0
*/
public static function declare_sensei_support() {
add_theme_support( 'sensei' );
}
/**
* Load custom CSS file
*
* @since 1.4.0
*/
public static function add_custom_css() {
if ( is_sensei() || is_tax( 'module' ) ) {
wp_enqueue_style( 'oceanwp-sensei', OCEANWP_CSS_DIR_URI .'third/sensei.min.css' );
}
}
/**
* Add wrappers start
*
* @since 1.4.0
*/
public static function wrapper_start() {
ob_start(); ?>
<?php do_action( 'ocean_before_content_wrap' ); ?>
<div id="content-wrap" class="container oceanwp-sensei clr">
<?php do_action( 'ocean_before_primary' ); ?>
<div id="primary" class="content-area clr">
<?php do_action( 'ocean_before_content' ); ?>
<div id="content" class="site-content clr">
<?php do_action( 'ocean_before_content_inner' ); ?>
<?php
echo ob_get_clean();
}
/**
* Add wrappers end
*
* @since 1.4.0
*/
public static function wrapper_end() {
ob_start(); ?>
<?php do_action( 'ocean_after_content_inner' ); ?>
</div><!-- #content -->
<?php do_action( 'ocean_after_content' ); ?>
</div><!-- #primary -->
<?php do_action( 'ocean_after_primary' ); ?>
</div><!-- #content-wrap -->
<?php do_action( 'ocean_after_content_wrap' ); ?>
<?php
echo ob_get_clean();
}
/**
* Add the OceanWP Settings metabox into the custom post types
*
* @since 1.4.0
*/
public static function add_metabox( $types ) {
$types[] = 'course';
$types[] = 'lesson';
$types[] = 'question';
return $types;
}
/**
* Primary background colors classes
*
* @since 1.4.0
*/
public static function primary_backgrounds( $backgrounds ) {
return array_merge( array(
'.course-container a.button',
'.course-container a.button:visited',
'.course-container a.comment-reply-link',
'.course-container #commentform #submit',
'.course-container .submit',
'.course-container input[type=submit]',
'.course-container input.button',
'.course-container button.button',
'.course a.button',
'.course a.button:visited',
'.course a.comment-reply-link',
'.course #commentform #submit',
'.course .submit',
'.course input[type=submit]',
'.course input.button',
'.course button.button',
'.lesson a.button',
'.lesson a.button:visited',
'.lesson a.comment-reply-link',
'.lesson #commentform #submit',
'.lesson .submit',
'.lesson input[type=submit]',
'.lesson input.button',
'.lesson button.button',
'.quiz a.button',
'.quiz a.button:visited',
'.quiz a.comment-reply-link',
'.quiz #commentform #submit',
'.quiz .submit',
'.quiz input[type=submit]',
'.quiz input.button',
'.quiz button.button',
), $backgrounds );
}
/**
* Hover Primary background colors classes
*
* @since 1.4.0
*/
public static function hover_primary_backgrounds( $hover ) {
return array_merge( array(
'.course-container a.button:hover',
'.course-container a.button:visited:hover',
'.course-container a.comment-reply-link:hover',
'.course-container #commentform #submit:hover',
'.course-container .submit:hover',
'.course-container input[type=submit]:hover',
'.course-container input.button:hover',
'.course-container button.button:hover',
'.course a.button:hover',
'.course a.button:visited:hover',
'.course a.comment-reply-link:hover',
'.course #commentform #submit:hover',
'.course .submit:hover',
'.course input[type=submit]:hover',
'.course input.button:hover',
'.course button.button:hover',
'.lesson a.button:hover',
'.lesson a.button:visited:hover',
'.lesson a.comment-reply-link:hover',
'.lesson #commentform #submit:hover',
'.lesson .submit:hover',
'.lesson input[type=submit]:hover',
'.lesson input.button:hover',
'.lesson button.button:hover',
'.quiz a.button:hover',
'.quiz a.button:visited:hover',
'.quiz a.comment-reply-link:hover',
'.quiz #commentform #submit:hover',
'.quiz .submit:hover',
'.quiz input[type=submit]:hover',
'.quiz input.button:hover',
'.quiz button.button:hover',
), $hover );
}
}
endif;
return new OceanWP_Sensei();
@@ -0,0 +1,73 @@
<?php
/**
* WordPress Social Login class
*
* @package OceanWP WordPress theme
*/
// Return if the plugins doesn't exist or if logged in.
if ( ! function_exists( 'wsl_install' )
|| is_user_logged_in() ) {
return;
}
if ( ! class_exists( 'OceanWP_Social_Login' ) ) :
class OceanWP_Social_Login {
/**
* Setup class.
*
* @since 1.4.0
*/
public function __construct() {
add_filter( 'wsl_render_auth_widget_alter_provider_icon_markup', array( $this, 'social_login_markup' ), 10, 3 );
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_css' ) );
add_action( 'login_enqueue_scripts', array( $this, 'add_custom_css' ) );
}
/**
* Social login markup.
*
* @since 1.0.0
*/
public function social_login_markup( $provider_id, $provider_name, $authenticate_url ) {
// Icons
$provider_icon = strtolower( $provider_id );
// Custom icons
if ( 'facebook' == strtolower( $provider_id ) ) {
$provider_icon = 'facebook-f';
} else if ( 'vkontakte' == strtolower( $provider_id ) ) {
$provider_icon = 'vk';
} else if ( 'stackoverflow' == strtolower( $provider_id ) ) {
$provider_icon = 'stack-overflow';
} else if ( 'twitchTV' == strtolower( $provider_id ) ) {
$provider_icon = 'twitch';
} else if ( 'mailru' == strtolower( $provider_id ) ) {
$provider_icon = 'envelope';
} ?>
<a href="<?php echo esc_url( $authenticate_url ); ?>" data-provider="<?php echo esc_attr( $provider_id ); ?>" class="opl-<?php echo esc_attr( strtolower( $provider_id ) ); ?>" rel="nofollow">
<i class="fa fa-<?php echo esc_attr( $provider_icon ); ?>"></i>
<span><?php echo esc_html( $provider_name ); ?></span>
</a>
<?php
}
/**
* Load custom CSS file
*
* @since 1.4.0
*/
public static function add_custom_css() {
wp_enqueue_style( 'oceanwp-wsl', OCEANWP_CSS_DIR_URI .'third/social-login.min.css' );
}
}
endif;
return new OceanWP_Social_Login();