feat: initial ACRIB WordPress deployment

- WordPress 6.9.4 (es_ES) with Kadence theme
- Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto
- Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold
- Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI)
- Plugins: Kadence Blocks, Polylang, Contact Form 7
- Custom CSS with full brand styling and responsive layout
- HTTPS enforced via wp-config.php proxy detection
This commit is contained in:
Malin
2026-05-19 19:25:59 +02:00
commit f3ff7b7186
6119 changed files with 1984255 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
<?php
/**
* Kadence\Accessibility\Component class
*
* @package kadence
*/
namespace Kadence\Accessibility;
use Kadence\Component_Interface;
use function Kadence\kadence;
use WP_Post;
use function add_action;
use function add_filter;
use function wp_enqueue_script;
use function get_theme_file_uri;
use function get_theme_file_path;
use function wp_script_add_data;
use function wp_localize_script;
/**
* Class for improving accessibility among various core features.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'accessibility';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'nav_menu_link_attributes', array( $this, 'filter_nav_menu_link_attributes_aria_current' ), 10, 2 );
add_filter( 'page_menu_link_attributes', array( $this, 'filter_nav_menu_link_attributes_aria_current' ), 10, 2 );
add_filter( 'kadence_before_header', array( $this, 'skip_to_content_link' ), 2 );
}
/**
* Prints a link to allow screen readers to skip to content.
*/
public function skip_to_content_link() {
?>
<a class="skip-link screen-reader-text scroll-ignore" href="#main"><?php esc_html_e( 'Skip to content', 'kadence' ); ?></a>
<?php
}
/**
* Filters the HTML attributes applied to a menu item's anchor element.
*
* Checks if the menu item is the current menu item and adds the aria "current" attribute.
*
* @param array $atts The HTML attributes applied to the menu item's `<a>` element.
* @param object $item The current menu item.
* @return array Modified HTML attributes
*/
public function filter_nav_menu_link_attributes_aria_current( array $atts, $item ) {
if ( isset( $item->current ) ) {
if ( $item->current ) {
$atts['aria-current'] = 'page';
}
} elseif ( ! empty( $item->ID ) ) {
global $post;
if ( ! empty( $post->ID ) && (int) $post->ID === (int) $item->ID ) {
$atts['aria-current'] = 'page';
}
}
return $atts;
}
}

View File

@@ -0,0 +1,96 @@
<?php
/**
* Kadence\AMP\Component class
*
* @package kadence
*/
namespace Kadence\AMP;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function add_action;
use function add_theme_support;
use function get_theme_support;
/**
* Class for managing AMP support.
*
* Exposes template tags:
* * `kadence()->is_amp()`
* * `kadence()->using_amp_live_list_comments()`
*
* @link https://wordpress.org/plugins/amp/
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'amp';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_amp_support' ) );
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'is_amp' => array( $this, 'is_amp' ),
'using_amp_live_list_comments' => array( $this, 'using_amp_live_list_comments' ),
);
}
/**
* Adds theme support for AMP.
*
* From here you can control how the plugin, when activated, impacts the the theme.
*/
public function action_add_amp_support() {
add_theme_support(
'amp',
array(
'comments_live_list' => true,
)
);
}
/**
* Determines whether this is an AMP response.
*
* Note that this must only be called after the parse_query action.
*
* @return bool Whether the AMP plugin is active and the current request is for an AMP endpoint.
*/
public function is_amp() : bool {
return function_exists( 'is_amp_endpoint' ) && \is_amp_endpoint();
}
/**
* Determines whether amp-live-list should be used for the comment list.
*
* @return bool Whether to use amp-live-list.
*/
public function using_amp_live_list_comments() : bool {
if ( ! $this->is_amp() ) {
return false;
}
$amp_theme_support = get_theme_support( 'amp' );
return ! empty( $amp_theme_support[0]['comments_live_list'] );
}
}

View File

@@ -0,0 +1,126 @@
<?php
/**
* Kadence\Archive_Title\Component class
*
* @package kadence
*/
namespace Kadence\Archive_Title;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function add_action;
use function apply_filters;
use function Kadence\kadence;
use function get_template_part;
/**
* Class for adding custom title area support.
*
* Exposes template tags:
* * `kadence()->render_archive_title()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'archive_title';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'get_the_archive_title', array( $this, 'filter_archive_title' ) );
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'render_archive_title' => array( $this, 'render_archive_title' ),
);
}
/**
* Update the archives to a better naming.
*
* @param string $title the name of the archive.
*/
public function filter_archive_title( $title ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
if ( is_home() && is_front_page() ) {
$title = get_bloginfo( 'name' );
} elseif ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
/* translators: 1: Author Name */
$title = sprintf( esc_html__( 'Author: %s', 'kadence' ), get_the_author() );
} elseif ( is_day() ) {
/* translators: 1: Day */
$title = sprintf( esc_html__( 'Day: %s', 'kadence' ), get_the_date() );
} elseif ( is_month() ) {
/* translators: 1: Month */
$title = sprintf( esc_html__( 'Month: %s', 'kadence' ), get_the_date( 'F Y' ) );
} elseif ( is_year() ) {
/* translators: 1: Year */
$title = sprintf( esc_html__( 'Year: %s', 'kadence' ), get_the_date( 'Y' ) );
} elseif ( class_exists( 'woocommerce' ) && is_shop() ) {
$shop_page_id = wc_get_page_id( 'shop' );
$title = get_the_title( $shop_page_id );
} elseif ( is_tax( array( 'product_cat', 'product_tag' ) ) ) {
$title = single_term_title( '', false );
} elseif ( $term ) {
$title = $term->name;
} elseif ( function_exists( 'is_bbpress' ) ) {
if ( is_bbpress() ) {
if ( bbp_is_forum_archive() ) {
$title = bbp_get_forum_archive_title();
} else {
$title = bbp_title();
}
}
} elseif ( function_exists( 'tribe_is_month' ) && ( tribe_is_month() || tribe_is_past() || tribe_is_upcoming() || tribe_is_day() ) ) {
$title = tribe_get_event_label_plural();
} elseif ( function_exists( 'tribe_is_photo' ) && ( tribe_is_map() || tribe_is_photo() || tribe_is_week() ) ) {
$title = tribe_get_event_label_plural();
} elseif ( is_post_type_archive( 'course' ) && function_exists( 'llms_get_page_id' ) ) {
$title = get_the_title( llms_get_page_id( 'courses' ) );
} elseif ( is_post_type_archive( 'llms_membership' ) && function_exists( 'llms_get_page_id' ) ) {
$title = get_the_title( llms_get_page_id( 'memberships' ) );
} elseif ( is_post_type_archive( 'ht_kb' ) ) {
$title = get_the_title();
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
}
return $title;
}
/**
* Adds support to render header columns.
*
* @param string $archive_type the name of the row.
* @param string $area the name of the area.
*/
public function render_archive_title( $archive_type = 'post_archive', $area = 'normal' ) {
$elements = kadence()->option( $archive_type . '_title_elements' );
if ( isset( $elements ) && is_array( $elements ) && ! empty( $elements ) ) {
foreach ( $elements as $item ) {
if ( kadence()->sub_option( $archive_type . '_title_element_' . $item, 'enabled' ) ) {
$template = apply_filters( 'kadence_title_elements_template_path', 'template-parts/archive-title/' . $item, $item, $area );
get_template_part( $template );
}
}
} else {
get_template_part( 'template-parts/archive-title/title' );
}
}
}

View File

@@ -0,0 +1,929 @@
<?php
/**
* Kadence\Base_Support\Component class
*
* @package kadence
*/
namespace Kadence\Base_Support;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use Kadence_Blocks_Frontend;
use Kadence_Blocks_Pro_Frontend;
use WP_Upgrader;
use WP_Ajax_Upgrader_Skin;
use Plugin_Upgrader;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function add_theme_support;
use function is_singular;
use function pings_open;
use function esc_url;
use function get_bloginfo;
use function wp_scripts;
use function wp_get_theme;
use function get_template;
use function plugins_api;
use function activate_plugin;
use function get_site_option;
use function is_customize_preview;
/**
* Class for adding basic theme support, most of which is mandatory to be implemented by all themes.
*
* Exposes template tags:
* * `kadence()->get_version()`
* * `kadence()->get_post_types()`
* * `kadence()->get_asset_version( string $filepath )`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Holds post types.
*
* @var values of all the post types.
*/
protected static $post_types = null;
/**
* Holds post types.
*
* @var values of all the post types.
*/
protected static $post_types_objects = null;
/**
* Holds ignore post types.
*
* @var values of all the post types.
*/
protected static $ignore_post_types = null;
/**
* Holds ignore post types.
*
* @var values of all the post types.
*/
protected static $public_ignore_post_types = null;
/**
* Holds ignore post types.
*
* @var values of all the post types.
*/
protected static $transparent_ignore_post_types = null;
/**
* Static var active plugins
*
* @var $active_plugins
*/
private static $active_plugins;
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'base_support';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_essential_theme_support' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'install_starter_script' ) );
// 05/06/2026: this banner is temporarily commented out until kadence starter templates experience is updated.
// add_action( 'admin_notices', array( $this, 'kadence_starter_templates_notice' ) );
add_action( 'admin_notices', array( $this, 'kadence_turn_off_gutenberg_plugin_notice' ) );
add_action( 'wp_ajax_kadence_dismiss_notice', array( $this, 'ajax_dismiss_starter_notice' ) );
add_action( 'wp_ajax_kadence_dismiss_gutenberg_notice', array( $this, 'ajax_dismiss_gutenberg_notice' ) );
add_action( 'wp_ajax_kadence_install_starter', array( $this, 'install_plugin_ajax_callback' ) );
add_action( 'wp_head', array( $this, 'action_add_pingback_header' ) );
add_action( 'wp_head', array( $this, 'action_add_no_js_remove_script' ), 2 );
add_action( 'wp_footer', array( $this, 'action_add_scrollbar_offset_script' ), 2 );
add_filter( 'body_class', array( $this, 'filter_body_classes_add_hfeed' ) );
add_filter( 'embed_defaults', array( $this, 'filter_embed_dimensions' ) );
add_filter( 'theme_scandir_exclusions', array( $this, 'filter_scandir_exclusions_for_optional_templates' ) );
add_filter( 'script_loader_tag', array( $this, 'filter_script_loader_tag' ), 10, 2 );
add_filter( 'body_class', array( $this, 'filter_body_classes_add_link_style' ) );
add_filter( 'get_search_form', array( $this, 'add_search_icon' ), 99 );
add_filter( 'get_product_search_form', array( $this, 'add_search_icon' ), 99 );
add_filter( 'embed_oembed_html', array( $this, 'classic_embed_wrap' ), 90, 4 );
add_filter( 'excerpt_length', array( $this, 'custom_excerpt_length' ) );
add_filter( 'the_author_description', 'wpautop' );
add_action( 'admin_init', array( $this, 'set_theme_initial_version' ) );
add_action( 'init', array( $this, 'setup_content_filter' ), 9 );
add_action( 'wp', array( $this, 'setup_header_block_css' ), 99 );
}
/**
* Add the header block css to the head tag.
*/
public function setup_header_block_css() {
if ( is_admin() ) {
return;
}
if ( kadence()->option( 'blocks_header' ) && defined( 'KADENCE_BLOCKS_VERSION' ) ) {
$header_id = kadence()->option( 'blocks_header_id' );
if ( ! empty( $header_id ) ) {
$header_block = get_post( $header_id );
if ( ! $header_block || 'kadence_header' !== $header_block->post_type ) {
return;
}
if ( 'publish' !== $header_block->post_status || ! empty( $header_block->post_password ) ) {
return;
}
$header_block->post_content = '<!-- wp:kadence/header {"uniqueID":"header-replace","id":' . $header_id . '} /-->';
if ( class_exists( 'Kadence_Blocks_Frontend' ) ) {
$kadence_blocks = \Kadence_Blocks_Frontend::get_instance();
if ( method_exists( $kadence_blocks, 'frontend_build_css' ) ) {
$kadence_blocks->frontend_build_css( $header_block );
}
if ( class_exists( 'Kadence_Blocks_Pro_Frontend' ) ) {
$kadence_blocks_pro = \Kadence_Blocks_Pro_Frontend::get_instance();
if ( method_exists( $kadence_blocks_pro, 'frontend_build_css' ) ) {
$kadence_blocks_pro->frontend_build_css( $header_block );
}
}
}
}
}
}
/**
* Add filters for element content output.
*/
public function setup_content_filter() {
global $wp_embed;
add_filter( 'kadence_theme_the_content', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'kadence_theme_the_content', array( $wp_embed, 'autoembed' ), 8 );
add_filter( 'kadence_theme_the_content', 'do_blocks' );
add_filter( 'kadence_theme_the_content', 'wptexturize' );
add_filter( 'kadence_theme_the_content', 'shortcode_unautop' );
add_filter( 'kadence_theme_the_content', 'wp_filter_content_tags' );
add_filter( 'kadence_theme_the_content', 'do_shortcode', 11 );
add_filter( 'kadence_theme_the_content', 'convert_smilies', 20 );
}
/**
* Set the initial theme version.
*/
public function set_theme_initial_version() {
$initial_version = get_theme_mod( 'initial_version', false );
if ( ! $initial_version ) {
set_theme_mod( 'initial_version', KADENCE_VERSION );
}
}
/**
* Add Notice for Kadence Starter templates
*/
public function kadence_starter_templates_notice() {
if ( defined( 'KADENCE_STARTER_TEMPLATES_VERSION' ) || get_option( 'kadence_starter_plugin_notice' ) || ! current_user_can( 'install_plugins' ) ) {
return;
}
$installed_plugins = get_plugins();
if ( ! isset( $installed_plugins['kadence-starter-templates/kadence-starter-templates.php'] ) ) {
$button_label = esc_html__( 'Install AI Starter Templates', 'kadence' );
$data_action = 'install';
} elseif ( ! self::active_plugin_check( 'kadence-starter-templates/kadence-starter-templates.php' ) ) {
$button_label = esc_html__( 'Activate AI Starter Templates', 'kadence' );
$data_action = 'activate';
} else {
return;
}
$config = get_option( 'kadence_starter_templates_config', '' );
$use_site_assist = apply_filters( 'kadence_starter_site_assist_enabled', true );
if ( ! empty( $config ) ) {
$config = json_decode( $config, true );
if ( isset( $config['siteAssist'] ) && 'disable' === $config['siteAssist'] ) {
$use_site_assist = false;
}
}
$starter_link = $use_site_assist || class_exists( '\\KadenceWP\\KadenceBlocks\\StellarWP\\Uplink\\Register' ) ? admin_url( 'admin.php?page=kadence-starter-templates' ) : admin_url( 'themes.php?page=kadence-starter-templates' );
?>
<div id="kadence-notice-starter-templates" class="notice is-dismissible notice-info">
<div class="sub-notice-title"><?php echo esc_html__( 'Thanks for choosing the Kadence Theme!', 'kadence' ); ?></div>
<h2 class="notice-title"><?php echo esc_html__( 'Get Started with an AI Powered Website!', 'kadence' ); ?></h2>
<p class="kadence-notice-description"><?php /* translators: %s: <strong> <a> */ printf( esc_html__( 'Want to get started with a beautiful AI Powered %1$sstarter template%2$s? Install the Kadence AI Powered Starter Templates plugin to launch an AI optimized website in minutes.', 'kadence' ), '<a href="https://wordpress.org/plugins/kadence-starter-templates/" target="_blank">', '</a>', '<strong>', '</strong>' ); ?></p>
<p class="install-submit">
<button class="button button-primary kadence-install-starter-btn" data-redirect-url="<?php echo esc_url( $starter_link ); ?>" data-activating-label="<?php echo esc_attr__( 'Activating...', 'kadence' ); ?>" data-activated-label="<?php echo esc_attr__( 'Activated', 'kadence' ); ?>" data-installing-label="<?php echo esc_attr__( 'Installing...', 'kadence' ); ?>" data-installed-label="<?php echo esc_attr__( 'Installed', 'kadence' ); ?>" data-action="<?php echo esc_attr( $data_action ); ?>"><?php echo esc_html( $button_label ); ?></button>
</p>
</div>
<style>#kadence-notice-starter-templates {padding: 24px;}#kadence-notice-starter-templates .kadence-notice-description {max-width: 600px;font-size: 15px;margin-bottom: 12px;}#kadence-notice-starter-templates button.kadence-install-starter-btn {padding: 4px 16px;font-size: 15px;}#kadence-notice-starter-templates h2.notice-title {font-size: 24px;margin-bottom: 8px;}</style>
<?php
wp_enqueue_script( 'kadence-starter-install' );
wp_localize_script(
'kadence-starter-install',
'kadenceStarterInstall',
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'ajax_nonce' => wp_create_nonce( 'kadence-ajax-verification' ),
'status' => $data_action,
)
);
}
/**
* Add Notice for to not use the Gutenberg Plugin
*/
public function kadence_turn_off_gutenberg_plugin_notice() {
if ( ! defined( 'GUTENBERG_VERSION' ) || get_option( 'kadence_disable_gutenberg_notice' ) || ! current_user_can( 'install_plugins' ) ) {
return;
}
?>
<div id="kadence-notice-gutenberg-plugin" class="notice is-dismissible notice-warning">
<h2 class="notice-title"><?php echo esc_html__( 'Gutenberg Plugin Detected', 'kadence' ); ?></h2>
<p class="kadence-notice-description"><?php /* translators: %s: <a> */ printf( esc_html__( 'The %1$sGutenberg plugin%2$s is not recommended for use in a production site. Many things may be broken by using this plugin. Please deactivate.', 'kadence' ), '<a href="https://wordpress.org/plugins/gutenberg/" target="_blank">', '</a>' ); ?></p>
</div>
<?php
wp_enqueue_script( 'kadence-gutenberg-deactivate' );
wp_localize_script(
'kadence-gutenberg-deactivate',
'kadenceGutenbergDeactivate',
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'ajax_nonce' => wp_create_nonce( 'kadence-ajax-verification' ),
)
);
}
/**
* Run check to see if we need to dismiss the notice.
* If all tests are successful then call the dismiss_notice() method.
*
* @access public
* @since 1.0
* @return void
*/
public function ajax_dismiss_gutenberg_notice() {
// Sanity check: Early exit if we're not on a wptrt_dismiss_notice action.
if ( ! isset( $_POST['action'] ) || 'kadence_dismiss_gutenberg_notice' !== $_POST['action'] ) {
return;
}
// Security check: Make sure nonce is OK.
check_ajax_referer( 'kadence-ajax-verification', 'security', true );
// If we got this far, we need to dismiss the notice.
update_option( 'kadence_disable_gutenberg_notice', true, false );
}
/**
* Run check to see if we need to dismiss the notice.
* If all tests are successful then call the dismiss_notice() method.
*
* @access public
* @since 1.0
* @return void
*/
public function ajax_dismiss_starter_notice() {
// Sanity check: Early exit if we're not on a wptrt_dismiss_notice action.
if ( ! isset( $_POST['action'] ) || 'kadence_dismiss_notice' !== $_POST['action'] ) {
return;
}
// Security check: Make sure nonce is OK.
check_ajax_referer( 'kadence-ajax-verification', 'security', true );
// If we got this far, we need to dismiss the notice.
update_option( 'kadence_starter_plugin_notice', true, false );
}
/**
* Option to Install Starter Templates
*/
public function install_starter_script() {
wp_register_script( 'kadence-starter-install', get_template_directory_uri() . '/assets/js/admin-activate.min.js', array( 'jquery' ), KADENCE_VERSION, false );
wp_register_script( 'kadence-gutenberg-deactivate', get_template_directory_uri() . '/assets/js/gutenberg-notice.min.js', array( 'jquery' ), KADENCE_VERSION, false );
}
/**
* Active Plugin Check
*
* @param string $plugin_base_name is plugin folder/filename.php.
*/
public static function active_plugin_check( $plugin_base_name ) {
if ( ! self::$active_plugins ) {
self::get_active_plugins();
}
return in_array( $plugin_base_name, self::$active_plugins, true ) || array_key_exists( $plugin_base_name, self::$active_plugins );
}
/**
* Initialize getting the active plugins list.
*/
public static function get_active_plugins() {
self::$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
}
}
/**
* AJAX callback to install a plugin.
*/
public function install_plugin_ajax_callback() {
if ( ! check_ajax_referer( 'kadence-ajax-verification', 'security', false ) ) {
wp_send_json_error( __( 'Security Error, Please reload the page.', 'kadence' ) );
}
if ( ! current_user_can( 'install_plugins' ) ) {
wp_send_json_error( __( 'Security Error, Need higher Permissions to install plugin.', 'kadence' ) );
}
// Get selected file index or set it to 0.
$status = empty( $_POST['status'] ) ? 'install' : sanitize_text_field( $_POST['status'] );
if ( ! function_exists( 'plugins_api' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
}
if ( ! class_exists( 'WP_Upgrader' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
}
$install = true;
if ( 'install' === $status ) {
$api = plugins_api(
'plugin_information',
array(
'slug' => 'kadence-starter-templates',
'fields' => array(
'short_description' => false,
'sections' => false,
'requires' => false,
'rating' => false,
'ratings' => false,
'downloaded' => false,
'last_updated' => false,
'added' => false,
'tags' => false,
'compatibility' => false,
'homepage' => false,
'donate_link' => false,
),
)
);
if ( ! is_wp_error( $api ) ) {
// Use AJAX upgrader skin instead of plugin installer skin.
// ref: function wp_ajax_install_plugin().
$upgrader = new \Plugin_Upgrader( new \WP_Ajax_Upgrader_Skin() );
$installed = $upgrader->install( $api->download_link );
if ( $installed ) {
$activate = activate_plugin( 'kadence-starter-templates/kadence-starter-templates.php', '', false, true );
if ( is_wp_error( $activate ) ) {
$install = false;
}
} else {
$install = false;
}
} else {
$install = false;
}
} elseif ( 'activate' === $status ) {
$activate = activate_plugin( 'kadence-starter-templates/kadence-starter-templates.php', '', false, true );
if ( is_wp_error( $activate ) ) {
$install = false;
}
}
if ( false === $install ) {
wp_send_json_error( __( 'Error, plugin could not be installed, please install manually.', 'kadence' ) );
} else {
wp_send_json_success();
}
}
/**
* Filter the excerpt length to 30 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
public function custom_excerpt_length( $length ) {
if ( is_admin() ) {
return $length;
}
if ( is_search() ) {
if ( kadence()->sub_option( 'search_archive_element_excerpt', 'words' ) ) {
$length = intval( kadence()->sub_option( 'search_archive_element_excerpt', 'words' ) );
}
} else if ( 'post' === get_post_type() ) {
if ( kadence()->sub_option( 'post_archive_element_excerpt', 'words' ) ) {
$length = intval( kadence()->sub_option( 'post_archive_element_excerpt', 'words' ) );
}
} else {
if ( kadence()->sub_option( get_post_type() . '_archive_element_excerpt', 'words' ) ) {
$length = intval( kadence()->sub_option( get_post_type() . '_archive_element_excerpt', 'words' ) );
}
}
return $length;
}
/**
* Remove comment date.
*
* @param string|int $date The comment time, formatted as a date string or Unix timestamp.
* @param string $format Date format.
* @param bool $gmt Whether the GMT date is in use.
* @param bool $translate Whether the time is translated.
* @param WP_Comment $comment The comment object.
*/
public function remove_comment_time( $date, $format, $gmt, $translate, $comment ) {
if ( ! is_admin() ) {
return '';
}
return $date;
}
/**
* Remove comment date.
*
* @param string|int $date Formatted date string or Unix timestamp.
* @param string $format The format of the date.
* @param WP_Comment $comment The comment object.
*/
public function remove_comment_date( $date, $format, $comment ) {
if ( ! is_admin() ) {
return '';
}
return $date;
}
/**
* Wrap embedded media for responsive embeds, pre blocks.
*
* @param string $cache The oEmbed markup.
* @param string $url The URL being embedded.
* @param array $attr An array of attributes.
* @param string $post_ID the post id.
*/
public function classic_embed_wrap( $cache, $url, $attr = array(), $post_ID = '' ) {
if ( doing_filter( 'the_content' ) && ! has_blocks() && ! empty( $cache ) && ! empty( $url ) ) {
$do_wrap = false;
$patterns = array(
'#http://((m|www)\.)?youtube\.com/watch.*#i',
'#https://((m|www)\.)?youtube\.com/watch.*#i',
'#http://((m|www)\.)?youtube\.com/playlist.*#i',
'#https://((m|www)\.)?youtube\.com/playlist.*#i',
'#http://youtu\.be/.*#i',
'#https://youtu\.be/.*#i',
'#https?://(.+\.)?vimeo\.com/.*#i',
'#https?://(www\.)?dailymotion\.com/.*#i',
'#https?://dai.ly/*#i',
'#https?://(www\.)?hulu\.com/watch/.*#i',
'#https?://wordpress.tv/.*#i',
'#https?://(www\.)?funnyordie\.com/videos/.*#i',
'#https?://vine.co/v/.*#i',
'#https?://(www\.)?collegehumor\.com/video/.*#i',
'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'
);
$patterns = apply_filters( 'kadence_maybe_wrap_embed_patterns', $patterns );
foreach ( $patterns as $pattern ) {
$do_wrap = preg_match( $pattern, $url );
if ( $do_wrap ) {
return '<div class="entry-content-asset videofit">' . $cache . '</div>';
}
}
}
return $cache;
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'get_version' => array( $this, 'get_version' ),
'get_asset_version' => array( $this, 'get_asset_version' ),
'get_post_types' => array( $this, 'get_post_types' ),
'get_post_types_objects' => array( $this, 'get_post_types_objects' ),
'get_post_types_to_ignore' => array( $this, 'get_post_types_to_ignore' ),
'get_transparent_post_types_to_ignore' => array( $this, 'get_transparent_post_types_to_ignore' ),
'get_public_post_types_to_ignore' => array( $this, 'get_public_post_types_to_ignore' ),
'customizer_quick_link' => array( $this, 'customizer_quick_link' ),
);
}
/**
* If in customizer output the quicklink.
*/
public static function customizer_quick_link() {
if ( is_customize_preview() ) {
?>
<div class="customize-partial-edit-shortcut kadence-custom-partial-edit-shortcut">
<button aria-label="<?php esc_attr_e( 'Click to edit this element.', 'kadence' ); ?>" title="<?php esc_attr_e( 'Click to edit this element.', 'kadence' ); ?>" class="customize-partial-edit-shortcut-button item-customizer-focus"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z"></path></svg></button>
</div>
<?php
}
}
/**
* Get array of post types we want to exclude from use in customizer custom post type settings.
*
* @return array of post types.
*/
public static function get_post_types_to_ignore() {
if ( is_null( self::$ignore_post_types ) ) {
$ignore_post_types = array(
'post',
'page',
'product',
'kadence_element',
'kadence_adv_page',
'kadence_conversions',
'kadence_cloud',
'kadence_wootemplate',
'elementor_library',
'kt_size_chart',
'kt_cart_notice',
'kt_reviews',
'kt_product_tabs',
'ele-product-template',
'ele-p-arch-template',
'ele-p-loop-template',
'ele-check-template',
'shop_order',
'jet-menu',
'jet-popup',
'jet-smart-filters',
'jet-theme-core',
'jet-woo-builder',
'jet-engine',
'course',
'lesson',
'llms_quiz',
'llms_membership',
'llms_certificate',
'llms_my_certificate',
'sfwd-quiz',
'sfwd-certificates',
'sfwd-lessons',
'sfwd-topic',
'sfwd-transactions',
'sfwd-essays',
'sfwd-assignment',
'sfwd-courses',
'tutor_quiz',
'tutor_assignments',
'courses',
'groups',
'forum',
'topic',
'reply',
'tribe_events',
);
self::$ignore_post_types = apply_filters( 'kadence_customizer_post_type_ignore_array', $ignore_post_types );
}
return self::$ignore_post_types;
}
/**
* Get array of post types we want to exclude from use in customizer transparent header settings.
*
* @return array of post types.
*/
public static function get_transparent_post_types_to_ignore() {
if ( is_null( self::$transparent_ignore_post_types ) ) {
$transparent_ignore_post_types = array(
'post',
'page',
'product',
'kadence_element',
'kadence_adv_page',
'kadence_conversions',
'kadence_cloud',
'kadence_wootemplate',
'elementor_library',
'fl-theme-layout',
'kt_size_chart',
'kt_cart_notice',
'kt_reviews',
'kt_product_tabs',
'shop_order',
'ele-product-template',
'ele-p-arch-template',
'ele-p-loop-template',
'ele-check-template',
'jet-menu',
'jet-popup',
'jet-smart-filters',
'jet-theme-core',
'jet-woo-builder',
'jet-engine',
'llms_certificate',
'llms_my_certificate',
'sfwd-quiz',
'ld-exam',
'sfwd-certificates',
'sfwd-lessons',
'sfwd-topic',
'sfwd-transactions',
'sfwd-essays',
'sfwd-assignment',
'tutor_quiz',
'tutor_assignments',
);
self::$transparent_ignore_post_types = apply_filters( 'kadence_transparent_post_type_ignore_array', $transparent_ignore_post_types );
}
return self::$transparent_ignore_post_types;
}
/**
* Get array of post types we want to exclude from use in non public areas.
*
* @return array of post types.
*/
public static function get_public_post_types_to_ignore() {
if ( is_null( self::$public_ignore_post_types ) ) {
$public_ignore_post_types = array(
'elementor_library',
'fl-theme-layout',
'kt_size_chart',
'kt_cart_notice',
'kt_reviews',
'kt_product_tabs',
'shop_order',
'kadence_element',
'kadence_adv_page',
'kadence_conversions',
'kadence_cloud',
'kadence_wootemplate',
'ele-product-template',
'ele-p-arch-template',
'ele-p-loop-template',
'ele-check-template',
'jet-menu',
'jet-popup',
'jet-smart-filters',
'jet-theme-core',
'jet-woo-builder',
'jet-engine',
'llms_certificate',
'llms_my_certificate',
'sfwd-certificates',
'sfwd-transactions',
'reply',
);
self::$public_ignore_post_types = apply_filters( 'kadence_public_post_type_ignore_array', $public_ignore_post_types );
}
return self::$public_ignore_post_types;
}
/**
* Get all public post types.
*
* @return array of post types.
*/
public static function get_post_types() {
if ( is_null( self::$post_types ) ) {
$args = array(
'public' => true,
'show_in_rest' => true,
'_builtin' => false,
);
$builtin = array(
'post',
'page',
);
$output = 'names'; // names or objects, note names is the default.
$operator = 'and';
$post_types = get_post_types( $args, $output, $operator );
self::$post_types = apply_filters( 'kadence_public_post_type_array', array_merge( $builtin, $post_types ) );
}
return self::$post_types;
}
/**
* Get all public post types.
*
* @return array of post types.
*/
public static function get_post_types_objects() {
if ( is_null( self::$post_types_objects ) ) {
$args = array(
'public' => true,
'_builtin' => false,
);
$output = 'objects'; // names or objects, note names is the default.
$operator = 'and';
$post_types = get_post_types( $args, $output, $operator );
self::$post_types_objects = apply_filters( 'kadence_public_post_type_objects', $post_types );
}
return self::$post_types_objects;
}
/**
* Adds theme support for essential features.
*/
public function action_essential_theme_support() {
if ( 'em' === kadence()->sub_option( 'content_width', 'unit' ) || 'rem' === kadence()->sub_option( 'content_width', 'unit' ) ) {
$kadence_content_width = intval( kadence()->sub_option( 'content_width', 'size' ) * 17 );
} else {
$kadence_content_width = kadence()->sub_option( 'content_width', 'size' );
}
$GLOBALS['content_width'] = intval( $kadence_content_width ); // phpcs:ignore WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound
// Add default RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Ensure WordPress manages the document title.
add_theme_support( 'title-tag' );
// Ensure WordPress theme features render in HTML5 markup.
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
)
);
add_theme_support( 'custom-units' );
add_theme_support( 'custom-line-height' );
// Add support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
if ( ! kadence()->option( 'post_comments_date' ) ) {
add_filter( 'get_comment_date', array( $this, 'remove_comment_date' ), 20, 3 );
add_filter( 'get_comment_time', array( $this, 'remove_comment_time' ), 20, 5 );
}
}
/**
* Adds a tiny script to remove no-js class.
*/
public function action_add_no_js_remove_script() {
if ( ! kadence()->is_amp() ) {
?>
<script>document.documentElement.classList.remove( 'no-js' );</script>
<?php
}
}
/**
* Adds a tiny script to set scrollbar offset.
*/
public function action_add_scrollbar_offset_script() {
if ( ! kadence()->is_amp() ) {
?>
<script>document.documentElement.style.setProperty('--scrollbar-offset', window.innerWidth - document.documentElement.clientWidth + 'px' );</script>
<?php
}
}
/**
* Adds a pingback url auto-discovery header for singularly identifiable articles.
*/
public function action_add_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
}
}
/**
* Add
*
* @param string $markup search form markup.
*
* @return mixed
*/
public function add_search_icon( $markup ) {
$markup = str_replace( '</form>', '<div class="kadence-search-icon-wrap">' . kadence()->get_icon( 'search', '', false ) . '</div></form>', $markup );
return $markup;
}
/**
* Adds a 'hfeed' class to the array of body classes for non-singular pages.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function filter_body_classes_add_hfeed( array $classes ) : array {
// Check if we should add the hfeed class.
if ( ! kadence()->option( 'microdata' ) || ! apply_filters( 'kadence_microdata', true, 'body-class' ) ) {
return $classes;
}
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
return $classes;
}
/**
* Adds a link style class to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function filter_body_classes_add_link_style( array $classes ) : array {
if ( ! kadence()->option( 'enable_scroll_to_id' ) ) {
$classes[] = 'no-anchor-scroll';
}
if ( kadence()->option( 'enable_footer_on_bottom' ) ) {
$classes[] = 'footer-on-bottom';
}
if ( kadence()->option( 'enable_popup_body_animate' ) ) {
$classes[] = 'animate-body-popup';
}
if ( '' !== kadence()->option( 'header_social_brand' ) || '' !== kadence()->option( 'header_mobile_social_brand' ) || '' !== kadence()->option( 'footer_social_brand' ) ) {
$classes[] = 'social-brand-colors';
}
$classes[] = 'hide-focus-outline';
$classes[] = 'link-style-' . kadence()->sub_option( 'link_color', 'style' );
return $classes;
}
/**
* Sets the embed width in pixels, based on the theme's design and stylesheet.
*
* @param array $dimensions An array of embed width and height values in pixels (in that order).
* @return array Filtered dimensions array.
*/
public function filter_embed_dimensions( array $dimensions ) : array {
$dimensions['width'] = 720;
return $dimensions;
}
/**
* Excludes any directory named 'optional' from being scanned for theme template files.
*
* @link https://developer.wordpress.org/reference/hooks/theme_scandir_exclusions/
*
* @param array $exclusions the default directories to exclude.
* @return array Filtered exclusions.
*/
public function filter_scandir_exclusions_for_optional_templates( array $exclusions ) : array {
return array_merge(
$exclusions,
array( 'optional' )
);
}
/**
* Adds async/defer attributes to enqueued / registered scripts.
*
* If #12009 lands in WordPress, this function can no-op since it would be handled in core.
*
* @link https://core.trac.wordpress.org/ticket/12009
*
* @param string $tag The script tag.
* @param string $handle The script handle.
* @return string Script HTML string.
*/
public function filter_script_loader_tag( $tag, $handle ) {
foreach ( array( 'async', 'defer' ) as $attr ) {
if ( ! wp_scripts()->get_data( $handle, $attr ) ) {
continue;
}
// Prevent adding attribute when already added in #12009.
if ( ! preg_match( ":\s$attr(=|>|\s):", $tag ) ) {
$tag = preg_replace( ':(?=></script>):', " $attr", $tag, 1 );
}
// Only allow async or defer, not both.
break;
}
return $tag;
}
/**
* Gets the theme version.
*
* @return string Theme version number.
*/
public function get_version() : string {
static $theme_version = null;
if ( null === $theme_version ) {
$theme_version = wp_get_theme( get_template() )->get( 'Version' );
}
return $theme_version;
}
/**
* Gets the version for a given asset.
*
* Returns filemtime when WP_DEBUG is true, otherwise the theme version.
*
* @param string $filepath Asset file path.
* @return string Asset version number.
*/
public function get_asset_version( string $filepath ) : string {
if ( WP_DEBUG ) {
return (string) filemtime( $filepath );
}
return $this->get_version();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
<?php
/**
* Kadence\Beaver\Component class
*
* @package kadence
*/
namespace Kadence\Beaver;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
use FLBuilderModel;
/**
* Class for adding Woocommerce plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'beaver';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'kadence_entry_content_class', array( $this, 'filter_content_entry_class' ) );
}
/**
* Filters the content entry class for beaver builder so css doesn't conflict.
*
* @param string $class the entry container class.
*/
public function filter_content_entry_class( $class ) {
if ( FLBuilderModel::is_builder_enabled() ) {
$class = 'entry-content';
}
return $class;
}
}

View File

@@ -0,0 +1,101 @@
<?php
/**
* Kadence\BeaverThemer\Component class
*
* @package kadence
*/
namespace Kadence\BeaverThemer;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_theme_support;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
use FLThemeBuilderLayoutData;
/**
* Class for adding Woocommerce plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'beaverthemer';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_beaver_support' ) );
add_filter( 'fl_theme_builder_part_hooks', array( $this, 'register_part_hooks' ) );
add_action( 'wp', array( $this, 'header_footer_render' ) );
}
/**
* Adds theme support for the Beaver builder plugin.
*/
public function action_add_beaver_support() {
add_theme_support( 'fl-theme-builder-headers' );
add_theme_support( 'fl-theme-builder-footers' );
add_theme_support( 'fl-theme-builder-parts' );
}
/**
* Adds theme support for the Beaver hooks.
*/
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 header and hook in Theme Builder's.
if ( ! empty( $header_ids ) ) {
remove_action( 'kadence_header', 'Kadence\header_markup' );
add_action( 'kadence_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( 'kadence_footer', 'Kadence\footer_markup' );
add_action( 'kadence_footer', 'FLThemeBuilderLayoutRenderer::render_footer' );
}
}
/**
* Adds theme support for the Beaver hooks.
*/
public function register_part_hooks() {
return array(
array(
'label' => 'Header',
'hooks' => array(
'kadence_before_header' => 'Before Header',
'kadence_after_header' => 'After Header',
),
),
array(
'label' => 'Content',
'hooks' => array(
'kadence_before_main_content' => 'Before Content',
'kadence_after_main_content' => 'After Content',
),
),
array(
'label' => 'Footer',
'hooks' => array(
'kadence_before_footer' => 'Before Footer',
'kadence_after_footer' => 'After Footer',
),
),
);
}
}

View File

@@ -0,0 +1,823 @@
<?php
/**
* Kadence\Breadcrumbs\Component class
*
* @package kadence
*/
namespace Kadence\Breadcrumbs;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use WPSEO_Primary_Term;
use WPSEO_Taxonomy_Meta;
use WP_Post;
use function add_action;
use function add_filter;
use function wp_enqueue_script;
use function get_theme_file_uri;
use function get_theme_file_path;
use function wp_script_add_data;
use function wp_localize_script;
use function rank_math_the_breadcrumbs;
use function yoast_breadcrumb;
use function seopress_display_breadcrumbs;
use function is_bbpress;
use function bbp_breadcrumb;
/**
* Class for adding custom header support.
*
* Exposes template tags:
* * `kadence()->get_breadcrumb()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Instance Control
*
* @var array
*/
protected static $instance = null;
/**
* Breadcrumb separator.
*
* @var string/null
*/
private $sep = null;
/**
* Breadcrumb link.
*
* @var string/null
*/
private $link = null;
/**
* Breadcrumb settings.
*
* @var array
*/
private $settings = array();
/**
* Local breadcrumb args.
*
* @var array
*/
private $args = array();
/**
* Breadcrumb post types.
*
* @var array
*/
private $post_types = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'breadcrumbs';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'get_breadcrumb' => array( $this, 'get_breadcrumb' ),
'print_breadcrumb' => array( $this, 'print_breadcrumb' ),
);
}
/**
* Get the breadcrumbs.
*
* @param array $args Arguments.
*/
public function print_breadcrumb( $args = array() ) {
if ( 'rankmath' === kadence()->option( 'breadcrumb_engine' ) ) {
if ( function_exists( 'rank_math_the_breadcrumbs' ) ) {
echo '<div class="kadence-breadcrumbs rankmath-bc-wrap">';
rank_math_the_breadcrumbs();
echo '</div>';
}
} elseif ( 'yoast' === kadence()->option( 'breadcrumb_engine' ) ) {
if ( function_exists( 'yoast_breadcrumb' ) ) {
yoast_breadcrumb( '<div class="kadence-breadcrumbs yoast-bc-wrap">','</div>' );
}
} elseif ( 'seopress' === kadence()->option( 'breadcrumb_engine' ) ) {
if ( function_exists( 'seopress_display_breadcrumbs' ) ) {
echo '<div class="kadence-breadcrumbs seopress-bc-wrap">';
seopress_display_breadcrumbs();
echo '</div>';
}
} else {
if ( function_exists( 'is_bbpress' ) && is_bbpress() && function_exists( 'bbp_breadcrumb' ) ) {
echo '<div class="kadence-breadcrumbs bbpress-topic-meta">';
bbp_breadcrumb();
echo '</div>';
} else {
echo kadence()->get_breadcrumb( $args );
}
}
}
/**
* Get the breadcrumbs.
*
* @param array $args Arguments.
* @return string
*/
public function get_breadcrumb( $args = array() ) {
$this->args = apply_filters(
'kadence_local_breadcrumb_args',
wp_parse_args(
$args,
array(
'home_title' => __( 'Home', 'kadence' ),
'404_title' => __( 'Error 404', 'kadence' ),
'search_title' => __( 'Search results for', 'kadence' ),
'page' => __( 'Page', 'kadence' ),
'show_shop' => true,
'show_title' => true,
'color_style' => '',
'blog_id' => '',
'portfolio_id' => '',
'staff_id' => '',
'testimonial_id' => '',
'gallery_id' => 'none',
)
)
);
$this->settings = wp_parse_args(
apply_filters( 'kadence_breadcrumb_args', array() ),
array(
'home' => true,
'home_icon' => kadence()->option( 'breadcrumb_home_icon' ),
'before' => '<span class="kadence-bread-current">',
'after' => '</span>',
'home_link' => home_url( '/' ),
'wrap_before' => '<nav id="kadence-breadcrumbs" aria-label="' . esc_attr__( 'Breadcrumbs', 'kadence' ) . '" class="kadence-breadcrumbs"><div class="kadence-breadcrumb-container"' . ( $this->args['color_style'] ? ' style="' . esc_attr( $this->args['color_style'] ) . '"' : '' ) . '>',
'wrap_after' => '</div></nav>',
'delimiter' => apply_filters( 'kadence_breadcrumb_delimiter', '/' ),
'delimiter_before' => '<span class="bc-delimiter">',
'delimiter_after' => '</span>',
'link_before' => '<span>',
'link_after' => '</span>',
'link_in_before' => '<span>',
'link_in_after' => '</span>',
)
);
$this->post_types = wp_parse_args(
apply_filters( 'kadence_breadcrumb_post_types', array() ),
array(
'product' => array(
'post_type' => 'product',
'taxonomy' => 'product_cat',
'archive_page' => 'shop',
'archive_label' => '',
),
'portfolio' => array(
'post_type' => 'portfolio',
'taxonomy' => 'portfolio-type',
'archive_page' => $this->args['portfolio_id'],
'archive_label' => '',
),
'post' => array(
'post_type' => 'post',
'taxonomy' => 'category',
'archive_page' => $this->args['blog_id'],
'archive_label' => '',
),
'staff' => array(
'post_type' => 'staff',
'taxonomy' => 'staff-group',
'archive_page' => $this->args['staff_id'],
'archive_label' => '',
),
'testimonial' => array(
'post_type' => 'testimonial',
'taxonomy' => 'testimonial-group',
'archive_page' => $this->args['testimonial_id'],
'archive_label' => '',
),
'kt_gallery' => array(
'post_type' => 'kt_gallery',
'taxonomy' => 'kt_album',
'archive_page' => $this->args['gallery_id'],
'archive_label' => '',
),
'tribe_events' => array(
'post_type' => 'tribe_events',
'taxonomy' => 'tribe_events_cat',
'archive_page' => 'tribe_events',
'archive_label' => '',
),
'event' => array(
'post_type' => 'event',
'taxonomy' => 'event-category',
'archive_page' => '',
'archive_label' => '',
),
'podcast' => array(
'post_type' => 'podcast',
'taxonomy' => 'series',
'archive_page' => '',
'archive_label' => '',
),
'course' => array(
'post_type' => 'course',
'taxonomy' => 'course_cat',
'archive_page' => get_option( 'lifterlms_shop_page_id' ),
'archive_label' => '',
),
'lesson' => array(
'post_type' => 'lesson',
'taxonomy' => '',
'custom' => 'liferlms',
'archive_page' => get_option( 'lifterlms_shop_page_id' ),
'archive_label' => '',
),
'ht_kb' => array(
'post_type' => 'ht_kb',
'taxonomy' => 'ht_kb_category',
'archive_page' => 'archive',
'archive_label' => esc_html__( 'Knowledge Base', 'kadence' ),
),
)
);
$html = '';
if ( ! is_front_page() ) {
$html .= $this->settings['wrap_before'];
if ( $this->settings['home'] ) {
$html .= $this->get_crumbs_frontpage() . $this->get_sep();
}
$html = apply_filters( 'kadence_breadcrumbs_after_home', $html );
if ( is_home() ) {
$html .= $this->get_crumbs_home();
} elseif ( is_404() ) {
$html .= $this->get_crumbs_404();
} elseif ( is_search() ) {
$html .= $this->get_crumbs_search();
} elseif ( is_attachment() ) {
$html .= $this->get_crumbs_attachment();
} elseif ( function_exists( 'is_shop' ) && is_shop() ) {
$html .= $this->get_crumbs_shop();
} elseif ( is_single() ) {
$html .= $this->get_crumbs_single();
} elseif ( is_page() ) {
$html .= $this->get_crumbs_page();
} elseif ( is_singular() && ! is_attachment() ) {
$html .= $this->get_crumbs_single();
} elseif ( function_exists( 'is_product_category' ) && is_product_category() ) {
$html .= $this->get_crumbs_product_category();
} elseif ( function_exists( 'is_product_tag' ) && is_product_tag() ) {
$html .= $this->get_crumbs_product_tag();
} elseif ( $this->is_wc_attribute() ) {
$html .= $this->get_crumbs_product_attribute();
} elseif ( function_exists( 'dokan_is_store_page' ) && dokan_is_store_page() ) {
$html .= $this->get_crumbs_dokan_store();
} elseif ( is_category() ) {
$html .= $this->get_crumbs_category();
} elseif ( is_tag() ) {
$html .= $this->get_crumbs_tag();
} elseif ( is_tax() ) {
$html .= $this->get_crumbs_tax();
} elseif ( is_date() ) {
$html .= $this->get_crumbs_date();
} elseif ( is_author() ) {
$html .= $this->get_crumbs_author();
} elseif ( is_archive() ) {
$html .= $this->get_crumbs_archive();
} else {
$html .= $this->settings['before'] . get_the_title() . $this->settings['after'];
}
if ( get_query_var( 'paged' ) ) {
$html .= ' - ' . $this->args['page'] . ' ' . esc_html( get_query_var( 'paged' ) );
}
$html .= $this->settings['wrap_after'];
}
/**
* Change the breadcrumbs HTML output.
*
* @param string $html HTML output.
*/
return apply_filters( 'kadence_breadcrumb_html', $html );
}
/**
* Check for wc_attribute_archive.
*/
public function is_wc_attribute() {
/**
* Attributes are proper taxonomies, therefore first thing is
* to check if we are on a taxonomy page using the is_tax().
* Also, a further check if the taxonomy_is_product_attribute
* function exists is necessary, in order to ensure that this
* function does not produce fatal errors when the WooCommerce
* is not activated
*/
if ( is_tax() && function_exists( 'taxonomy_is_product_attribute') ) {
// now we know for sure that the queried object is a taxonomy
$tax_obj = get_queried_object();
return taxonomy_is_product_attribute( $tax_obj->taxonomy );
}
return false;
}
/**
* Get Separator
*/
public function get_sep() {
if ( is_null( $this->sep ) ) {
$this->sep = ' ' . $this->settings['delimiter_before'] . $this->settings['delimiter'] . $this->settings['delimiter_after'] . ' ';
}
return $this->sep;
}
/**
* Get link string
*/
public function get_link() {
if ( is_null( $this->link ) ) {
$this->link = $this->settings['link_before'] . '<a href="%1$s" itemprop="url" ' . ( $this->args['color_style'] ? 'style="' . esc_attr( $this->args['color_style'] ) . '"' : '' ) . '>' . $this->settings['link_in_before'] . '%2$s' . $this->settings['link_in_after'] . '</a>' . $this->settings['link_after'];
}
return $this->link;
}
/**
* Get Breadcrumb Term Title
*
* @param object $term the current term.
*/
private function get_breadcrumb_term_title( $term ) {
$title = '';
if ( class_exists( 'WPSEO_Taxonomy_Meta' ) ) {
$title = WPSEO_Taxonomy_Meta::get_term_meta( $term, $term->taxonomy, 'bctitle' );
} elseif ( class_exists( 'RankMath' ) ) {
$title = get_metadata( 'term', $term->term_id, 'rank_math_breadcrumb_title', false );
if ( is_array( $title ) && ! empty( $title ) ) {
$title = $title[0];
}
}
if ( ! is_string( $title ) || '' === $title ) {
$title = $term->name;
}
return $title;
}
/**
* Get Home Breadcrumb
*/
private function get_crumbs_frontpage() {
if ( $this->settings['home_icon'] ) {
$output = $this->settings['link_before'] . '<a href="' . esc_url( $this->settings['home_link'] ) . '" title="'. esc_attr( $this->args['home_title'] ) . '" itemprop="url" class="kadence-bc-home kadence-bc-home-icon" ' . ( $this->args['color_style'] ? 'style="' . esc_attr( $this->args['color_style'] ) . '"' : '' ) . '>' . $this->settings['link_in_before'] . kadence()->get_icon( 'home' ) . $this->settings['link_in_after'] . '</a>' . $this->settings['link_after'];
} else {
$output = $this->settings['link_before'] . '<a href="' . esc_url( $this->settings['home_link'] ) . '" itemprop="url" class="kadence-bc-home" ' . ( $this->args['color_style'] ? 'style="' . esc_attr( $this->args['color_style'] ) . '"' : '' ) . '>' . $this->settings['link_in_before'] . esc_html( $this->args['home_title'] ) . $this->settings['link_in_after'] . '</a>' . $this->settings['link_after'];
}
return $output;
}
/**
* Get Home Breadcrumb
*/
private function get_crumbs_home() {
return $this->settings['before'] . get_the_title( get_option( 'page_for_posts' ) ) . $this->settings['after'];
}
/**
* Get 404 Breadcrumb
*/
private function get_crumbs_404() {
return $this->settings['before'] . $this->args['404_title'] . $this->settings['after'];
}
/**
* Get search Breadcrumb
*/
private function get_crumbs_search() {
$html = '';
if ( array_key_exists( 'ht-kb-search', $_REQUEST ) ) {
if ( $this->post_types['ht_kb']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['ht_kb']['archive_page'], $this->post_types['ht_kb']['archive_label'] );
}
}
return $html . $this->settings['before'] . $this->args['search_title'] . ' "' . get_search_query() . '"' . $this->settings['after'];
}
/**
* Get attachment Breadcrumb
*/
private function get_crumbs_attachment() {
global $post;
$parent_id = $post->post_parent;
$html = '';
$parentcrumbs = array();
if ( $parent_id ) {
while ( $parent_id ) {
$page = get_page( $parent_id );
$parentcrumbs[] = sprintf( $this->get_link(), get_permalink( $page->ID ), get_the_title( $page->ID ) ) . $this->get_sep();
$parent_id = $page->post_parent;
}
}
$parentcrumbs = array_reverse( $parentcrumbs );
foreach ( $parentcrumbs as $parentcrumb ) {
$html .= $parentcrumb;
}
$html .= $this->settings['before'] . get_the_title() . $this->settings['after'];
return $html;
}
/**
* Get shop page Breadcrumb
*/
private function get_crumbs_shop() {
$shop_page_id = wc_get_page_id( 'shop' );
$page_title = get_the_title( $shop_page_id );
return $this->settings['before'] . $page_title . $this->settings['after'];
}
/**
* Get shop Breadcrumb
*/
private function get_shop_crumb() {
$shop_page_id = wc_get_page_id( 'shop' );
$shop_page = get_post( $shop_page_id );
$shop_bread = '';
if ( get_option( 'page_on_front' ) !== $shop_page_id ) {
$shop_bread = sprintf( $this->get_link(), get_permalink( $shop_page ), get_the_title( $shop_page_id ) ) . $this->get_sep();
}
return $shop_bread;
}
/**
* Get product category
*/
private function get_crumbs_product_category() {
$html = '';
if ( $this->args['show_shop'] ) {
$html .= $this->get_shop_crumb();
}
$ancestors = get_ancestors( get_queried_object()->term_id, 'product_cat' );
$ancestors = array_reverse( $ancestors );
foreach ( $ancestors as $ancestor ) {
$ancestor = get_term( $ancestor, 'product_cat' );
$html .= sprintf( $this->get_link(), get_term_link( $ancestor->slug, 'product_cat' ), $this->get_breadcrumb_term_title( $ancestor ) ) . $this->get_sep();
}
return $html . $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'];
}
/**
* Get product tag
*/
private function get_crumbs_product_tag() {
$html = '';
if ( $this->args['show_shop'] ) {
$html .= $this->get_shop_crumb();
}
return $html . $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'];
}
/**
* Get product attributes.
*/
private function get_crumbs_product_attribute() {
$html = '';
if ( $this->args['show_shop'] ) {
$html .= $this->get_shop_crumb();
}
return $html . $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'];
}
/**
* Get dokan store.
*/
private function get_crumbs_dokan_store() {
$html = '';
$store_user = dokan()->vendor->get( get_query_var( 'author' ) );
return $html . $this->settings['before'] . $store_user->get_shop_name() . $this->settings['after'];
}
/**
* Check if has post archive.
*
* @param string $post_type the post type.
*/
private function check_has_archive( $post_type ) {
if ( ! isset( $post_type ) ) {
return false;
}
// find custom post types with archives.
$args = array(
'has_archive' => true,
'_builtin' => false,
);
$output = 'names';
$archived_custom_post_types = get_post_types( $args, $output );
// if there are no custom post types, then the current post can't be one.
if ( empty( $archived_custom_post_types ) ) {
return false;
}
// check if post type is a supports archives.
if ( in_array( $post_type, $archived_custom_post_types ) ) {
return true;
} else {
return false;
}
// if all else fails, return false.
return false;
}
/**
* Get archive Breadcrumb
*
* @param mixed $archive_page the archive page for breadcrumbs.
* @param string $archive_label the archive page label for breadcrumbs.
*/
private function get_archive_crumb( $archive_page, $archive_label = '' ) {
$html = '';
if ( is_numeric( $archive_page ) ) {
// Check if page ID.
$parent_page_link = get_page_link( $archive_page );
if ( $parent_page_link ) {
$html .= sprintf( $this->get_link(), $parent_page_link, get_the_title( $archive_page ) ) . $this->get_sep();
}
} elseif ( 'shop' === $archive_page ) {
if ( ! is_archive() && ! $this->args['show_shop'] ) {
$html .= '';
} else {
$html .= $this->get_shop_crumb();
}
} elseif ( 'tribe_events' === $archive_page ) {
// Check for tribe.
$html .= sprintf( $this->get_link(), tribe_get_events_link(), tribe_get_event_label_plural() ) . $this->get_sep();
} elseif ( 'none' === $archive_page ) {
// Check for none.
$html .= '';
} elseif ( 'archive' === $archive_page ) {
$parent_title = ( ! empty( $archive_label ) ? $archive_label : 'Archive' );
$html .= sprintf( $this->get_link(), get_post_type_archive_link( get_post_type() ), $parent_title ) . $this->get_sep();
} elseif ( filter_var( $archive_page, FILTER_VALIDATE_URL ) ) {
// Check if url.
$parent_title = ( ! empty( $archive_label ) ? $archive_label : 'Archive' );
$html .= sprintf( $this->get_link(), $archive_page, $parent_title ) . $this->get_sep();
} elseif ( $this->check_has_archive( get_post_type() ) ) {
$post_type_obj = get_post_type_object( get_post_type() );
$parent_title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, get_post_type() );
$html .= sprintf( $this->get_link(), get_post_type_archive_link( get_post_type() ), $parent_title ) . $this->get_sep();
}
return $html;
}
/**
* Get main tax.
*
* @param string $taxonomy the taxonomy name.
* @param number $post_id the post id.
*/
private function get_taxonomy_main( $taxonomy, $post_id ) {
$main_term = '';
$terms = wp_get_post_terms(
$post_id,
$taxonomy,
array(
'orderby' => 'parent',
'order' => 'DESC',
)
);
if ( $terms && ! is_wp_error( $terms ) ) {
if ( is_array( $terms ) ) {
$main_term = $terms[0];
}
}
return $main_term;
}
/**
* Get tax Breadcrumb
*
* @param string $taxonomy the taxonomy type for breadcrumbs.
*/
private function get_taxonomy_crumb( $taxonomy ) {
global $post;
$html = '';
$main_term = '';
if ( class_exists( 'WPSEO_Primary_Term' ) ) {
$wpseo_term = new WPSEO_Primary_Term( $taxonomy, $post->ID );
$wpseo_term = $wpseo_term->get_primary_term();
$wpseo_term = get_term( $wpseo_term );
if ( is_wp_error( $wpseo_term ) ) {
$main_term = $this->get_taxonomy_main( $taxonomy, $post->ID );
} else {
$main_term = $wpseo_term;
}
} elseif ( class_exists( 'RankMath' ) ) {
$wpseo_term = get_post_meta( $post->ID, 'rank_math_primary_' . $taxonomy, true );
if ( $wpseo_term ) {
$wpseo_term = get_term( $wpseo_term );
if ( is_wp_error( $wpseo_term ) ) {
$main_term = $this->get_taxonomy_main( $taxonomy, $post->ID );
} else {
$main_term = $wpseo_term;
}
} else {
$main_term = $this->get_taxonomy_main( $taxonomy, $post->ID );
}
} else {
$main_term = $this->get_taxonomy_main( $taxonomy, $post->ID );
}
if ( $main_term && ! is_wp_error( $main_term ) ) {
$ancestors = get_ancestors( $main_term->term_id, $taxonomy );
$ancestors = array_reverse( $ancestors );
foreach ( $ancestors as $ancestor ) {
$ancestor = get_term( $ancestor, $taxonomy );
$html .= sprintf( $this->get_link(), get_term_link( $ancestor->slug, $taxonomy ), $this->get_breadcrumb_term_title( $ancestor ) ) . $this->get_sep();
}
$term_link = get_term_link( $main_term->slug, $taxonomy );
if ( $term_link && ! is_wp_error( $term_link ) ) {
$html .= sprintf( $this->get_link(), $term_link, $this->get_breadcrumb_term_title( $main_term ) ) . $this->get_sep();
}
}
return $html;
}
/**
* Get Custom Breadcrumb
*
* @param string $custom the custom string for breadcrumbs.
*/
private function get_custom_crumb( $custom ) {
global $post;
$html = '';
if ( 'liferlms' === $custom ) {
$parent_course = get_post_meta( $post->ID, '_llms_parent_course', true );
if ( $parent_course ) {
$html .= sprintf( $this->get_link(), get_permalink( $parent_course ), get_the_title( $parent_course ) ) . $this->get_sep();
}
}
return $html;
}
/**
* Get category
*/
private function get_crumbs_category() {
$html = '';
if ( $this->post_types['post']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['post']['archive_page'], $this->post_types['post']['archive_label'] );
}
$ancestors = get_ancestors( get_queried_object()->term_id, 'category' );
$ancestors = array_reverse( $ancestors );
foreach ( $ancestors as $ancestor ) {
$ancestor = get_term( $ancestor, 'category' );
$html .= sprintf( $this->get_link(), get_term_link( $ancestor->slug, 'category' ), $this->get_breadcrumb_term_title( $ancestor ) ) . $this->get_sep();
}
$title_output = ( $this->args['show_title'] ? $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'] : '' );
return $html . $title_output;
}
/**
* Get tag
*/
private function get_crumbs_tag() {
$html = '';
if ( $this->post_types['post']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['post']['archive_page'], $this->post_types['post']['archive_label'] );
}
$title_output = ( $this->args['show_title'] ? $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'] : '' );
return $html . $title_output;
}
/**
* Get author
*/
private function get_crumbs_author() {
global $author;
$html = '';
if ( $this->post_types['post']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['post']['archive_page'], $this->post_types['post']['archive_label'] );
}
$userdata = get_userdata( $author );
$title_output = ( $this->args['show_title'] ? $this->settings['before'] . $userdata->display_name . $this->settings['after'] : '' );
return $html . $title_output;
}
/**
* Get author
*/
private function get_crumbs_archive() {
$html = '';
$title_output = ( $this->args['show_title'] ? $this->settings['before'] . get_the_archive_title() . $this->settings['after'] : '' );
return $html . $title_output;
}
/**
* Get date
*/
private function get_crumbs_date() {
$html = '';
if ( $this->post_types['post']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['post']['archive_page'], $this->post_types['post']['archive_label'] );
}
if ( is_day() ) {
$html .= sprintf( $this->get_link(), get_year_link( get_the_time( 'Y' ) ), get_the_time( 'Y' ) ) . $this->get_sep();
$html .= sprintf( $this->get_link(), get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ), get_the_time( 'F' ) ) . $this->get_sep();
$title = get_the_time( 'd' );
} elseif ( is_month() ) {
$html .= sprintf( $this->get_link(), get_year_link( get_the_time( 'Y' ) ), get_the_time( 'Y' ) ) . $this->get_sep();
$title = get_the_time( 'F' );
} else {
$title = get_the_time( 'Y' );
}
$title_output = ( $this->args['show_title'] ? $this->settings['before'] . $title . $this->settings['after'] : '' );
return $html . $title_output;
}
/**
* Get tax
*/
private function get_crumbs_tax() {
$html = '';
if ( is_tax( 'portfolio-type' ) || is_tax( 'portfolio-tag' ) ) {
if ( $this->post_types['portfolio']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['portfolio']['archive_page'], $this->post_types['portfolio']['archive_label'] );
}
} elseif ( is_tax( 'staff-group' ) ) {
if ( $this->post_types['staff']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['staff']['archive_page'], $this->post_types['staff']['archive_label'] );
}
} elseif ( is_tax( 'testimonial-group' ) ) {
if ( $this->post_types['testimonial']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['testimonial']['archive_page'], $this->post_types['testimonial']['archive_label'] );
}
} elseif ( is_tax( 'event-category' ) ) {
if ( $this->post_types['event']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['event']['archive_page'], $this->post_types['event']['archive_label'] );
}
} elseif ( is_tax( 'series' ) ) {
if ( $this->post_types['podcast']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['podcast']['archive_page'], $this->post_types['podcast']['archive_label'] );
}
} elseif ( is_tax( 'ht_kb_category' ) ) {
if ( $this->post_types['ht_kb']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['ht_kb']['archive_page'], $this->post_types['ht_kb']['archive_label'] );
}
} elseif ( is_tax( 'course_cat' ) || is_tax( 'course_tag' ) || is_tax( 'course_track' ) ) {
if ( $this->post_types['course']['archive_page'] ) {
$html .= $this->get_archive_crumb( $this->post_types['course']['archive_page'], $this->post_types['course']['archive_label'] );
}
}
$title = ( $this->args['show_title'] ? $this->settings['before'] . $this->get_breadcrumb_term_title( get_queried_object() ) . $this->settings['after'] : '' );
return $html . $title;
}
/**
* Get page
*/
private function get_crumbs_page() {
global $post;
$html = '';
$parent_id = $post->post_parent;
$parentcrumbs = array();
if ( $parent_id ) {
while ( $parent_id ) {
$page = get_page( $parent_id );
$parentcrumbs[] = sprintf( $this->get_link(), get_permalink( $page->ID ), get_the_title( $page->ID ) ) . $this->get_sep();
$parent_id = $page->post_parent;
}
}
$parentcrumbs = array_reverse( $parentcrumbs );
foreach ( $parentcrumbs as $parentcrumb ) {
$html .= $parentcrumb;
}
$title = ( $this->args['show_title'] ? $this->settings['before'] . get_the_title() . $this->settings['after'] : '' );
return $html . $title;
}
/**
* Get single
*/
private function get_crumbs_single() {
$html = '';
$post_type = get_post_type();
if ( isset( $this->post_types[ $post_type ] ) ) {
// Archive Page.
$html .= $this->get_archive_crumb( $this->post_types[ $post_type ]['archive_page'], $this->post_types[ $post_type ]['archive_label'] );
// Tax Page.
$html .= $this->get_taxonomy_crumb( $this->post_types[ $post_type ]['taxonomy'] );
// Custom Parent.
if ( isset( $this->post_types[ $post_type ]['custom'] ) ) {
$html .= $this->get_custom_crumb( $this->post_types[ $post_type ]['custom'] );
}
} else {
// Archive Page.
$html .= $this->get_archive_crumb( '', '' );
}
$title = ( $this->args['show_title'] ? $this->settings['before'] . get_the_title() . $this->settings['after'] : '' );
return $html . $title;
}
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* Kadence\BuddyBoss\Component class
*
* @package kadence
*/
namespace Kadence\BuddyBoss;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_theme_support;
use function have_posts;
use function the_post;
use function is_search;
use function bp_core_get_directory_page_id;
use function bp_current_component;
/**
* Class for adding BuddyBoss plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'buddyboss';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'kadence_post_layout', array( $this, 'filter_layout_for_component_pages' ) );
}
/**
* Filters the layout array to check the pages which are component pages for buddyboss
*
* @param string $layout the entry container class.
*/
public function filter_layout_for_component_pages( $layout ) {
if ( is_page() && bp_current_component() ) {
$component_id = bp_core_get_directory_page_id();
if ( $component_id ) {
// Layout.
$postlayout = get_post_meta( $component_id, '_kad_post_layout', true );
if ( isset( $postlayout ) && ( 'narrow' === $postlayout || 'fullwidth' === $postlayout ) ) {
$layout['layout'] = $postlayout;
}
// Sidebar ID.
$postsidebar = get_post_meta( $component_id, '_kad_post_sidebar_id', true );
if ( isset( $postsidebar ) && ! empty( $postsidebar ) && 'defualt' !== $postsidebar && 'default' !== $postsidebar ) {
$layout['sidebar_id'] = $postsidebar;
}
// Boxed Style.
$postboxed = get_post_meta( $component_id, '_kad_post_content_style', true );
if ( isset( $postboxed ) && ( 'unboxed' === $postboxed || 'boxed' === $postboxed ) ) {
$layout['boxed'] = $postboxed;
}
// Post Feature.
$postfeature = get_post_meta( $component_id, '_kad_post_feature', true );
if ( isset( $postfeature ) && ( 'show' === $postfeature || 'hide' === $postfeature ) ) {
$layout['feature'] = $postfeature;
}
// Post Feature position.
$postf_position = get_post_meta( $component_id, '_kad_post_feature_position', true );
if ( isset( $postf_position ) && ( 'above' === $postf_position || 'behind' === $postf_position || 'below' === $postf_position ) ) {
$layout['feature_position'] = $postf_position;
}
// Post title.
$posttitle = get_post_meta( $component_id, '_kad_post_title', true );
if ( isset( $posttitle ) && ( 'above' === $posttitle || 'normal' === $posttitle || 'hide' === $posttitle ) ) {
$layout['title'] = $posttitle;
}
// Post transparent.
$posttrans = get_post_meta( $component_id, '_kad_post_transparent', true );
if ( isset( $posttrans ) && ( 'enable' === $posttrans || 'disable' === $posttrans ) ) {
$layout['transparent'] = $posttrans;
}
// Post Vertical Padding.
$postvpadding = get_post_meta( $component_id, '_kad_post_vertical_padding', true );
if ( isset( $postvpadding ) && ( 'show' === $postvpadding || 'hide' === $postvpadding || 'top' === $postvpadding || 'bottom' === $postvpadding ) ) {
$layout['vpadding'] = $postvpadding;
}
// header.
$postheader = get_post_meta( $component_id, '_kad_post_header', true );
if ( isset( $postheader ) && true == $postheader ) {
$layout['header'] = 'disable';
}
// Footer.
$postfooter = get_post_meta( $component_id, '_kad_post_footer', true );
if ( isset( $postfooter ) && true == $postfooter ) {
$layout['footer'] = 'disable';
}
}
}
return $layout;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Kadence\Clean_Frontend\Component class
*
* @package kadence
*/
namespace Kadence\Clean_Frontend;
use Kadence\Component_Interface;
use function add_action;
use function add_filter;
/**
* Class for adding custom functions to clean up the front end.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'clean_frontend';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'excerpt_more', array( $this, 'excerpt_more' ) );
}
/**
* Removes strange box around ... in excerpts.
*
* @param string $more the excerpt more text.
*/
public function excerpt_more( $more ) {
if ( is_admin() ) {
return $more;
}
return '...';
}
}

View File

@@ -0,0 +1,162 @@
<?php
/**
* Kadence\Color_Palette\Component class
*
* @package kadence
*/
namespace Kadence\Color_Palette;
use Kadence\Component_Interface;
use Kadence_Control_Color_Palette;
use function Kadence\kadence;
use function add_action;
use function add_theme_support;
use function apply_filters;
/**
* Class for adding custom logo support.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'color_palette';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'customize_register', array( $this, 'color_palette_register' ), 80 );
add_action( 'after_setup_theme', array( $this, 'action_add_editor_support' ) );
}
/**
* Add settings
*
* @access public
* @param object $wp_customize the customizer object.
* @return void
*/
public function color_palette_register( $wp_customize ) {
$wp_customize->add_setting(
'kadence_global_palette',
array(
'transport' => 'postMessage',
'type' => 'option',
'default' => kadence()->get_palette_for_customizer(),
'capability' => apply_filters( 'kadence_palette_customizer_capability', 'manage_options' ),
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new Kadence_Control_Color_Palette(
$wp_customize,
'kadence_color_palette',
array(
'label' => __( 'Global Palette', 'kadence' ),
'description' => __( 'Learn how to use this', 'kadence' ),
'section' => 'kadence_customizer_general_colors',
'settings' => 'kadence_global_palette',
'priority' => 8,
)
)
);
}
/**
* Adds support for various editor features.
*/
public function action_add_editor_support() {
/**
* Add support for color palettes.
*/
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Accent', 'kadence' ),
'slug' => 'theme-palette1',
'color' => kadence()->palette_option( 'palette1' ),
),
array(
'name' => __( 'Accent - alt', 'kadence' ),
'slug' => 'theme-palette2',
'color' => kadence()->palette_option( 'palette2' ),
),
array(
'name' => __( 'Strongest text', 'kadence' ),
'slug' => 'theme-palette3',
'color' => kadence()->palette_option( 'palette3' ),
),
array(
'name' => __( 'Strong Text', 'kadence' ),
'slug' => 'theme-palette4',
'color' => kadence()->palette_option( 'palette4' ),
),
array(
'name' => __( 'Medium text', 'kadence' ),
'slug' => 'theme-palette5',
'color' => kadence()->palette_option( 'palette5' ),
),
array(
'name' => __( 'Subtle Text', 'kadence' ),
'slug' => 'theme-palette6',
'color' => kadence()->palette_option( 'palette6' ),
),
array(
'name' => __( 'Subtle Background', 'kadence' ),
'slug' => 'theme-palette7',
'color' => kadence()->palette_option( 'palette7' ),
),
array(
'name' => __( 'Lighter Background', 'kadence' ),
'slug' => 'theme-palette8',
'color' => kadence()->palette_option( 'palette8' ),
),
array(
'name' => __( 'White or offwhite', 'kadence' ),
'slug' => 'theme-palette9',
'color' => kadence()->palette_option( 'palette9' ),
),
array(
'name' => __( 'Accent - Complement', 'kadence' ),
'slug' => 'theme-palette10',
'color' => kadence()->palette_option( 'palette10' ),
),
array(
'name' => __( 'Notices - Success', 'kadence' ),
'slug' => 'theme-palette11',
'color' => kadence()->palette_option( 'palette11' ),
),
array(
'name' => __( 'Notices - Info', 'kadence' ),
'slug' => 'theme-palette12',
'color' => kadence()->palette_option( 'palette12' ),
),
array(
'name' => __( 'Notices - Alert', 'kadence' ),
'slug' => 'theme-palette13',
'color' => kadence()->palette_option( 'palette13' ),
),
array(
'name' => __( 'Notices - Warning', 'kadence' ),
'slug' => 'theme-palette14',
'color' => kadence()->palette_option( 'palette14' ),
),
array(
'name' => __( 'Notices - Rating', 'kadence' ),
'slug' => 'theme-palette15',
'color' => kadence()->palette_option( 'palette15' ),
)
)
);
}
}

View File

@@ -0,0 +1,193 @@
<?php
/**
* Kadence\Comments\Component class
*
* @package kadence
*/
namespace Kadence\Comments;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use function add_action;
use function apply_filters;
use function is_singular;
use function comments_open;
use function get_option;
use function wp_enqueue_script;
use function the_ID;
use function esc_attr;
use function wp_list_comments;
use function the_comments_navigation;
use function add_filter;
use function remove_filter;
/**
* Class for managing comments UI.
*
* Exposes template tags:
* * `kadence()->the_comments( array $args = [] )`
*
* @link https://wordpress.org/plugins/amp/
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'comments';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'action_enqueue_comment_reply_script' ) );
add_filter( 'comment_form_default_fields', array( $this, 'filter_default_fields_markup' ) );
add_filter( 'comment_form_defaults', array( $this, 'filter_default_markup' ) );
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'the_comments' => array( $this, 'the_comments' ),
);
}
/**
* Enqueues the WordPress core 'comment-reply' script as necessary.
*/
public function action_enqueue_comment_reply_script() {
// If the AMP plugin is active, return early.
if ( kadence()->is_amp() ) {
return;
}
// Enqueue comment script on singular post/page views only.
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
/**
* Displays the list of comments for the current post.
*
* Internally this method calls `wp_list_comments()`. However, in addition to that it will render the wrapping
* element for the list, so that must not be added manually. The method will also take care of generating the
* necessary markup if amp-live-list should be used for comments.
*
* @param array $args Optional. Array of arguments. See `wp_list_comments()` documentation for a list of supported
* arguments.
*/
public function the_comments( array $args = array() ) {
$args = array_merge(
$args,
array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 60,
)
);
$amp_live_list = kadence()->using_amp_live_list_comments();
if ( $amp_live_list ) {
$comment_order = get_option( 'comment_order' );
$comments_per_page = get_option( 'page_comments' ) ? (int) get_option( 'comments_per_page' ) : 10000;
$poll_inverval = MINUTE_IN_SECONDS * 1000;
?>
<amp-live-list
id="amp-live-comments-list-<?php the_ID(); ?>"
<?php echo ( 'asc' === $comment_order ) ? ' sort="ascending" ' : ''; ?>
data-poll-interval="<?php echo esc_attr( $poll_inverval ); ?>"
data-max-items-per-page="<?php echo esc_attr( $comments_per_page ); ?>"
>
<?php
add_filter( 'navigation_markup_template', array( $this, 'filter_add_amp_live_list_pagination_attribute' ) );
}
?>
<ol class="comment-list"<?php echo $amp_live_list ? ' items' : ''; ?>>
<?php wp_list_comments( $args ); ?>
</ol><!-- .comment-list -->
<?php
the_comments_navigation();
if ( $amp_live_list ) {
remove_filter( 'navigation_markup_template', array( $this, 'filter_add_amp_live_list_pagination_attribute' ) );
?>
<div update>
<button class="button" on="tap:amp-live-comments-list-<?php the_ID(); ?>.update"><?php esc_html_e( 'New comment(s)', 'kadence' ); ?></button>
</div>
</amp-live-list>
<?php
}
}
/**
* Adds a div wrapper around the author, email and url fields.
*
* @param array $fields the contact form fields.
* @return array Filtered markup.
*/
public function filter_default_fields_markup( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true' required='required'" : '' );
$label_req = ( $req ? ' <span class="required">*</span>' : '' );
$show_web = kadence()->option( 'comment_form_remove_web' );
$fields['author'] = '<div class="comment-input-wrap ' . ( $show_web ? 'no-url-field' : 'has-url-field' ) . '"><p class="comment-form-author"><input aria-label="' . esc_attr__( 'Name', 'kadence' ) . '" id="author" name="author" type="text" placeholder="' . esc_attr__( 'John Doe', 'kadence' ) . '" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $aria_req . ' /><label class="float-label" for="author">' . esc_html__( 'Name', 'kadence' ) . $label_req . '</label></p>';
$fields['email'] = '<p class="comment-form-email"><input aria-label="' . esc_attr__( 'Email', 'kadence' ) . '" id="email" name="email" type="email" placeholder="' . esc_attr__( 'john@example.com', 'kadence' ) . '" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $aria_req . ' /><label class="float-label" for="email">' . esc_html__( 'Email', 'kadence' ) . $label_req . '</label></p>';
if ( $show_web ) {
$fields['url'] = '</div>';
} else {
$fields['url'] = '<p class="comment-form-url"><input aria-label="' . esc_attr__( 'Website', 'kadence' ) . '" id="url" name="url" type="url" placeholder="' . esc_attr__( 'https://www.example.com', 'kadence' ) . '" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /><label class="float-label" for="url">' . esc_html__( 'Website', 'kadence' ) . '</label></p></div>';
}
return apply_filters( 'kadence_comment_fields', $fields );
}
/**
* Adds a div wrapper around the author, email and url fields.
*
* @param array $args the contact form args.
* @return array Filtered markup.
*/
public function filter_default_markup( $args ) {
$commenter = wp_get_current_commenter();
$args['comment_field'] = '<p class="comment-form-comment comment-form-float-label"><textarea id="comment" name="comment" placeholder="' . esc_attr__( 'Leave a comment...', 'kadence' ) . '" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea><label class="float-label" for="comment">' . esc_html__( 'Comment', 'kadence' ) . ' <span class="required">*</span></label></p>';
return apply_filters( 'kadence_comment_args', $args );
}
/**
* Adds a pagination reference point attribute for amp-live-list when theme supports AMP.
*
* This is used by the navigation_markup_template filter in the comments template.
*
* @link https://www.ampproject.org/docs/reference/components/amp-live-list#pagination
*
* @param string $markup Navigation markup.
* @return string Filtered markup.
*/
public function filter_add_amp_live_list_pagination_attribute( string $markup ) : string {
return preg_replace( '/(\s*<[a-z0-9_-]+)/i', '$1 pagination ', $markup, 1 );
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Kadence\Component_Interface interface
*
* @package kadence
*/
namespace Kadence;
/**
* Interface for a theme component.
*/
interface Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string;
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize();
}

View File

@@ -0,0 +1,101 @@
<?php
/**
* Kadence\Custom_Footer\Component class
*
* @package kadence
*/
namespace Kadence\Custom_Footer;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function add_action;
use function apply_filters;
use function Kadence\kadence;
use function get_template_part;
/**
* Class for adding custom footer support.
*
* Exposes template tags:
* * `kadence()->render_footer()`
* * `kadence()->display_footer_row()`
* * `kadence()->footer_column_item_count()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'custom_footer';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'render_footer' => array( $this, 'render_footer' ),
'display_footer_row' => array( $this, 'display_footer_row' ),
'footer_column_item_count' => array( $this, 'footer_column_item_count' ),
);
}
/**
* Checks to see if the row has any content.
*
* @param string $row the name of the row.
* @return bool
*/
public function display_footer_row( $row = 'middle' ) {
$display = false;
foreach ( array( '1', '2', '3', '4', '5' ) as $column ) {
$elements = kadence()->option( 'footer_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
$display = true;
break;
}
}
return $display;
}
/**
* Adds support to render footer columns.
*
* @param string $row the name of the row.
* @param string $column the name of the column.
*/
public function render_footer( $row = 'middle', $column = '1' ) {
$elements = kadence()->option( 'footer_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
foreach ( $elements[ $row ][ $row . '_' . $column ] as $key => $item ) {
$template = apply_filters( 'kadence_footer_elements_template_path', 'template-parts/footer/' . $item, $item, $row, $column );
get_template_part( $template );
}
}
}
/**
* Adds support to get the footer item count for a specific column.
*
* @param string $row the name of the row.
* @param string $column the name of the column.
*/
public function footer_column_item_count( $row = 'middle', $column = '1' ) {
$count = 0;
$elements = kadence()->option( 'footer_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
$count = count( $elements[ $row ][ $row . '_' . $column ] );
}
return $count;
}
}

View File

@@ -0,0 +1,216 @@
<?php
/**
* Kadence\Custom_Header\Component class
*
* @package kadence
*/
namespace Kadence\Custom_Header;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function add_action;
use function apply_filters;
use function Kadence\kadence;
use function get_template_part;
/**
* Class for adding custom header support.
*
* Exposes template tags:
* * `kadence()->render_header()`
* * `kadence()->display_header_row()`
* * `kadence()->has_center_column()`
* * `kadence()->has_side_columns()`
* * `kadence()->display_mobile_header_row()`
* * `kadence()->has_mobile_center_column()`
* * `kadence()->has_mobile_side_columns()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Holds center column display.
*
* @var value for center column;
*/
protected static $center = array();
/**
* Holds sides column display.
*
* @var value for center column;
*/
protected static $sides = array();
/**
* Holds sides column display.
*
* @var value for center column;
*/
protected static $mobile_sides = array();
/**
* Holds center column display.
*
* @var value for center column;
*/
protected static $mobile_center = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'custom_header';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'render_header' => array( $this, 'render_header' ),
'display_header_row' => array( $this, 'display_header_row' ),
'has_center_column' => array( $this, 'has_center_column' ),
'has_side_columns' => array( $this, 'has_side_columns' ),
'display_mobile_header_row' => array( $this, 'display_mobile_header_row' ),
'has_mobile_center_column' => array( $this, 'has_mobile_center_column' ),
'has_mobile_side_columns' => array( $this, 'has_mobile_side_columns' ),
);
}
/**
* Adds support to render header columns.
*
* @param string $row the name of the row.
*/
public function display_header_row( $row = 'main' ) {
$display = false;
foreach ( array( 'left', 'center', 'right' ) as $column ) {
$elements = kadence()->option( 'header_desktop_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
$display = true;
break;
}
}
return $display;
}
/**
* Adds support to render header columns.
*
* @param string $row the name of the row.
*/
public function display_mobile_header_row( $row = 'main' ) {
$display = false;
foreach ( array( 'left', 'center', 'right' ) as $column ) {
$elements = kadence()->option( 'header_mobile_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
$display = true;
break;
}
}
return $display;
}
/**
* Adds a check to see if the side columns should run.
*
* @param string $row the name of the row.
*/
public function has_side_columns( $row = 'main' ) {
if ( isset( self::$sides[ $row ] ) ) {
return self::$sides[ $row ];
}
$sides = false;
$elements = kadence()->option( 'header_desktop_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) ) {
if ( ( isset( $elements[ $row ][ $row . '_left' ] ) && is_array( $elements[ $row ][ $row . '_left' ] ) && ! empty( $elements[ $row ][ $row . '_left' ] ) ) || ( isset( $elements[ $row ][ $row . '_left_center' ] ) && is_array( $elements[ $row ][ $row . '_left_center' ] ) && ! empty( $elements[ $row ][ $row . '_left_center' ] ) ) || ( isset( $elements[ $row ][ $row . '_right_center' ] ) && is_array( $elements[ $row ][ $row . '_right_center' ] ) && ! empty( $elements[ $row ][ $row . '_right_center' ] ) ) || ( isset( $elements[ $row ][ $row . '_right' ] ) && is_array( $elements[ $row ][ $row . '_right' ] ) && ! empty( $elements[ $row ][ $row . '_right' ] ) ) ) {
$sides = true;
}
}
self::$sides[ $row ] = $sides;
return $sides;
}
/**
* Adds a check to see if the side columns should run.
*
* @param string $row the name of the row.
*/
public function has_mobile_side_columns( $row = 'main' ) {
if ( isset( self::$mobile_sides[ $row ] ) ) {
return self::$mobile_sides[ $row ];
}
$mobile_sides = false;
$elements = kadence()->option( 'header_mobile_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) ) {
if ( ( isset( $elements[ $row ][ $row . '_left' ] ) && is_array( $elements[ $row ][ $row . '_left' ] ) && ! empty( $elements[ $row ][ $row . '_left' ] ) ) || ( isset( $elements[ $row ][ $row . '_left_center' ] ) && is_array( $elements[ $row ][ $row . '_left_center' ] ) && ! empty( $elements[ $row ][ $row . '_left_center' ] ) ) || ( isset( $elements[ $row ][ $row . '_right_center' ] ) && is_array( $elements[ $row ][ $row . '_right_center' ] ) && ! empty( $elements[ $row ][ $row . '_right_center' ] ) ) || ( isset( $elements[ $row ][ $row . '_right' ] ) && is_array( $elements[ $row ][ $row . '_right' ] ) && ! empty( $elements[ $row ][ $row . '_right' ] ) ) ) {
$mobile_sides = true;
}
}
self::$mobile_sides[ $row ] = $mobile_sides;
return $mobile_sides;
}
/**
* Adds a check to see if the center column should run.
*
* @param string $row the name of the row.
*/
public function has_center_column( $row = 'main' ) {
if ( isset( self::$center[ $row ] ) ) {
return self::$center[ $row ];
}
$center = false;
$elements = kadence()->option( 'header_desktop_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_center' ] ) && is_array( $elements[ $row ][ $row . '_center' ] ) && ! empty( $elements[ $row ][ $row . '_center' ] ) ) {
$center = true;
}
self::$center[ $row ] = $center;
return $center;
}
/**
* Adds a check to see if the center column should run.
*
* @param string $row the name of the row.
*/
public function has_mobile_center_column( $row = 'main' ) {
if ( isset( self::$mobile_center[ $row ] ) ) {
return self::$mobile_center[ $row ];
}
$mobile_center = false;
$elements = kadence()->option( 'header_mobile_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_center' ] ) && is_array( $elements[ $row ][ $row . '_center' ] ) && ! empty( $elements[ $row ][ $row . '_center' ] ) ) {
$mobile_center = true;
}
self::$mobile_center[ $row ] = $mobile_center;
return $mobile_center;
}
/**
* Adds support to render header columns.
*
* @param string $row the name of the row.
* @param string $column the name of the column.
* @param string $header the name of the header.
*/
public function render_header( $row = 'main', $column = 'left', $header = 'desktop' ) {
$elements = kadence()->option( 'header_' . $header . '_items' );
if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
foreach ( $elements[ $row ][ $row . '_' . $column ] as $key => $item ) {
$template = apply_filters( 'kadence_header_elements_template_path', 'template-parts/header/' . $item, $item, $row, $column );
get_template_part( $template );
}
}
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Kadence\Custom_Logo\Component class
*
* @package kadence
*/
namespace Kadence\Custom_Logo;
use Kadence\Component_Interface;
use function add_action;
use function add_theme_support;
use function apply_filters;
/**
* Class for adding custom logo support.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'custom_logo';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_custom_logo_support' ) );
}
/**
* Adds support for the Custom Logo feature.
*/
public function action_add_custom_logo_support() {
add_theme_support(
'custom-logo',
apply_filters(
'kadence_custom_logo_args',
array(
'height' => 80,
'width' => 200,
'flex-width' => true,
'flex-height' => true,
)
)
);
}
}

View File

@@ -0,0 +1,394 @@
<?php
/**
* Kadence\Editor\Component class
*
* @package kadence
*/
namespace Kadence\Editor;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function add_theme_support;
/**
* Class for integrating with the block editor.
*
* @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'editor';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_editor_support' ) );
add_filter( 'admin_body_class', array( $this, 'filter_admin_body_class' ) );
remove_action( 'admin_head-post.php', 'kadence_blocks_admin_editor_width', 100 );
remove_action( 'admin_head-post-new.php', 'kadence_blocks_admin_editor_width', 100 );
add_filter( 'kadence_blocks_editor_width', array( $this, 'kadence_blocks_admin_editor_width_filter' ), 100 );
add_action( 'after_setup_theme', array( $this, 'google_font_add_editor_styles' ) );
add_filter( 'theme_file_path', array( $this, 'disable_json_optionally' ), 10, 2 );
add_filter( 'wp_theme_json_data_theme', array( $this, 'edit_theme_json' ), 10 );
}
/**
* Edit the theme.json file optionally.
*
* @param object $theme_json the path to the theme.json file.
*/
public function edit_theme_json( $theme_json ) {
$theme_mode = get_theme_mod( 'theme_json_mode', false );
if ( ! $theme_mode ) {
$new_data = array(
'version' => 2,
"settings" => array(
"appearanceTools" => true,
"border" => [
"color" => true,
"radius" => true,
"style" => true,
"width" => true
],
"color" => [
"custom" => true,
"defaultPalette" => false,
"link" => true,
"palette" => [
[
"name" => "Accent",
"slug" => "theme-palette1",
"color" => "var(--global-palette1)"
],
[
"name" => "Accent - alt",
"slug" => "theme-palette2",
"color" => "var(--global-palette2)"
],
[
"name" => "Strongest text",
"slug" => "theme-palette3",
"color" => "var(--global-palette3)"
],
[
"name" => "Strong Text",
"slug" => "theme-palette4",
"color" => "var(--global-palette4)"
],
[
"name" => "Medium text",
"slug" => "theme-palette5",
"color" => "var(--global-palette5)"
],
[
"name" => "Subtle Text",
"slug" => "theme-palette6",
"color" => "var(--global-palette6)"
],
[
"name" => "Subtle Background",
"slug" => "theme-palette7",
"color" => "var(--global-palette7)"
],
[
"name" => "Lighter Background",
"slug" => "theme-palette8",
"color" => "var(--global-palette8)"
],
[
"name" => "White or offwhite",
"slug" => "theme-palette9",
"color" => "var(--global-palette9)"
],
[
"name" => "Accent - Complement",
"slug" => "theme-palette10",
"color" => "var(--global-palette10)"
],
[
"name" => "Notices - Success",
"slug" => "theme-palette11",
"color" => "var(--global-palette11)"
],
[
"name" => "Notices - Info",
"slug" => "theme-palette12",
"color" => "var(--global-palette12)"
],
[
"name" => "Notices - Alert",
"slug" => "theme-palette13",
"color" => "var(--global-palette13)"
],
[
"name" => "Notices - Warning",
"slug" => "theme-palette14",
"color" => "var(--global-palette14)"
],
[
"name" => "Notices - Rating",
"slug" => "theme-palette15",
"color" => "var(--global-palette15)"
]
]
],
"layout" => [
"contentSize" => "var(--global-calc-content-width)",
"wideSize" => "var(--global-calc-wide-content-width)",
"fullSize" => "none"
],
"spacing" => [
"blockGap" => null,
"margin" => true,
"padding" => true,
"units" => [
"px",
"em",
"rem",
"vh",
"vw",
"%"
]
],
"typography" => [
"customFontSize" => true,
"fontSizes" => [
[
"name" => "Small",
"slug" => "small",
"size" => "var(--global-font-size-small)"
],
[
"name" => "Medium",
"slug" => "medium",
"size" => "var(--global-font-size-medium)"
],
[
"name" => "Large",
"slug" => "large",
"size" => "var(--global-font-size-large)"
],
[
"name" => "Larger",
"slug" => "larger",
"size" => "var(--global-font-size-larger)"
],
[
"name" => "XX-Large",
"slug" => "xxlarge",
"size" => "var(--global-font-size-xxlarge)"
]
],
"lineHeight" => true
]
),
"styles" => [
"elements" => [
"button" => [
"spacing" => [
"padding" => false
],
"border" => [
"width" => false
],
"color" => [
"background" => false,
"text" => false
],
"typography" => [
"fontFamily" => false,
"fontSize" => false,
"lineHeight" => false,
"textDecoration" => false
]
]
]
]
);
return $theme_json->update_with( $new_data );
}
return $theme_json;
}
/**
* Disables the theme.json file optionally.
*
* @param string $path the path to the theme.json file.
*/
public function disable_json_optionally( $path, $file ) {
$length = strlen( 'kadence/theme.json' );
if ( ! empty( $file ) && 'theme.json' === $file && substr( $path, -$length ) === 'kadence/theme.json' ) {
$theme_mode = get_theme_mod( 'theme_json_mode', false );
if ( ! $theme_mode ) {
// Set the path to a file that doesn't exist.
$new_path = str_replace( 'kadence/theme.json', 'kadence/missing-theme.json', $path );
return $new_path;
} else {
return $path;
}
}
return $path;
}
/**
* Registers an editor stylesheet for the current theme.
*/
public function google_font_add_editor_styles() {
if ( kadence()->sub_option( 'base_font', 'google' ) ) {
$font = kadence()->option( 'base_font' );
if ( $font['family'] ) {
$font_string = $font['family'] . ':' . ( $font['variant'] ? $font['variant'] : '400' ) . ',700';
if ( kadence()->sub_option( 'heading_font', 'google' ) ) {
$heading_font = kadence()->option( 'heading_font' );
if ( $heading_font['family'] ) {
$font_string .= '%7C' . $heading_font['family'] . ':400,700';
}
}
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=' . $font_string );
add_editor_style( $font_url );
}
} elseif ( kadence()->sub_option( 'heading_font', 'google' ) ) {
$font = kadence()->option( 'heading_font' );
if ( $font['family'] ) {
$font_string = $font['family'] . ':400,700';
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=' . $font_string );
add_editor_style( $font_url );
}
}
}
/**
* Adds filter for Kadence Editor Width.
*
* @param bool $enable the editor width enable.
*/
public function kadence_blocks_admin_editor_width_filter( $enable ) {
return false;
}
/**
* Adds filter for admin body class to add in layout information.
*
* @param string $classes the admin classes.
*/
public function filter_admin_body_class( $classes ) {
$screen = get_current_screen();
if ( 'post' == $screen->base ) {
global $post;
$post_type = get_post_type();
$post_layout = array(
'layout' => 'normal',
'boxed' => 'boxed',
'feature' => 'hide',
'comments' => 'hide',
'navigation' => 'hide',
'title' => 'normal',
'sidebar' => 'none',
'padding' => 'show',
);
$post_layout = apply_filters( 'kadence_post_layout', $post_layout );
$postlayout = get_post_meta( $post->ID, '_kad_post_layout', true );
$postboxed = get_post_meta( $post->ID, '_kad_post_content_style', true );
$postfeature = get_post_meta( $post->ID, '_kad_post_feature', true );
$vpadding = get_post_meta( $post->ID, '_kad_post_vertical_padding', true );
$postnav = get_post_meta( $post->ID, '_kad_post_navigation', true );
$posttitle = get_post_meta( $post->ID, '_kad_post_title', true );
$postsidebar = get_post_meta( $post->ID, '_kad_post_layout', true );
if ( isset( $postlayout ) && ( 'left' === $postsidebar || 'right' === $postsidebar ) ) {
$post_layout['sidebar'] = $postlayout;
} elseif ( ( isset( $postlayout ) && 'default' === $postlayout ) || empty( $postlayout ) ) {
$option_layout = kadence()->option( $post_type . '_layout' );
if ( 'left' === $option_layout || 'right' === $option_layout ) {
$post_layout['sidebar'] = $option_layout;
}
}
if ( isset( $posttitle ) && ( 'above' === $posttitle || 'normal' === $posttitle || 'hide' === $posttitle ) ) {
$post_layout['title'] = $posttitle;
} else {
$option_title = kadence()->option( $post_type . '_title' );
if ( false === $option_title ) {
$post_layout['title'] = 'hide';
} else {
$option_title_layout = kadence()->option( $post_type . '_title_layout' );
if ( 'above' === $option_title_layout || 'normal' === $option_title_layout ) {
$post_layout['title'] = $option_title_layout;
}
}
}
if ( isset( $postnav ) && ( 'show' === $postnav || 'hide' === $postnav ) ) {
$post_layout['navigation'] = $postnav;
} else {
$option_nav = kadence()->option( $post_type . '_navigation' );
if ( $option_nav ) {
$post_layout['navigation'] = 'show';
}
}
if ( isset( $vpadding ) && ( 'show' === $vpadding || 'hide' === $vpadding ) ) {
$post_layout['padding'] = $vpadding;
} else {
$option_padding = kadence()->option( $post_type . '_vertical_padding' );
if ( $option_padding ) {
$post_layout['padding'] = 'show';
}
}
if ( isset( $postboxed ) && ( 'unboxed' === $postboxed || 'boxed' === $postboxed ) ) {
$post_layout['boxed'] = $postboxed;
} else {
$option_boxed = kadence()->option( $post_type . '_content_style' );
if ( 'unboxed' === $option_boxed || 'boxed' === $option_boxed ) {
$post_layout['boxed'] = $option_boxed;
}
}
if ( isset( $postfeature ) && ( 'show' === $postfeature || 'hide' === $postfeature ) ) {
$post_layout['feature'] = $postfeature;
} else {
$option_feature = kadence()->option( $post_type . '_feature' );
if ( $option_feature ) {
$post_layout['feature'] = 'show';
}
}
if ( isset( $postlayout ) && ( 'narrow' === $postlayout || 'fullwidth' === $postlayout ) ) {
$post_layout['layout'] = $postlayout;
} else if ( isset( $postlayout ) && ( 'left' === $postlayout || 'right' === $postlayout ) ) {
$post_layout['layout'] = 'narrow';
} elseif ( ( isset( $postlayout ) && 'default' === $postlayout ) || empty( $postlayout ) ) {
$option_layout = kadence()->option( $post_type . '_layout' );
if ( 'narrow' === $option_layout || 'fullwidth' === $option_layout ) {
$post_layout['layout'] = $option_layout;
} else if ( 'left' === $option_layout || 'right' === $option_layout ) {
$post_layout['layout'] = 'narrow';
}
}
$classes .= ' post-content-width-' . esc_attr( $post_layout['layout'] ) . ' admin-color-pcw-' . esc_attr( $post_layout['layout'] ) . ' post-content-style-' . esc_attr( $post_layout['boxed'] ) . ' admin-color-pcs-' . esc_attr( $post_layout['boxed'] ) . ' admin-color-post-type-' . esc_attr( $post_type ) . ' post-content-vertical-padding-' . esc_attr( $post_layout['padding'] ) . ' admin-color-pcvp-' . esc_attr( $post_layout['padding'] ) . ' post-content-title-' . esc_attr( $post_layout['title'] ) . ' admin-color-pct-' . esc_attr( $post_layout['title'] ) . ' post-content-sidebar-' . esc_attr( $post_layout['sidebar'] ) . ' admin-color-pc-sidebar-' . esc_attr( $post_layout['sidebar'] ) . ' ';
}
return $classes;
}
/**
* Adds support for various editor features.
*/
public function action_add_editor_support() {
// Add support for post thumbnails.
add_theme_support( 'post-thumbnails' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Add support for default block styles.
// Don't add this "add_theme_support( 'wp-block-styles' );" because theme provides it own styling.
// add_theme_support( 'wp-block-styles' );
// Add support for wide-aligned images.
add_theme_support( 'align-wide' );
add_theme_support( 'custom-spacing' );
if ( apply_filters( 'kadence-theme-block-templates-support', true ) ) {
add_theme_support( 'block-templates' );
}
}
}

View File

@@ -0,0 +1,635 @@
<?php
/**
* Kadence\Elementor\Component class
*
* @package kadence
*/
namespace Kadence\Elementor;
use Kadence\Component_Interface;
use Elementor;
use function Kadence\kadence;
use function add_action;
use function add_theme_support;
use function have_posts;
use function the_post;
use function apply_filters;
use function get_template_part;
use function get_post_type;
use Elementor\Controls_Manager;
use Elementor\Core\Kits\Controls\Repeater as Global_Style_Repeater;
use Elementor\Repeater;
use Elementor\Plugin;
/**
* Class for adding Elementor plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'elementor';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// Add support for Header and Footer Plugin.
add_action( 'after_setup_theme', array( $this, 'init_header_footer_support' ), 30 );
add_filter( 'body_class', array( $this, 'add_body_class' ) );
//add_action( 'init', array( $this, 'elementor_add_theme_colors' ), 1 );
add_action( 'elementor/editor/init', array( $this, 'elementor_add_theme_colors' ) );
//add_action( 'elementor/element/kit/section_global_colors/before_section_start', array( $this, 'elementor_remove_theme_colors' ) );
add_action( 'elementor/element/kit/section_global_colors/after_section_end', array( $this, 'elementor_add_theme_color_controls' ), 10, 2 );
// Set page to best pagebuilder settings when first loading.
add_action( 'wp', array( $this, 'elementor_page_meta_setting' ), 20 );
add_action( 'elementor/preview/init', array( $this, 'elementor_page_meta_setting' ) );
// Add Scripts for elementor.
add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'elementor_add_scripts' ) );
//add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ), 60 );
add_action( 'elementor/document/after_save', array( $this, 'elementor_after_save' ), 10, 2 );
add_filter( 'body_class', array( $this, 'filter_body_classes_add_editing_class' ) );
}
/**
* Adds a link style class to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function add_body_class( $classes ) {
$classes[] = 'kadence-elementor-colors';
return $classes;
}
/**
* Adds a 'el-is-editing' class to the array of body classes for when we are in elementor editing.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function filter_body_classes_add_editing_class( array $classes ) : array {
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
$classes[] = 'el-is-editing';
}
return $classes;
}
public function elementor_after_save( $object, $data ) {
if ( apply_filters( 'kadence_add_global_colors_to_elementor', true ) ) {
// Prevent Errors.
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}
if ( $data && isset( $data['settings'] ) && is_array( $data['settings'] ) && isset( $data['settings']['kadence_colors'] ) && is_array( $data['settings']['kadence_colors'] ) ) {
$update_palette = false;
$palette = json_decode( kadence()->get_palette(), true );
if ( isset( $palette['active'] ) && ! empty( $palette['active'] ) ) {
$active = $palette['active'];
} else {
$palette = json_decode( kadence()->get_default_palette(), true );
$active = $palette['active'];
}
foreach ( $data['settings']['kadence_colors'] as $key => $value ) {
if ( 'palette1' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][0]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette2' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][1]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette3' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][2]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette4' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][3]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette5' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][4]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette6' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][5]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette7' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][6]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette8' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][7]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette9' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][8]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette10' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][9]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette11' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][10]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette12' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][11]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette13' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][12]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette14' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][13]['color'] = $value['color'];
$update_palette = true;
}
if ( 'palette15' == $value['_id'] && ! empty( $value['color'] ) ) {
$palette[$active][14]['color'] = $value['color'];
$update_palette = true;
}
}
$current = \Elementor\Plugin::$instance->kits_manager->get_current_settings();
if ( $current && isset( $current['custom_colors'] ) && $update_palette ) {
$custom_colors = $current['custom_colors'];
$kadence_add = true;
$kadence = array( 'kadence1', 'kadence2', 'kadence3', 'kadence4', 'kadence5', 'kadence6', 'kadence7', 'kadence8', 'kadence9' );
foreach ( $custom_colors as $key => $value ) {
if ( is_array( $value ) && isset( $value['_id'] ) && in_array( $value['_id'], $kadence ) ) {
$kadence_add = false;
if ( $value['_id'] == 'kadence1' ) {
$custom_colors[ $key ]['color'] = $palette[$active][0]['color'];
}
if ( $value['_id'] == 'kadence2' ) {
$custom_colors[ $key ]['color'] = $palette[$active][1]['color'];
}
if ( $value['_id'] == 'kadence3' ) {
$custom_colors[ $key ]['color'] = $palette[$active][2]['color'];
}
if ( $value['_id'] == 'kadence4' ) {
$custom_colors[ $key ]['color'] = $palette[$active][3]['color'];
}
if ( $value['_id'] == 'kadence5' ) {
$custom_colors[ $key ]['color'] = $palette[$active][4]['color'];
}
if ( $value['_id'] == 'kadence6' ) {
$custom_colors[ $key ]['color'] = $palette[$active][5]['color'];
}
if ( $value['_id'] == 'kadence7' ) {
$custom_colors[ $key ]['color'] = $palette[$active][6]['color'];
}
if ( $value['_id'] == 'kadence8' ) {
$custom_colors[ $key ]['color'] = $palette[$active][7]['color'];
}
if ( $value['_id'] == 'kadence9' ) {
$custom_colors[ $key ]['color'] = $palette[$active][8]['color'];
}
}
}
if ( $kadence_add ) {
\Elementor\Plugin::$instance->kits_manager->update_kit_settings_based_on_option( 'custom_colors', $custom_colors );
}
}
if ( $update_palette ) {
update_option( 'kadence_global_palette', json_encode( $palette ) );
}
}
}
}
/**
* Add some css styles for elementor.
*/
public function add_styles() {
wp_enqueue_style( 'kadence-elementor', get_theme_file_uri( '/assets/css/elementor.min.css' ), array(), KADENCE_VERSION );
}
/**
* Add some css styles for elementor admin.
*/
public function elementor_add_scripts() {
if ( apply_filters( 'kadence_add_global_colors_to_elementor', true ) ) {
wp_enqueue_style( 'kadence-elementor-admin', get_theme_file_uri( '/assets/css/elementor-admin.min.css' ), array(), KADENCE_VERSION );
}
}
/**
* Add some css styles for Restrict Content Pro
*/
public function elementor_add_theme_colors() {
if ( apply_filters( 'kadence_add_global_colors_to_elementor', true ) ) {
// // Prevent Errors.
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}
$theme_colors = array(
array(
'_id' => 'kadence1',
'title' => __( 'Theme Accent', 'kadence' ),
'color' => kadence()->palette_option( 'palette1' ),
),
array(
'_id' => 'kadence2',
'title' => __( 'Theme Accent - alt', 'kadence' ),
'color' => kadence()->palette_option( 'palette2' ),
),
array(
'_id' => 'kadence3',
'title' => __( 'Strongest text', 'kadence' ),
'color' => kadence()->palette_option( 'palette3' ),
),
array(
'_id' => 'kadence4',
'title' => __( 'Strong Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette4' ),
),
array(
'_id' => 'kadence5',
'title' => __( 'Medium text', 'kadence' ),
'color' => kadence()->palette_option( 'palette5' ),
),
array(
'_id' => 'kadence6',
'title' => __( 'Subtle Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette6' ),
),
array(
'_id' => 'kadence7',
'title' => __( 'Subtle Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette7' ),
),
array(
'_id' => 'kadence8',
'title' => __( 'Lighter Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette8' ),
),
array(
'_id' => 'kadence9',
'title' => __( 'White or offwhite', 'kadence' ),
'color' => kadence()->palette_option( 'palette9' ),
),
);
$theme_placeholder_colors = array(
array(
'_id' => 'palette1',
'title' => __( 'Theme Accent', 'kadence' ),
'color' => kadence()->palette_option( 'palette1' ),
),
array(
'_id' => 'palette2',
'title' => __( 'Theme Accent - alt', 'kadence' ),
'color' => kadence()->palette_option( 'palette2' ),
),
array(
'_id' => 'palette3',
'title' => __( 'Strongest text', 'kadence' ),
'color' => kadence()->palette_option( 'palette3' ),
),
array(
'_id' => 'palette4',
'title' => __( 'Strong Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette4' ),
),
array(
'_id' => 'palette5',
'title' => __( 'Medium text', 'kadence' ),
'color' => kadence()->palette_option( 'palette5' ),
),
array(
'_id' => 'palette6',
'title' => __( 'Subtle Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette6' ),
),
array(
'_id' => 'palette7',
'title' => __( 'Subtle Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette7' ),
),
array(
'_id' => 'palette8',
'title' => __( 'Lighter Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette8' ),
),
array(
'_id' => 'palette9',
'title' => __( 'White or offwhite', 'kadence' ),
'color' => kadence()->palette_option( 'palette9' ),
),
);
// Prevent Errors.
if ( ! method_exists( \Elementor\Plugin::$instance->kits_manager, 'get_current_settings' ) ) {
return;
}
$current = \Elementor\Plugin::$instance->kits_manager->get_current_settings();
if ( $current && isset( $current['custom_colors'] ) ) {
$custom_colors = $current['custom_colors'];
$kadence_add_array = array(
'kadence1' => true,
'kadence2' => true,
'kadence3' => true,
'kadence4' => true,
'kadence5' => true,
'kadence6' => true,
'kadence7' => true,
'kadence8' => true,
'kadence9' => true,
);
$kadence_add = true;
$clear_cache = false;
$kadence = array( 'kadence1', 'kadence2', 'kadence3', 'kadence4', 'kadence5', 'kadence6', 'kadence7', 'kadence8', 'kadence9' );
foreach ( $custom_colors as $key => $value ) {
if ( is_array( $value ) && isset( $value['_id'] ) && in_array( $value['_id'], $kadence ) ) {
$kadence_add = false;
if ( $value['_id'] == 'kadence1' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[0]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence1'] = false;
$custom_colors[ $key ] = $theme_colors[0];
}
if ( $value['_id'] == 'kadence2' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[1]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence2'] = false;
$custom_colors[ $key ] = $theme_colors[1];
}
if ( $value['_id'] == 'kadence3' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[2]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence3'] = false;
$custom_colors[ $key ] = $theme_colors[2];
}
if ( $value['_id'] == 'kadence4' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[3]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence4'] = false;
$custom_colors[ $key ] = $theme_colors[3];
}
if ( $value['_id'] == 'kadence5' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[4]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence5'] = false;
$custom_colors[ $key ] = $theme_colors[4];
}
if ( $value['_id'] == 'kadence6' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[5]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence6'] = false;
$custom_colors[ $key ] = $theme_colors[5];
}
if ( $value['_id'] == 'kadence7' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[6]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence7'] = false;
$custom_colors[ $key ] = $theme_colors[6];
}
if ( $value['_id'] == 'kadence8' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[7]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence8'] = false;
$custom_colors[ $key ] = $theme_colors[7];
}
if ( $value['_id'] == 'kadence9' ) {
if ( $custom_colors[ $key ]['color'] !== $theme_colors[8]['color'] ) {
$clear_cache = true;
}
$kadence_add_array['kadence9'] = false;
$custom_colors[ $key ] = $theme_colors[8];
}
}
}
if ( $kadence_add ) {
$custom_colors = array_merge( $theme_colors, $custom_colors );
} else {
$i = 0;
$new_add = array();
foreach ( $kadence_add_array as $key => $value ) {
if ( $value ) {
$new_add[] = $theme_colors[ $i ];
}
$i++;
}
// Somehow colors were removed so we need to add them back in.
if ( ! empty( $new_add ) ) {
$custom_colors = array_merge( $new_add, $custom_colors );
}
}
// error_log( 'Here is the error?' );
\Elementor\Plugin::$instance->kits_manager->update_kit_settings_based_on_option( 'custom_colors', $custom_colors );
\Elementor\Plugin::$instance->kits_manager->update_kit_settings_based_on_option( 'kadence_colors', $theme_placeholder_colors );
// Refresh cache.
if ( $clear_cache ) {
// If the palette was updated in the customizer then we need to clear all the css.
\Elementor\Plugin::instance()->files_manager->clear_cache();
}
}
}
}
/**
* Add in new Custom Controls for Theme Colors.
*/
public function elementor_add_theme_color_controls( $tab, $args ) {
if ( apply_filters( 'kadence_add_global_colors_to_elementor', true ) ) {
$tab->start_controls_section(
'section_theme_global_colors',
array(
'label' => __( 'Theme Global Colors', 'kadence' ),
'tab' => 'global-colors',
)
);
$repeater = new Repeater();
$repeater->add_control(
'title',
array(
'type' => Controls_Manager::TEXT,
'label_block' => true,
'required' => true,
)
);
// Color Value
$repeater->add_control(
'color',
array(
'type' => Controls_Manager::COLOR,
'label_block' => true,
'dynamic' => [],
'selectors' => array(
'{{WRAPPER}}.el-is-editing' => '--global-{{_id.VALUE}}: {{VALUE}}',
),
'global' => array(
'active' => false,
),
)
);
$theme_colors = array(
array(
'_id' => 'palette1',
'title' => __( 'Theme Accent', 'kadence' ),
'color' => kadence()->palette_option( 'palette1' ),
),
array(
'_id' => 'palette2',
'title' => __( 'Theme Accent - alt', 'kadence' ),
'color' => kadence()->palette_option( 'palette2' ),
),
array(
'_id' => 'palette3',
'title' => __( 'Strongest text', 'kadence' ),
'color' => kadence()->palette_option( 'palette3' ),
),
array(
'_id' => 'palette4',
'title' => __( 'Strong Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette4' ),
),
array(
'_id' => 'palette5',
'title' => __( 'Medium text', 'kadence' ),
'color' => kadence()->palette_option( 'palette5' ),
),
array(
'_id' => 'palette6',
'title' => __( 'Subtle Text', 'kadence' ),
'color' => kadence()->palette_option( 'palette6' ),
),
array(
'_id' => 'palette7',
'title' => __( 'Subtle Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette7' ),
),
array(
'_id' => 'palette8',
'title' => __( 'Lighter Background', 'kadence' ),
'color' => kadence()->palette_option( 'palette8' ),
),
array(
'_id' => 'palette9',
'title' => __( 'White or offwhite', 'kadence' ),
'color' => kadence()->palette_option( 'palette9' ),
),
);
$tab->add_control(
'kadence_colors',
array(
'type' => Global_Style_Repeater::CONTROL_TYPE,
'fields' => $repeater->get_controls(),
'default' => $theme_colors,
'item_actions' => array(
'add' => false,
'remove' => false,
),
)
);
$tab->end_controls_section();
}
}
/**
* Make sure it's not a post, then set the meta if the content is empty and we are in elementor.
*/
public function elementor_page_meta_setting() {
if ( ! apply_filters( 'kadence_theme_elementor_default', true ) || 'post' === get_post_type() ) {
return;
}
if ( ! $this->is_elementor() ) {
return;
}
global $post;
$page_id = get_the_ID();
$page_builder_layout = get_post_meta( $page_id, '_kad_pagebuilder_layout_flag', true );
if ( isset( $post ) && empty( $page_builder_layout ) && ( is_admin() || is_singular() ) ) {
if ( empty( $post->post_content ) && $this->is_built_with_elementor( $page_id ) ) {
update_post_meta( $page_id, '_kad_pagebuilder_layout_flag', 'disabled' );
update_post_meta( $page_id, '_kad_post_title', 'hide' );
update_post_meta( $page_id, '_kad_post_content_style', 'unboxed' );
update_post_meta( $page_id, '_kad_post_vertical_padding', 'hide' );
update_post_meta( $page_id, '_kad_post_feature', 'hide' );
$post_layout = get_post_meta( $page_id, '_kad_post_layout', true );
if ( empty( $post_layout ) || 'default' === $post_layout ) {
update_post_meta( $page_id, '_kad_post_layout', 'fullwidth' );
}
$post_title = get_post_meta( $page_id, '_kad_post_title', true );
if ( empty( $post_title ) || 'default' === $post_title ) {
update_post_meta( $page_id, '_kad_post_title', 'hide' );
}
}
}
}
/**
* Check if page is built with elementor
*
* @return boolean true if elementor edit false if not.
*/
private function is_built_with_elementor( $page_id ) {
return Elementor\Plugin::$instance->db->is_built_with_elementor( $page_id );
}
/**
* Check if in elementor editor.
*
* @return boolean true if elementor edit false if not.
*/
private function is_elementor() {
if ( ( isset( $_REQUEST['action'] ) && 'elementor' === $_REQUEST['action'] ) || isset( $_REQUEST['elementor-preview'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return true;
}
return false;
}
/**
* Check for use. Then
* Run all the Actions / Filters.
*/
public function init_header_footer_support() {
add_theme_support( 'header-footer-elementor' );
add_action( 'wp', array( $this, 'loading_header_footer_support' ) );
}
/**
* Check for use. Then
* Run all the Actions / Filters.
*/
public function loading_header_footer_support() {
if ( function_exists( 'hfe_header_enabled' ) ) {
if ( hfe_header_enabled() ) {
add_action( 'template_redirect', array( $this, 'remove_theme_header' ) );
add_action( 'kadence_header', 'hfe_render_header' );
}
}
if ( function_exists( 'hfe_footer_enabled' ) ) {
if ( hfe_footer_enabled() ) {
add_action( 'template_redirect', array( $this, 'remove_theme_footer' ) );
add_action( 'kadence_footer', 'hfe_render_footer' );
}
}
}
/**
* Disable header from the theme.
*/
public function remove_theme_header() {
remove_action( 'kadence_header', 'Kadence\header_markup' );
}
/**
* Disable header from the theme.
*/
public function remove_theme_footer() {
remove_action( 'kadence_footer', 'Kadence\footer_markup' );
}
}

View File

@@ -0,0 +1,138 @@
<?php
/**
* Kadence\Elementor_Pro\Component class
*
* @package kadence
*/
namespace Kadence\Elementor_Pro;
use Kadence\Component_Interface;
use Elementor;
use \ElementorPro\Modules\DynamicTags\Tags\Base\Data_Tag;
use \Elementor\Modules\DynamicTags\Module;
use \Elementor\Controls_Manager;
use function Kadence\kadence;
use function add_action;
if ( class_exists( '\ElementorPro\Modules\DynamicTags\Tags\Base\Data_Tag' ) ) {
/**
* Class for adding Elementor plugin support.
*/
class Elementor_Dynamic_Colors extends \ElementorPro\Modules\DynamicTags\Tags\Base\Data_Tag {
/**
* Get Name
*
* Returns the Name of the tag
*
* @since 2.0.0
* @access public
*
* @return string
*/
public function get_name() {
return 'kadence-color-palette';
}
/**
* Get Title
*
* Returns the title of the Tag
*
* @since 2.0.0
* @access public
*
* @return string
*/
public function get_title() {
return __( 'Kadence Color Palette', 'kadence' );
}
/**
* Get Group
*
* Returns the Group of the tag
*
* @since 2.0.0
* @access public
*
* @return string
*/
public function get_group() {
return 'kadence-palette';
}
/**
* Get Categories
*
* Returns an array of tag categories
*
* @since 2.0.0
* @access public
*
* @return array
*/
public function get_categories() {
return [ \Elementor\Modules\DynamicTags\Module::COLOR_CATEGORY ];
}
/**
* Register Controls
*
* Registers the Dynamic tag controls
*
* @since 2.0.0
* @access protected
*
* @return void
*/
protected function register_controls() {
$variables = array(
'palette1' => __( '1 - Accent', 'kadence' ),
'palette2' => __( '2 - Accent - alt', 'kadence' ),
'palette3' => __( '3 - Strongest text', 'kadence' ),
'palette4' => __( '4 - Strong Text', 'kadence' ),
'palette5' => __( '5 - Medium text', 'kadence' ),
'palette6' => __( '6 - Subtle Text', 'kadence' ),
'palette7' => __( '7 - Subtle Background', 'kadence' ),
'palette8' => __( '8 - Lighter Background', 'kadence' ),
'palette9' => __( '9 - White or offwhite', 'kadence' ),
'palette10' => __( '10 - Accent - Complement', 'kadence' ),
'palette11' => __( '11 - Notices - Success', 'kadence' ),
'palette12' => __( '12 - Notices - Info', 'kadence' ),
'palette13' => __( '13 - Notices - Alert', 'kadence' ),
'palette14' => __( '14 - Notices - Warning', 'kadence' ),
'palette15' => __( '15 - Notices - Rating', 'kadence' ),
);
$this->add_control(
'kadence_palette',
array(
'label' => __( 'Color', 'kadence' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => $variables,
)
);
}
/**
* Get Value
*
* Returns the value of the Dynamic tag
*
* @since 2.0.0
* @access public
*
* @return void
*/
public function get_value( array $options = array() ) {
$param_name = $this->get_settings( 'kadence_palette' );
if ( ! $param_name ) {
return;
}
$value = 'var(--global-' . $param_name . ')';
return $value;
}
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* Kadence\Elementor_Pro\Component class
*
* @package kadence
*/
namespace Kadence\Elementor_Pro;
use Kadence\Component_Interface;
use Kadence\Theme;
use Elementor;
use \Elementor\Plugin;
use ElementorPro\Modules\ThemeBuilder\ThemeSupport;
use Elementor\TemplateLibrary\Source_Local;
use ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager;
use ElementorPro\Modules\ThemeBuilder\Module;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function apply_filters;
use function get_template_part;
use function get_post_type;
use function is_account_page;
use function is_checkout;
use function is_cart;
/**
* Class for adding Elementor plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'elementor_pro';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'elementor/theme/register_locations', array( $this, 'register_elementor_locations' ) );
add_action( 'elementor/dynamic_tags/register_tags', array( $this, 'add_palette_colors' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'disable_theme_account_css' ), 20 );
add_action( 'wp_enqueue_scripts', array( $this, 'disable_theme_checkout_changes' ), 20 );
add_action( 'wp_enqueue_scripts', array( $this, 'disable_theme_cart_changes' ), 20 );
}
/**
* Disable theme account css.
*/
public function disable_theme_account_css() {
if ( class_exists( 'woocommerce' ) && is_account_page() ) {
if ( function_exists( 'elementor_location_exits' ) && \Elementor\Plugin::$instance->db->is_built_with_elementor( get_the_ID() ) ) {
wp_dequeue_style( 'kadence-account-woocommerce' );
$kadence_theme_class = \Kadence\Theme::instance();
remove_action( 'woocommerce_before_account_navigation', array( $kadence_theme_class->components['woocommerce'], 'myaccount_nav_wrap_start' ), 2 );
remove_action( 'woocommerce_before_account_navigation', array( $kadence_theme_class->components['woocommerce'], 'myaccount_nav_avatar' ), 20 );
remove_action( 'woocommerce_after_account_navigation', array( $kadence_theme_class->components['woocommerce'], 'myaccount_nav_wrap_end' ), 50 );
}
}
}
/**
* Disable theme checkout css.
*/
public function disable_theme_checkout_changes() {
if ( class_exists( 'woocommerce' ) && is_checkout() ) {
if ( function_exists( 'elementor_location_exits' ) && \Elementor\Plugin::$instance->db->is_built_with_elementor( get_the_ID() ) ) {
wp_enqueue_style( 'kadence-elementor-checkout', get_theme_file_uri( '/assets/css/elementor-checkout.min.css' ), array(), KADENCE_VERSION );
}
}
}
/**
* Disable theme cart changes.
*/
public function disable_theme_cart_changes() {
if ( class_exists( 'woocommerce' ) && is_cart() ) {
if ( function_exists( 'elementor_location_exits' ) && \Elementor\Plugin::$instance->db->is_built_with_elementor( get_the_ID() ) ) {
wp_enqueue_style( 'kadence-elementor-cart', get_theme_file_uri( '/assets/css/elementor-cart.min.css' ), array(), KADENCE_VERSION );
$kadence_theme_class = \Kadence\Theme::instance();
// Remove Cart Changes.
remove_action( 'woocommerce_before_cart', array( $kadence_theme_class->components['woocommerce'], 'cart_form_wrap_before' ) );
remove_action( 'woocommerce_after_cart', array( $kadence_theme_class->components['woocommerce'], 'cart_form_wrap_after' ) );
remove_action( 'woocommerce_before_cart_table', array( $kadence_theme_class->components['woocommerce'], 'cart_summary_title' ) );
}
}
}
/**
* Elementor dynamic tag support.
*
* @param object $dynamic_tags the dynamic tags modal.
*/
public function add_palette_colors( $dynamic_tags ) {
if ( apply_filters( 'kadence_theme_add_palette_to_elementor_tags', false ) ) {
// In our Dynamic Tag we use a group named request-variables so we need.
// To register that group as well before the tag.
\Elementor\Plugin::$instance->dynamic_tags->register_group(
'kadence-palette',
array(
'title' => __( 'Kadence Theme', 'kadence' ),
)
);
require_once get_template_directory() . '/inc/components/elementor_pro/class-elementor-dynamic-colors.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
// Finally register the tag.
$dynamic_tags->register_tag( 'Kadence\Elementor_Pro\Elementor_Dynamic_Colors' );
}
}
/**
* Elementor Location support.
*
* @param object $elementor_theme_manager the theme manager.
*/
public function register_elementor_locations( $elementor_theme_manager ) {
$elementor_theme_manager->register_all_core_location();
$elementor_theme_manager->register_location(
'header',
array(
'hook' => 'kadence_header',
'remove_hooks' => array( 'Kadence\header_markup' ),
)
);
$elementor_theme_manager->register_location(
'footer',
array(
'hook' => 'kadence_footer',
'remove_hooks' => array( 'Kadence\footer_markup' ),
)
);
$elementor_theme_manager->register_location(
'single',
array(
'hook' => 'kadence_single',
'remove_hooks' => array( 'Kadence\single_markup' ),
)
);
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* Kadence\Entry_Title\Component class
*
* @package kadence
*/
namespace Kadence\Entry_Title;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function add_action;
use function apply_filters;
use function Kadence\kadence;
use function get_template_part;
/**
* Class for adding custom title area support.
*
* Exposes template tags:
* * `kadence()->render_title()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'entry_title';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
//add_filter( 'kadence_title_elements_default', array( $this, 'maybe_add_defaults' ), 10, 2 );
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'render_title' => array( $this, 'render_title' ),
);
}
/**
* Adds support to render header columns.
*
* @param string $post_type the name of the row.
* @param string $area the name of the area.
*/
public function render_title( $post_type = 'post', $area = 'normal' ) {
$elements = kadence()->option( $post_type . '_title_elements' );
if ( isset( $elements ) && is_array( $elements ) && ! empty( $elements ) ) {
foreach ( $elements as $item ) {
if ( kadence()->sub_option( $post_type . '_title_element_' . $item, 'enabled' ) ) {
$template = apply_filters( 'kadence_title_elements_template_path', 'template-parts/title/' . $item, $item, $area );
get_template_part( $template );
}
}
} else {
get_template_part( 'template-parts/title/title' );
}
}
}

View File

@@ -0,0 +1,139 @@
<?php
/**
* Kadence\Essential_Real_Estate\Component class
*
* @package kadence
*/
namespace Kadence\Essential_Real_Estate;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function get_template_part;
/**
* Class for integrating with the block Third_Party.
*
* @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'essential_real_estate';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// WeDocs.
remove_action( 'ere_before_main_content', 'ere_output_content_wrapper_start' );
remove_action( 'ere_after_main_content', 'ere_after_main_content' );
remove_action( 'ere_sidebar_property', 'ere_sidebar_property' );
add_action( 'ere_before_main_content', [ $this, 'output_content_wrapper' ] );
add_action( 'ere_after_main_content', [ $this, 'output_content_wrapper_end' ] );
// add_action( 'ere_before_main_content', array( $this, 'output_content_inner' ), 20 );
// add_action( 'ere_after_main_content', array( $this, 'output_content_inner_end' ), 20 );
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner() {
if ( is_archive() ) {
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_archive_content' );
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
?>
<div id="archive-container" class="content-wrap">
<?php
} else {
if ( kadence()->show_feature_above() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
?>
<div class="entry-content-wrap">
<?php
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/entry_header', get_post_type() );
}
if ( kadence()->show_feature_below() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
}
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner_end() {
?>
</div>
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_archive_content_inner() {
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_archive_content' );
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
?>
<div id="archive-container" class="content-wrap">
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
// /**
// * Hook for Hero Section
// */
// do_action( 'kadence_hero_header' );
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<div id="main" class="site-main">
<?php
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_main_content' );
?>
<div class="content-wrap">
<?php
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
?>
</div>
<?php
/**
* Hook for anything after main content
*/
do_action( 'kadence_after_main_content' );
?>
</div><!-- #main -->
<?php
get_sidebar();
?>
</div>
</div><!-- #primary -->
<?php
}
}

View File

@@ -0,0 +1,138 @@
<?php
/**
* Kadence\Estatik\Component class
*
* @package kadence
*/
namespace Kadence\Estatik;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function get_template_part;
/**
* Class for integrating with the block Third_Party.
*
* @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'estatik';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// remove_action( 'es_before_content', 'ere_output_content_wrapper_start' );
// remove_action( 'es_after_content', 'es_after_content' );
// remove_action( 'ere_sidebar_property', 'ere_sidebar_property' );
add_action( 'es_before_content', [ $this, 'output_content_wrapper' ] );
add_action( 'es_after_content', [ $this, 'output_content_wrapper_end' ] );
// add_action( 'es_before_content', array( $this, 'output_content_inner' ), 20 );
// add_action( 'es_after_content', array( $this, 'output_content_inner_end' ), 20 );
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner() {
if ( is_archive() ) {
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_archive_content' );
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
?>
<div id="archive-container" class="content-wrap">
<?php
} else {
if ( kadence()->show_feature_above() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
?>
<div class="entry-content-wrap">
<?php
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/entry_header', get_post_type() );
}
if ( kadence()->show_feature_below() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
}
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner_end() {
?>
</div>
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_archive_content_inner() {
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_archive_content' );
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
?>
<div id="archive-container" class="content-wrap">
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
// /**
// * Hook for Hero Section
// */
// do_action( 'kadence_hero_header' );
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<div id="main" class="site-main">
<?php
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_main_content' );
?>
<div class="content-wrap">
<?php
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
?>
</div>
<?php
/**
* Hook for anything after main content
*/
do_action( 'kadence_after_main_content' );
?>
</div><!-- #main -->
<?php
get_sidebar();
?>
</div>
</div><!-- #primary -->
<?php
}
}

View File

@@ -0,0 +1,457 @@
<?php
/**
* Kadence\GiveWP\Component class
*
* @package kadence
*/
namespace Kadence\Give;
use Kadence\Component_Interface;
use Kadence\Kadence_CSS;
use function Kadence\kadence;
use function Kadence\print_webfont_preload;
use function Kadence\get_webfont_url;
use function add_action;
use function get_template_part;
use function get_post_type;
/**
* Class for adding Woocommerce plugin support.
*/
class Component implements Component_Interface {
/**
* Associative array of Google Fonts to load.
*
* Do not access this property directly, instead use the `get_google_fonts()` method.
*
* @var array
*/
protected static $google_fonts = [];
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'give';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// New Visual Builder Styles.
add_action( 'givewp_donation_form_enqueue_scripts', [ $this, 'update_visual_builder_template_styles' ], 10 );
add_action( 'givewp_donation_form_enqueue_scripts', [ $this, 'update_visual_builder_template_fonts' ], 15 );
add_action( 'wp_print_styles', [ $this, 'override_iframe_template_styles' ], 10 );
add_action( 'wp_print_styles', [ $this, 'add_iframe_fonts' ], 20 );
add_action( 'give_default_wrapper_start', [ $this, 'output_content_wrapper' ] );
add_action( 'give_default_wrapper_end', [ $this, 'output_content_wrapper_end' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'give_styles' ], 60 );
add_filter( 'post_class', [ $this, 'set_give_entry_class' ], 10, 3 );
add_action( 'give_before_single_form_summary', [ $this, 'output_inner_content_wrapper' ], 2 );
add_action( 'give_after_single_form_summary', [ $this, 'output_inner_content_wrapper_end' ] );
add_action( 'give_single_form_summary', [ $this, 'maybe_add_title' ], 1 );
remove_action( 'give_single_form_summary', 'give_template_single_title', 5 );
}
/**
* Adds theme output Wrapper.
*/
public function maybe_add_title() {
if ( function_exists( 'give_get_meta' ) ) {
$form_template = give_get_meta( get_the_ID(), '_give_form_template', true );
if ( ( ! $form_template || 'legacy' === $form_template ) && kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/entry_header', get_post_type() );
}
} elseif ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/entry_header', get_post_type() );
}
}
/**
* Adds entry class to loop items.
*
* @param array $classes the classes.
* @param string $class the class.
* @param int $post_id the post id.
*/
public function set_give_entry_class( $classes, $class, $post_id ) {
if ( is_singular() && in_array( 'type-give_forms', $classes, true ) ) {
$classes[] = 'entry';
$classes[] = 'content-bg';
$classes[] = 'single-entry';
}
return $classes;
}
/**
* Add some css styles for zoom_recipe_card
*/
public function give_styles() {
wp_enqueue_style( 'kadence-givewp', get_theme_file_uri( '/assets/css/givewp.min.css' ), [], KADENCE_VERSION );
}
/**
* Adds theme output Wrapper.
*/
public function output_inner_content_wrapper() {
?>
<div class="entry-content-wrap">
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_inner_content_wrapper_end() {
?>
</div>
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<div id="main" class="site-main">
<?php
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_main_content' );
?>
<div class="content-wrap">
<?php
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
?>
</div>
<?php
/**
* Hook for anything after main content
*/
do_action( 'kadence_after_main_content' );
?>
</div><!-- #main -->
<?php
get_sidebar();
?>
</div>
</div><!-- #primary -->
<?php
}
/**
* Registers or enqueues google fonts.
*/
public function add_iframe_fonts() {
// Enqueue Google Fonts.
$google_fonts = apply_filters( 'kadence_theme_givewp_google_fonts_array', self::$google_fonts );
if ( empty( $google_fonts ) ) {
return '';
}
$link = '';
$sub_add = [];
$subsets = kadence()->option( 'google_subsets' );
foreach ( $google_fonts as $key => $gfont_values ) {
if ( ! empty( $link ) ) {
$link .= '%7C'; // Append a new font to the string.
}
$link .= $gfont_values['fontfamily'];
if ( ! empty( $gfont_values['fontvariants'] ) ) {
$link .= ':';
$link .= implode( ',', $gfont_values['fontvariants'] );
}
if ( ! empty( $gfont_values['fontsubsets'] ) && is_array( $gfont_values['fontsubsets'] ) ) {
foreach ( $gfont_values['fontsubsets'] as $subkey ) {
if ( ! empty( $subkey ) && ! isset( $sub_add[ $subkey ] ) ) {
$sub_add[] = $subkey;
}
}
}
}
$args = [
'family' => $link,
];
if ( ! empty( $subsets ) ) {
$available = [ 'latin-ext', 'cyrillic', 'cyrillic-ext', 'greek', 'greek-ext', 'vietnamese', 'arabic', 'khmer', 'chinese', 'chinese-simplified', 'tamil', 'bengali', 'devanagari', 'hebrew', 'korean', 'thai', 'telugu' ];
foreach ( $subsets as $key => $enabled ) {
if ( $enabled && in_array( $key, $available, true ) ) {
if ( 'chinese' === $key ) {
$key = 'chinese-traditional';
}
if ( ! isset( $sub_add[ $key ] ) ) {
$sub_add[] = $key;
}
}
}
if ( $sub_add ) {
$args['subset'] = implode( ',', $sub_add );
}
}
if ( apply_filters( 'kadence_givewp_display_swap_google_fonts', true ) ) {
$args['display'] = 'swap';
}
$google_fonts_url = add_query_arg( apply_filters( 'kadence_theme_givewp_google_fonts_query_args', $args ), 'https://fonts.googleapis.com/css' );
// Check if give-sequoia-template-css is enqueued
if ( ! empty( $google_fonts_url ) && wp_style_is( 'give-sequoia-template-css', 'enqueued' ) ) {
if ( kadence()->option( 'load_fonts_local' ) ) {
if ( kadence()->option( 'preload_fonts_local' ) && apply_filters( 'kadence_local_fonts_preload', true ) ) {
print_webfont_preload( $google_fonts_url );
}
wp_enqueue_style(
'kadence-givewp-iframe-fonts',
get_webfont_url( $google_fonts_url ),
[ 'give-sequoia-template-css' ],
KADENCE_VERSION
);
} else {
wp_enqueue_style( 'kadence-givewp-iframe-fonts', $google_fonts_url, [ 'give-sequoia-template-css' ], KADENCE_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
}
}
}
/**
* Add Visual Builder Styles.
*/
public function update_visual_builder_template_fonts() {
// Enqueue Google Fonts.
$google_fonts = apply_filters( 'kadence_theme_givewp_google_fonts_array', self::$google_fonts );
if ( empty( $google_fonts ) ) {
return '';
}
$link = '';
$sub_add = [];
$subsets = kadence()->option( 'google_subsets' );
foreach ( $google_fonts as $key => $gfont_values ) {
if ( ! empty( $link ) ) {
$link .= '%7C'; // Append a new font to the string.
}
$link .= $gfont_values['fontfamily'];
if ( ! empty( $gfont_values['fontvariants'] ) ) {
$link .= ':';
$link .= implode( ',', $gfont_values['fontvariants'] );
}
if ( ! empty( $gfont_values['fontsubsets'] ) && is_array( $gfont_values['fontsubsets'] ) ) {
foreach ( $gfont_values['fontsubsets'] as $subkey ) {
if ( ! empty( $subkey ) && ! isset( $sub_add[ $subkey ] ) ) {
$sub_add[] = $subkey;
}
}
}
}
$args = [
'family' => $link,
];
if ( ! empty( $subsets ) ) {
$available = [ 'latin-ext', 'cyrillic', 'cyrillic-ext', 'greek', 'greek-ext', 'vietnamese', 'arabic', 'khmer', 'chinese', 'chinese-simplified', 'tamil', 'bengali', 'devanagari', 'hebrew', 'korean', 'thai', 'telugu' ];
foreach ( $subsets as $key => $enabled ) {
if ( $enabled && in_array( $key, $available, true ) ) {
if ( 'chinese' === $key ) {
$key = 'chinese-traditional';
}
if ( ! isset( $sub_add[ $key ] ) ) {
$sub_add[] = $key;
}
}
}
if ( $sub_add ) {
$args['subset'] = implode( ',', $sub_add );
}
}
if ( apply_filters( 'kadence_givewp_display_swap_google_fonts', true ) ) {
$args['display'] = 'swap';
}
$google_fonts_url = add_query_arg( apply_filters( 'kadence_theme_givewp_google_fonts_query_args', $args ), 'https://fonts.googleapis.com/css' );
if ( ! empty( $google_fonts_url ) ) {
if ( kadence()->option( 'load_fonts_local' ) ) {
if ( kadence()->option( 'preload_fonts_local' ) && apply_filters( 'kadence_local_fonts_preload', true ) ) {
print_webfont_preload( $google_fonts_url );
}
wp_enqueue_style(
'kadence-givewp-visual-iframe-fonts',
get_webfont_url( $google_fonts_url ),
[],
KADENCE_VERSION
);
} else {
wp_enqueue_style( 'kadence-givewp-visual-iframe-fonts', $google_fonts_url, [], KADENCE_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
}
}
}
/**
* Add Visual Builder Styles.
*/
public function update_visual_builder_template_styles() {
$css = new Kadence_CSS();
$media_query = [];
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
// Globals.
$css->set_selector( ':root' );
$css->add_property( '--global-palette1', kadence()->palette_option( 'palette1' ) );
$css->add_property( '--global-palette2', kadence()->palette_option( 'palette2' ) );
$css->add_property( '--global-palette3', kadence()->palette_option( 'palette3' ) );
$css->add_property( '--global-palette4', kadence()->palette_option( 'palette4' ) );
$css->add_property( '--global-palette5', kadence()->palette_option( 'palette5' ) );
$css->add_property( '--global-palette6', kadence()->palette_option( 'palette6' ) );
$css->add_property( '--global-palette7', kadence()->palette_option( 'palette7' ) );
$css->add_property( '--global-palette8', kadence()->palette_option( 'palette8' ) );
$css->add_property( '--global-palette9', kadence()->palette_option( 'palette9' ) );
$css->add_property( '--global-palette10', kadence()->palette_option( 'palette10' ) );
$css->add_property( '--global-palette11', kadence()->palette_option( 'palette11' ) );
$css->add_property( '--global-palette12', kadence()->palette_option( 'palette12' ) );
$css->add_property( '--global-palette13', kadence()->palette_option( 'palette13' ) );
$css->add_property( '--global-palette14', kadence()->palette_option( 'palette14' ) );
$css->add_property( '--global-palette15', kadence()->palette_option( 'palette15' ) );
$css->add_property( '--global-palette-highlight', $css->render_color( kadence()->sub_option( 'link_color', 'highlight' ) ) );
$css->add_property( '--global-palette-highlight-alt', $css->render_color( kadence()->sub_option( 'link_color', 'highlight-alt' ) ) );
$css->add_property( '--global-palette-highlight-alt2', $css->render_color( kadence()->sub_option( 'link_color', 'highlight-alt2' ) ) );
// Button.
$css->add_property( '--global-palette-btn-bg', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_background', 'color' ) ) );
$css->add_property( '--global-palette-btn-bg-hover', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_background', 'hover' ) ) );
$css->add_property( '--global-palette-btn', $css->render_color( kadence()->sub_option( 'buttons_color', 'color' ) ) );
$css->add_property( '--global-palette-btn-hover', $css->render_color( kadence()->sub_option( 'buttons_color', 'hover' ) ) );
// Button Secondary.
$css->add_property( '--global-palette-btn-sec-bg', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_secondary_background', 'color' ) ) );
$css->add_property( '--global-palette-btn-sec-bg-hover', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_secondary_background', 'hover' ) ) );
$css->add_property( '--global-palette-btn-sec', $css->render_color( kadence()->sub_option( 'buttons_secondary_color', 'color' ) ) );
$css->add_property( '--global-palette-btn-sec-hover', $css->render_color( kadence()->sub_option( 'buttons_secondary_color', 'hover' ) ) );
// Button Outline.
$css->add_property( '--global-palette-btn-out-bg', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_outline_background', 'color' ) ) );
$css->add_property( '--global-palette-btn-out-bg-hover', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_outline_background', 'hover' ) ) );
$css->add_property( '--global-palette-btn-out', $css->render_color( kadence()->sub_option( 'buttons_outline_color', 'color' ) ) );
$css->add_property( '--global-palette-btn-out-hover', $css->render_color( kadence()->sub_option( 'buttons_outline_color', 'hover' ) ) );
$css->add_property( '--global-body-font-family', $css->render_font_family( kadence()->option( 'base_font' ), '' ) );
$css->add_property( '--global-heading-font-family', $css->render_font_family( kadence()->option( 'heading_font' ) ) );
$css->add_property( '--global-fallback-font', apply_filters( 'kadence_theme_global_typography_fallback', 'sans-serif' ) );
$css->add_property( '--global-display-fallback-font', apply_filters( 'kadence_theme_global_display_typography_fallback', 'sans-serif' ) );
$css->set_selector( 'body .givewp-donation-form' );
$css->add_property( '--font-family', 'var(--global-body-font-family)' );
$css->set_selector( '.givewp-layouts-headerTitle' );
$css->add_property( '--font-family', 'var(--global-heading-font-family )' );
self::$google_fonts = $css->fonts_output();
wp_add_inline_style( 'givewp-base-form-styles', $css->css_output() );
}
/**
* Add basic theme styling to iframe.
*/
public function override_iframe_template_styles() {
$css = new Kadence_CSS();
$media_query = [];
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
// Globals.
$css->set_selector( ':root' );
$css->add_property( '--global-palette1', kadence()->palette_option( 'palette1' ) );
$css->add_property( '--global-palette2', kadence()->palette_option( 'palette2' ) );
$css->add_property( '--global-palette3', kadence()->palette_option( 'palette3' ) );
$css->add_property( '--global-palette4', kadence()->palette_option( 'palette4' ) );
$css->add_property( '--global-palette5', kadence()->palette_option( 'palette5' ) );
$css->add_property( '--global-palette6', kadence()->palette_option( 'palette6' ) );
$css->add_property( '--global-palette7', kadence()->palette_option( 'palette7' ) );
$css->add_property( '--global-palette8', kadence()->palette_option( 'palette8' ) );
$css->add_property( '--global-palette9', kadence()->palette_option( 'palette9' ) );
$css->add_property( '--global-palette10', kadence()->palette_option( 'palette10' ) );
$css->add_property( '--global-palette11', kadence()->palette_option( 'palette11' ) );
$css->add_property( '--global-palette12', kadence()->palette_option( 'palette12' ) );
$css->add_property( '--global-palette13', kadence()->palette_option( 'palette13' ) );
$css->add_property( '--global-palette14', kadence()->palette_option( 'palette14' ) );
$css->add_property( '--global-palette15', kadence()->palette_option( 'palette15' ) );
$css->add_property( '--global-palette-highlight', $css->render_color( kadence()->sub_option( 'link_color', 'highlight' ) ) );
$css->add_property( '--global-palette-highlight-alt', $css->render_color( kadence()->sub_option( 'link_color', 'highlight-alt' ) ) );
$css->add_property( '--global-palette-highlight-alt2', $css->render_color( kadence()->sub_option( 'link_color', 'highlight-alt2' ) ) );
$css->add_property( '--global-palette-btn-bg', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_background', 'color' ) ) );
$css->add_property( '--global-palette-btn-bg-hover', $css->render_color_or_gradient( kadence()->sub_option( 'buttons_background', 'hover' ) ) );
$css->add_property( '--global-palette-btn', $css->render_color( kadence()->sub_option( 'buttons_color', 'color' ) ) );
$css->add_property( '--global-palette-btn-hover', $css->render_color( kadence()->sub_option( 'buttons_color', 'hover' ) ) );
$css->add_property( '--global-body-font-family', $css->render_font_family( kadence()->option( 'base_font' ), '' ) );
$css->add_property( '--global-heading-font-family', $css->render_font_family( kadence()->option( 'heading_font' ) ) );
$css->add_property( '--global-fallback-font', apply_filters( 'kadence_theme_global_typography_fallback', 'sans-serif' ) );
$css->add_property( '--global-display-fallback-font', apply_filters( 'kadence_theme_global_display_typography_fallback', 'sans-serif' ) );
$css->set_selector( 'body' );
$css->add_property( 'margin', '10px' );
$css->add_property( 'font-family', 'var( --global-body-font-family )' );
$css->add_property( 'color', 'var(--global-palette4 )' );
$css->set_selector( '.give-embed-form, .give-embed-receipt' );
$css->add_property( 'color', 'var(--global-palette5 )' );
$css->add_property( 'background-color', 'var(--global-palette9 )' );
$css->add_property( 'box-shadow', '0px 15px 25px -10px rgb(0 0 0 / 5%)' );
$css->add_property( 'border-radius', '.25rem' );
$css->add_property( 'border', '1px solid var( --global-palette7 )' );
$css->set_selector( 'body.give-form-templates .give-form-navigator' );
$css->add_property( 'border', '1px solid transparent' );
$css->add_property( 'background', 'var(--global-palette8 )' );
$css->set_selector( '.form-footer .secure-notice' );
$css->add_property( 'background', 'var(--global-palette8 )' );
$css->add_property( 'border-top', '1px solid var( --global-palette7 )' );
$css->add_property( 'color', 'var(--global-palette6 )' );
$css->set_selector( 'body.give-form-templates .give-form-navigator.nav-visible' );
$css->add_property( 'border', '1px solid var( --global-palette7 )' );
$css->set_selector( '.form-footer .navigator-tracker .step-tracker' );
$css->add_property( 'background', 'var(--global-palette7 )' );
$css->set_selector( '.form-footer .navigator-tracker .step-tracker.current' );
$css->add_property( 'background', 'var(--global-palette6 )' );
$css->set_selector( '.payment #give_purchase_form_wrap' );
$css->add_property( 'background', 'var(--global-palette8 )' );
$css->set_selector(
'body.give-form-templates,
body.give-form-templates .give-btn,
body.give-form-templates .choose-amount .give-donation-amount .give-amount-top,
body.give-form-templates #give-recurring-form .form-row input[type=email],
body.give-form-templates #give-recurring-form .form-row input[type=password],
body.give-form-templates #give-recurring-form .form-row input[type=tel],
body.give-form-templates #give-recurring-form .form-row input[type=text],
body.give-form-templates #give-recurring-form .form-row input[type=url],
body.give-form-templates #give-recurring-form .form-row textarea, .give-input-field-wrapper,
body.give-form-templates .give-square-cc-fields,
body.give-form-templates .give-stripe-cc-field,
body.give-form-templates .give-stripe-single-cc-field-wrap,
body.give-form-templates form.give-form .form-row input[type=email],
body.give-form-templates form.give-form .form-row input[type=password],
body.give-form-templates form.give-form .form-row input[type=tel],
body.give-form-templates form.give-form .form-row input[type=text],
body.give-form-templates form.give-form .form-row input[type=url],
body.give-form-templates form.give-form .form-row textarea,
body.give-form-templates form[id*=give-form] .form-row input[type=email],
body.give-form-templates form[id*=give-form] .form-row input[type=email].required,
body.give-form-templates form[id*=give-form] .form-row input[type=password],
body.give-form-templates form[id*=give-form] .form-row input[type=password].required,
body.give-form-templates form[id*=give-form] .form-row input[type=tel],
body.give-form-templates form[id*=give-form] .form-row input[type=tel].required,
body.give-form-templates form[id*=give-form] .form-row input[type=text],
body.give-form-templates form[id*=give-form] .form-row input[type=text].required,
body.give-form-templates form[id*=give-form] .form-row input[type=url],
body.give-form-templates form[id*=give-form] .form-row input[type=url].required,
body.give-form-templates form[id*=give-form] .form-row textarea,
body.give-form-templates form[id*=give-form] .form-row textarea.required'
);
$css->add_property( 'font-family', 'var( --global-body-font-family )' );
$css->set_selector( '.give-stripe-becs-mandate-acceptance-text, .give-stripe-sepa-mandate-acceptance-text, p, .give-form-navigator>.title, .give-form-navigator>.back-btn,.payment .subheading' );
$css->add_property( 'color', 'var(--global-palette5 )' );
$css->set_selector( 'h1,h2,h3,h4,h5,h6, .payment .heading' );
$css->add_property( 'color', 'var(--global-palette3 )' );
$css->set_selector( '.advance-btn, .download-btn, .give-submit' );
$css->add_property( 'text-transform', 'uppercase' );
$css->add_property( 'font-weight', '600' );
$css->add_property( 'font-size', '16px' );
$css->add_property( 'padding', '14px 30px !important' );
self::$google_fonts = $css->fonts_output();
wp_add_inline_style( 'give-sequoia-template-css', $css->css_output() );
}
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* Kadence\Heroic_Kb\Component class
*
* @package kadence
*/
namespace Kadence\Heroic_Kb;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function get_template_part;
use function locate_template;
/**
* Class for integrating with the block Heroic_Kb.
*
* @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'heroic_kb';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// Heroic Knowledge Base.
//add_filter( 'hkb_locate_template', array( $this, 'output_edited_search' ) );
add_filter( 'hkb_show_knowledgebase_search', array( $this, 'override_search_location' ) );
add_filter( 'hkb_show_knowledgebase_breadcrumbs', array( $this, 'override_search_location' ) );
add_action( 'kadence_entry_archive_hero', array( $this, 'ht_knowledge_base_breadcrumb_in_title' ), 5 );
add_action( 'kadence_entry_archive_header', array( $this, 'ht_knowledge_base_breadcrumb_in_title' ), 5 );
//add_action( 'kadence_entry_header', array( $this, 'ht_knowledge_base_breadcrumb_in_title' ), 5 );
add_action( 'kadence_entry_archive_hero', array( $this, 'ht_knowledge_base_search_in_title' ), 20 );
add_action( 'kadence_entry_archive_header', array( $this, 'ht_knowledge_base_search_in_title' ), 20 );
add_action( 'kadence_entry_header', array( $this, 'ht_knowledge_base_search_in_title' ), 20 );
}
/**
* Check to see if string ends with somthing.
*
* @param string $string the string.
* @param string $test the test.
*/
public function endswith( $string, $test ) {
$strlen = strlen( $string );
$testlen = strlen( $test );
if ( $testlen > $strlen ) {
return false;
}
return substr_compare( $string, $test, $strlen - $testlen, $testlen ) === 0;
}
/**
* Changes Heroic Knowledge Base Search Button.
*
* @param string $template the template.
*/
public function output_edited_search( $template ) {
if ( $this->endswith( $template, 'hkb-searchbox.php' ) ) {
$template = locate_template( 'template-parts/archive-title/hkb-searchbox' );
}
return $template;
}
/**
* Changes Heroic Knowledge Base Search Button.
*
* @param bool $show_search whether to show search.
*/
public function override_search_location( $show_search ) {
return false;
}
/**
* Adds Support for Heroic Knowledge Base Search in Title Area.
*/
public function ht_knowledge_base_search_in_title() {
if ( ( is_tax( 'ht_kb_category' ) || is_tax( 'ht_kb_tag' ) || is_post_type_archive( 'ht_kb' ) || ( is_search() && array_key_exists( 'ht-kb-search', $_REQUEST ) ) ) ) {
get_template_part( 'template-parts/archive-title/hkb-searchbox' );
}
}
/**
* Adds Support for Heroic Knowledge Base Breadcrumb in Title Area.
*/
public function ht_knowledge_base_breadcrumb_in_title() {
if ( ( is_tax( 'ht_kb_category' ) || is_tax( 'ht_kb_tag' ) || is_post_type_archive( 'ht_kb' ) || ( is_search() && array_key_exists( 'ht-kb-search', $_REQUEST ) ) ) ) {
kadence()->print_breadcrumb();
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,77 @@
<?php
/**
* Kadence\Image_Sizes\Component class
*
* @package kadence
*/
namespace Kadence\Image_Sizes;
use Kadence\Component_Interface;
use function Kadence\kadence;
use WP_Post;
use function add_filter;
use function is_active_sidebar;
/**
* Class for managing responsive image sizes.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'image_sizes';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
//add_filter( 'wp_calculate_image_sizes', array( $this, 'filter_content_image_sizes_attr' ), 10, 2 );
//add_filter( 'wp_get_attachment_image_attributes', array( $this, 'filter_post_thumbnail_sizes_attr' ), 10, 3 );
}
/**
* Adds custom image sizes attribute to enhance responsive image functionality for content images.
*
* @param string $sizes A source size value for use in a 'sizes' attribute.
* @param array $size Image size. Accepts an array of width and height
* values in pixels (in that order).
* @return string A source size value for use in a content image 'sizes' attribute.
*/
public function filter_content_image_sizes_attr( string $sizes, array $size ) : string {
$width = $size[0];
if ( 740 <= $width ) {
$sizes = '100vw';
}
if ( kadence()->has_sidebar() ) {
$sizes = '(min-width: 960px) 75vw, 100vw';
}
return $sizes;
}
/**
* Adds custom image sizes attribute to enhance responsive image functionality for post thumbnails.
*
* @param array $attr Attributes for the image markup.
* @param WP_Post $attachment Attachment post object.
* @param string|array $size Registered image size or flat array of height and width dimensions.
* @return array The filtered attributes for the image markup.
*/
public function filter_post_thumbnail_sizes_attr( array $attr, WP_Post $attachment, $size ) : array {
$attr['sizes'] = '100vw';
if ( kadence()->has_sidebar() ) {
$attr['sizes'] = '(min-width: 960px) 75vw, 100vw';
}
return $attr;
}
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* Kadence\Jetpack\Component class
*
* @package kadence
*/
namespace Kadence\Jetpack;
use Kadence\Component_Interface;
use function add_action;
use function add_theme_support;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
/**
* Class for adding Jetpack plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'jetpack';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_jetpack_support' ) );
}
/**
* Adds theme support for the Jetpack plugin.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
* See: https://jetpack.com/support/content-options/
*/
public function action_add_jetpack_support() {
// Add theme support for Infinite Scroll.
add_theme_support(
'infinite-scroll',
array(
'container' => 'archive-container',
'footer' => false,
'wrapper' => false,
'render' => function() {
while ( have_posts() ) {
the_post();
if ( is_search() ) {
get_template_part( 'template-parts/content/entry', 'search' );
} else {
get_template_part( 'template-parts/content/entry', get_post_type() );
}
}
},
)
);
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
// Add theme support for Content Options.
add_theme_support(
'jetpack-content-options',
array(
'post-details' => array(
'stylesheet' => 'kadence-content',
'date' => '.posted-on',
'categories' => '.category-links',
'tags' => '.tag-links',
'author' => '.posted-by',
'comment' => '.comments-link',
),
)
);
}
}

View File

@@ -0,0 +1,922 @@
<?php
/**
* Kadence\Layout\Component class
*
* @package kadence
*/
namespace Kadence\Layout;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function register_sidebar;
use function is_active_sidebar;
use function dynamic_sidebar;
/**
* Class for managing page/post layouts.
*
* Exposes template tags:
* * `kadence()->get_layout()`
* * `kadence()->get_feature()`
* * `kadence()->show_feature()`
* * `kadence()->show_feature_above()`
* * `kadence()->show_feature_below()`
* * `kadence()->get_feature_position()`
* * `kadence()->show_comments()`
* * `kadence()->show_hero_title()`
* * `kadence()->show_in_content_title()`
* * `kadence()->get_boxed()`
* * `kadence()->has_sidebar()`
* * `kadence()->sidebar_id()`
* * `kadence()->sidebar_id_class()`
* * `kadence()->sidebar_side()`
* * `kadence()->display_sidebar()`
* * `kadence()->has_header()`
* * `kadence()->has_header_styles()`
* * `kadence()->has_footer()`
* * `kadence()->has_content()`
*
* @link https://developer.wordpress.org/themes/functionality/layout/
*/
class Component implements Component_Interface, Templating_Component_Interface {
const PRIMARY_SIDEBAR_SLUG = 'sidebar-primary';
const SECONDARY_SIDEBAR_SLUG = 'sidebar-secondary';
/**
* Holds the string for width layout.
*
* @var values of the theme settings.
*/
public static $layout = null;
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'layout';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'body_class', array( $this, 'filter_body_classes' ) );
add_action( 'widgets_init', array( $this, 'action_register_sidebars' ) );
add_filter( 'register_sidebar_defaults', array( $this, 'change_sidebar_default_args' ) );
}
/**
* Registers the sidebars.
*/
public function action_register_sidebars() {
$widgets = array(
'sidebar-primary' => __( 'Sidebar 1', 'kadence' ),
'sidebar-secondary' => __( 'Sidebar 2', 'kadence' ),
'footer1' => __( 'Footer 1', 'kadence' ),
'footer2' => __( 'Footer 2', 'kadence' ),
'footer3' => __( 'Footer 3', 'kadence' ),
'footer4' => __( 'Footer 4', 'kadence' ),
'footer5' => __( 'Footer 5', 'kadence' ),
'footer6' => __( 'Footer 6', 'kadence' ),
);
foreach ( $widgets as $id => $name ) {
register_sidebar(
apply_filters(
'kadence_widget_area_args',
array(
'name' => $name,
'id' => $id,
'description' => esc_html__( 'Add widgets here.', 'kadence' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
)
);
}
}
/**
* Registers the sidebars.
*
* @param array $defaults the default args.
*/
public function change_sidebar_default_args( $defaults ) {
$args = apply_filters(
'kadence_widget_area_args',
array(
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
$args = wp_parse_args( $args, $defaults );
return $args;
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'get_layout' => array( $this, 'get_layout' ),
'get_boxed' => array( $this, 'get_boxed' ),
'get_title_layout' => array( $this, 'get_title_layout' ),
'show_hero_title' => array( $this, 'show_hero_title' ),
'show_in_content_title' => array( $this, 'show_in_content_title' ),
'get_feature' => array( $this, 'get_feature' ),
'show_feature' => array( $this, 'show_feature' ),
'show_feature_above' => array( $this, 'show_feature_above' ),
'show_feature_below' => array( $this, 'show_feature_below' ),
'get_feature_position' => array( $this, 'get_feature_position' ),
'show_comments' => array( $this, 'show_comments' ),
'show_post_navigation' => array( $this, 'show_post_navigation' ),
'has_sidebar' => array( $this, 'has_sidebar' ),
'sidebar_id' => array( $this, 'sidebar_id' ),
'sidebar_side' => array( $this, 'sidebar_side' ),
'sidebar_id_class' => array( $this, 'sidebar_id_class' ),
'display_sidebar' => array( $this, 'display_sidebar' ),
'desk_transparent_header' => array( $this, 'desk_transparent_header' ),
'mobile_transparent_header' => array( $this, 'mobile_transparent_header' ),
'has_header' => array( $this, 'has_header' ),
'has_header_styles' => array( $this, 'has_header_styles' ),
'has_footer' => array( $this, 'has_footer' ),
'has_content' => array( $this, 'has_content' ),
);
}
/**
* Displays the sidebar.
*/
public function display_sidebar() {
ob_start();
dynamic_sidebar( self::sidebar_id() );
echo apply_filters( 'kadence_dynamic_sidebar_content', ob_get_clean() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Checks if page should show in hero title.
*
* @return bool true or false.
*/
public static function show_hero_title() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'above' === self::$layout['title'] ? true : false );
}
/**
* Checks if page should show in content title.
*
* @return bool true or false.
*/
public static function show_in_content_title() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'normal' === self::$layout['title'] ? true : false );
}
/**
* Checks if header is here or incontent
*
* @return string normal or above
*/
public static function has_content() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['content'] ? false : true );
}
/**
* Checks if header is here or incontent
*
* @return string normal or above
*/
public static function has_header() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['header'] ? false : true );
}
/**
* Checks if header is here or incontent
*
* @return string normal or above
*/
public static function has_header_styles() {
if ( kadence()->option( 'blocks_header' ) ) {
return false;
}
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['header'] ? false : true );
}
/**
* Checks if footer is here or incontent
*
* @return string normal or above
*/
public static function has_footer() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['footer'] ? false : true );
}
/**
* Checks if page title is here or incontent
*
* @return string normal or above
*/
public static function get_title_layout() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['title'];
}
/**
* Checks if page should have desktop transparent header.
*
* @return bool true or false.
*/
public static function desk_transparent_header() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'enable' === self::$layout['transparent'] && kadence()->sub_option( 'transparent_header_device', 'desktop' ) ? true : false );
}
/**
* Checks if page should have desktop transparent header.
*
* @return bool true or false.
*/
public static function get_desk_transparent_class() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'enable' === self::$layout['transparent'] && kadence()->sub_option( 'transparent_header_device', 'desktop' ) ? 'transparent-header' : 'non-transparent-header' );
}
/**
* Checks if page should have mobile transparent header.
*
* @return bool true or false.
*/
public static function get_mobile_transparent_class() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'enable' === self::$layout['transparent'] && kadence()->sub_option( 'transparent_header_device', 'mobile' ) ? 'mobile-transparent-header' : 'mobile-non-transparent-header' );
}
/**
* Checks if page should have mobile transparent header.
*
* @return bool true or false.
*/
public static function mobile_transparent_header() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'enable' === self::$layout['transparent'] && kadence()->sub_option( 'transparent_header_device', 'mobile' ) ? true : false );
}
/**
* Checks if page should show comments.
*
* @return bool true or false.
*/
public static function show_post_navigation() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'show' === self::$layout['navigation'] ? true : false );
}
/**
* Checks if page should show comments.
*
* @return bool true or false.
*/
public static function show_comments() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( post_type_supports( get_post_type(), 'comments' ) && ( comments_open() || get_comments_number() ) && 'show' === self::$layout['comments'] ? true : false );
}
/**
* Checks if page has a sidebar.
*
* @return boolean True will display the sidebar, False will not
*/
public static function has_sidebar() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'enable' === self::$layout['sidebar'] ? true : false );
}
/**
* Checks if page is hiding the footer
*
* @return boolean True will hide the footer, False will not
*/
public static function no_footer() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['footer'] ? true : false );
}
/**
* Checks if page is hiding the header
*
* @return boolean True will hide the header, False will not
*/
public static function no_header() {
if ( kadence()->option( 'blocks_header' ) ) {
return true;
}
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'disable' === self::$layout['header'] ? true : false );
}
/**
* Checks which sidebar to show if showing.
*
* @return string the sidebar ID to call.
*/
public static function sidebar_id() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['sidebar_id'];
}
/**
* Checks which sidebar to show if showing.
*
* @return string the sidebar ID to call.
*/
public static function sidebar_id_class() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return 'sidebar-slug-' . self::$layout['sidebar_id'];
}
/**
* Checks if page has a sidebar.
*
* @return string left will display the sidebar on the left, right will display sidebar on the right.
*/
public static function sidebar_side() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['side'];
}
/**
* Checks if page has a featured image.
*
* @return bool true or false.
*/
public static function show_feature() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( 'show' === self::$layout['feature'] ? true : false );
}
/**
* Checks if page has a featured image.
*
* @return bool true or false.
*/
public static function show_feature_above() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( self::show_feature() && ( 'above' === self::$layout['feature_position'] || 'behind' === self::$layout['feature_position'] ) ? true : false );
}
/**
* Checks if page has a featured image.
*
* @return bool true or false.
*/
public static function show_feature_below() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return ( self::show_feature() && ( 'below' === self::$layout['feature_position'] ) ? true : false );
}
/**
* Get the feature position.
*
* @return bool true or false.
*/
public static function get_feature_position() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['feature_position'];
}
/**
* Checks if page has a featured image.
*
* @return string hide or show.
*/
public static function get_feature() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['feature'];
}
/**
* Checks if page is using boxed layout.
*
* @return string left will display the sidebar on the left, right will display sidebar on the right.
*/
public static function get_boxed() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['boxed'];
}
/**
* Checks if page has veritcal padding.
*
* @return string left will display the sidebar on the left, right will display sidebar on the right.
*/
public static function get_vertical_padding() {
if ( is_null( self::$layout ) ) {
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['vpadding'];
}
/**
* Checks if page has a sidebar.
*
* @return string left will display the sidebar on the left, right will display sidebar on the right.
*/
public static function get_layout() {
if ( is_null( self::$layout ) ) {
self::check_conditionals();
self::$layout = apply_filters( 'kadence_post_layout', self::check_conditionals() );
}
return self::$layout['layout'];
}
/**
* Checks conditionals to see what layout options are used to create this page.
*
* @return array of layout options.
*/
public static function check_conditionals() {
$boxed = 'boxed';
$layout = 'normal';
$feature = 'hide';
$f_position = 'above';
$comments = 'hide';
$navigation = 'hide';
$title = 'normal';
$sidebar = 'disable';
$sidebar_id = static::PRIMARY_SIDEBAR_SLUG;
$side = 'right';
$vpadding = 'show';
$header = 'enable';
$footer = 'enable';
$content = 'enable';
$transparent = ( kadence()->option( 'transparent_header_enable' ) ? 'enable' : 'disable' );
if ( ( is_singular() || is_front_page() ) && ! is_home() ) {
if ( is_front_page() ) {
$post_id = get_option( 'page_on_front' );
$post_type = 'page';
$trans_type = 'page';
} else {
$post_id = get_the_ID();
$post_type = get_post_type();
$trans_type = $post_type;
}
$postlayout = get_post_meta( $post_id, '_kad_post_layout', true );
$postsidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$postboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$postfeature = get_post_meta( $post_id, '_kad_post_feature', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$posttitle = get_post_meta( $post_id, '_kad_post_title', true );
$posttrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$postvpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postheader = get_post_meta( $post_id, '_kad_post_header', true );
$postfooter = get_post_meta( $post_id, '_kad_post_footer', true );
// header.
if ( isset( $postheader ) && true == $postheader ) {
$header = 'disable';
}
// Footer.
if ( isset( $postfooter ) && true == $postfooter ) {
$footer = 'disable';
}
// Sidebar ID.
if ( isset( $postsidebar ) && ! empty( $postsidebar ) && 'defualt' !== $postsidebar && 'default' !== $postsidebar ) {
$sidebar_id = $postsidebar;
} else {
$sidebar_id = kadence()->option( $post_type . '_sidebar_id', $sidebar_id );
}
// Transparent.
if ( isset( $posttrans ) && ( 'enable' === $posttrans || 'disable' === $posttrans ) ) {
$transparent = $posttrans;
} else {
$option_trans = kadence()->option( 'transparent_header_' . $trans_type, null );
if ( true === $option_trans ) {
$transparent = 'disable';
} else if ( is_null( $option_trans ) ) {
$transparent = 'disable';
}
}
// Title.
if ( isset( $posttitle ) && ( 'above' === $posttitle || 'normal' === $posttitle || 'hide' === $posttitle ) ) {
$title = $posttitle;
} elseif ( isset( $posttitle ) && 'show' === $posttitle ) {
$option_title_layout = kadence()->option( $post_type . '_title_layout' );
if ( 'above' === $option_title_layout || 'normal' === $option_title_layout ) {
$title = $option_title_layout;
}
} else {
$option_title = kadence()->option( $post_type . '_title' );
if ( false === $option_title ) {
$title = 'hide';
} else {
$option_title_layout = kadence()->option( $post_type . '_title_layout' );
if ( 'above' === $option_title_layout || 'normal' === $option_title_layout ) {
$title = $option_title_layout;
}
}
}
// Post Vertical Padding.
if ( isset( $postvpadding ) && ( 'show' === $postvpadding || 'hide' === $postvpadding || 'top' === $postvpadding || 'bottom' === $postvpadding ) ) {
$vpadding = $postvpadding;
} else {
$option_vpadding = kadence()->option( $post_type . '_vertical_padding' );
if ( 'show' === $option_vpadding || 'hide' === $option_vpadding || 'top' === $option_vpadding || 'bottom' === $option_vpadding ) {
$vpadding = $option_vpadding;
}
}
// Post Navigation.
if ( 'post' === $post_type ) {
$option_navigation = kadence()->option( $post_type . '_navigation' );
if ( $option_navigation ) {
$navigation = 'show';
}
}
// Post Comments.
$option_comments = kadence()->option( $post_type . '_comments' );
if ( $option_comments ) {
$comments = 'show';
}
if ( 'product' === $post_type ) {
$comments = 'show';
}
// Post Boxed.
if ( isset( $postboxed ) && ( 'unboxed' === $postboxed || 'boxed' === $postboxed ) ) {
$boxed = $postboxed;
} else {
$option_boxed = kadence()->option( $post_type . '_content_style' );
if ( 'unboxed' === $option_boxed || 'boxed' === $option_boxed ) {
$boxed = $option_boxed;
}
}
// Post Feature.
if ( isset( $postfeature ) && ( 'show' === $postfeature || 'hide' === $postfeature ) ) {
$feature = $postfeature;
} else {
$option_feature = kadence()->option( $post_type . '_feature' );
if ( $option_feature ) {
$feature = 'show';
}
}
// Post Feature position.
if ( isset( $postf_position ) && ( 'above' === $postf_position || 'behind' === $postf_position || 'below' === $postf_position ) ) {
$f_position = $postf_position;
} else {
$option_f_position = kadence()->option( $post_type . '_feature_position' );
if ( 'above' === $option_f_position || 'behind' === $option_f_position || 'below' === $option_f_position ) {
$f_position = $option_f_position;
}
}
// Post Layout.
if ( isset( $postlayout ) && ( 'narrow' === $postlayout || 'fullwidth' === $postlayout ) ) {
$layout = $postlayout;
} elseif ( ( isset( $postlayout ) && 'default' === $postlayout ) || empty( $postlayout ) ) {
$option_layout = kadence()->option( $post_type . '_layout' );
if ( 'narrow' === $option_layout || 'fullwidth' === $option_layout ) {
$layout = $option_layout;
}
}
// Post Sidebar.
if ( isset( $postlayout ) && ( 'left' === $postlayout || 'right' === $postlayout ) ) {
$side = $postlayout;
$sidebar = 'enable';
$layout = $postlayout;
} elseif ( ( isset( $postlayout ) && 'default' === $postlayout ) || empty( $postlayout ) ) {
$option_layout = kadence()->option( $post_type . '_layout' );
if ( 'left' === $option_layout || 'right' === $option_layout ) {
$side = $option_layout;
$sidebar = 'enable';
}
}
} elseif ( is_archive() || is_search() || is_home() || is_404() ) {
if ( is_home() && is_front_page() ) {
$archive_type = 'post_archive';
$trans_type = 'archive';
} elseif ( is_home() && ! is_front_page() ) {
if ( get_query_var( 'tribe_events_front_page' ) ) {
$archive_type = 'tribe_events_archive';
$trans_type = 'archive';
$tribe_option_trans = kadence()->option( 'transparent_header_tribe_events_archive', true );
if ( true === $tribe_option_trans ) {
$temp_transparent = 'disable';
} else {
$temp_transparent = 'enable';
}
$archivetrans = apply_filters( 'kadence_tribe_events_archive_transparent', $temp_transparent );
} else {
$post_id = get_option( 'page_for_posts' );
$archivelayout = get_post_meta( $post_id, '_kad_post_layout', true );
$archiveboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$archivesidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$archivefeature = get_post_meta( $post_id, '_kad_post_feature', true );
$archivetitle = get_post_meta( $post_id, '_kad_post_title', true );
$archivetrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$archivevpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$archive_type = 'post_archive';
$trans_type = 'archive';
}
} elseif ( class_exists( 'woocommerce' ) && is_shop() && ! is_search() ) {
$post_id = wc_get_page_id( 'shop' );
$archivelayout = get_post_meta( $post_id, '_kad_post_layout', true );
$archiveboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$archivesidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$archivefeature = get_post_meta( $post_id, '_kad_post_feature', true );
$archivetitle = get_post_meta( $post_id, '_kad_post_title', true );
$archivetrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$archivevpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$archive_type = 'product_archive';
$trans_type = 'archive';
} elseif ( class_exists( 'woocommerce' ) && ( is_product_category() || is_product_tag() || is_tax( 'product_brands' ) || ( is_shop() && is_search() ) ) ) {
$archive_type = 'product_archive';
$trans_type = 'archive';
} elseif ( function_exists( 'geodir_is_page' ) && ( geodir_is_page( 'post_type' ) || geodir_is_page( 'archive' ) || geodir_is_page( 'search' ) ) ) {
$post_type = geodir_get_current_posttype();
$post_id = (int) \GeoDir_Compatibility::gd_page_id();
$archivelayout = get_post_meta( $post_id, '_kad_post_layout', true );
$archiveboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$archivesidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$archivefeature = get_post_meta( $post_id, '_kad_post_feature', true );
$archivetitle = get_post_meta( $post_id, '_kad_post_title', true );
$archivetrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$archivevpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$archive_type = $post_type . '_archive';
$trans_type = 'archive';
} elseif ( is_post_type_archive( 'llms_membership' ) && function_exists( 'llms_get_page_id' ) ) {
$post_id = llms_get_page_id( 'memberships' );
$archivelayout = get_post_meta( $post_id, '_kad_post_layout', true );
$archiveboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$archivesidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$archivefeature = get_post_meta( $post_id, '_kad_post_feature', true );
$archivetitle = get_post_meta( $post_id, '_kad_post_title', true );
$archivetrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$archivevpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$archive_type = 'llms_membership_archive';
$trans_type = 'archive';
} elseif ( is_tax( 'membership_cat' ) || is_tax( 'membership_tag' ) ) {
$archive_type = 'llms_membership_archive';
$trans_type = 'archive';
} elseif ( is_post_type_archive( 'course' ) && function_exists( 'llms_get_page_id' ) ) {
$post_id = llms_get_page_id( 'courses' );
$archivelayout = get_post_meta( $post_id, '_kad_post_layout', true );
$archiveboxed = get_post_meta( $post_id, '_kad_post_content_style', true );
$archivesidebar = get_post_meta( $post_id, '_kad_post_sidebar_id', true );
$archivefeature = get_post_meta( $post_id, '_kad_post_feature', true );
$archivetitle = get_post_meta( $post_id, '_kad_post_title', true );
$archivetrans = get_post_meta( $post_id, '_kad_post_transparent', true );
$archivevpadding = get_post_meta( $post_id, '_kad_post_vertical_padding', true );
$postf_position = get_post_meta( $post_id, '_kad_post_feature_position', true );
$archive_type = 'course_archive';
$trans_type = 'archive';
} elseif ( is_tax( 'course_cat' ) || is_tax( 'course_tag' ) || is_tax( 'course_track' ) ) {
$archive_type = 'course_archive';
$trans_type = 'archive';
} elseif ( is_post_type_archive( 'tribe_events' ) ) {
$archive_type = 'tribe_events_archive';
$trans_type = 'archive';
$tribe_option_trans = kadence()->option( 'transparent_header_tribe_events_archive', true );
if ( true === $tribe_option_trans ) {
$temp_transparent = 'disable';
} else {
$temp_transparent = 'enable';
}
$archivetrans = apply_filters( 'kadence_tribe_events_archive_transparent', $temp_transparent );
} elseif ( is_tax( 'portfolio-type' ) || is_tax( 'portfolio-tag' ) ) {
$archive_type = 'portfolio_archive';
$trans_type = 'archive';
} elseif ( is_tax( 'staff-group' ) ) {
$archive_type = 'staff_archive';
$trans_type = 'archive';
} elseif ( is_tax( 'testimonial-group' ) ) {
$archive_type = 'testimonial_archive';
$trans_type = 'archive';
} elseif ( ( is_tax( 'ht_kb_category' ) || is_tax( 'ht_kb_tag' ) || is_post_type_archive( 'ht_kb' ) || ( is_search() && array_key_exists( 'ht-kb-search', $_REQUEST ) ) ) ) {
$archive_type = 'ht_kb_archive';
$trans_type = 'archive';
} elseif ( is_search() ) {
$archive_type = 'search_archive';
$trans_type = 'archive';
} elseif ( is_404() ) {
$archive_type = '404';
$trans_type = 'archive';
} elseif ( is_category() || is_tag() ) {
$archive_type = 'post_archive';
$trans_type = 'archive';
} elseif ( is_tax( 'knowledgebase_cat' ) ) {
$archive_type = 'knowledgebase_archive';
$trans_type = 'archive';
} else {
$post_type = get_post_type();
$archive_type = $post_type . '_archive';
$trans_type = 'archive';
}
// Sidebar ID.
if ( isset( $archivesidebar ) && ! empty( $archivesidebar ) && 'default' !== $archivesidebar && 'defualt' !== $archivesidebar ) {
$sidebar_id = $archivesidebar;
} else {
$sidebar_id = kadence()->option( $archive_type . '_sidebar_id', $sidebar_id );
}
// Archive Transparent.
if ( isset( $archivetrans ) && ( 'enable' === $archivetrans || 'disable' === $archivetrans ) ) {
$transparent = $archivetrans;
} else {
$option_trans = kadence()->option( 'transparent_header_' . $trans_type );
if ( true === $option_trans ) {
$transparent = 'disable';
}
}
// Archive Title.
if ( isset( $archivetitle ) && ( 'above' === $archivetitle || 'normal' === $archivetitle || 'hide' === $archivetitle ) ) {
$title = $archivetitle;
} else {
$option_title = kadence()->option( $archive_type . '_title' );
if ( false === $option_title ) {
$title = 'hide';
} else {
$option_title_layout = kadence()->option( $archive_type . '_title_layout' );
if ( empty( $option_title_layout ) ) {
$option_title_layout = kadence()->option( 'post_archive_title_layout' );
}
if ( 'above' === $option_title_layout || 'normal' === $option_title_layout ) {
$title = $option_title_layout;
}
}
}
if ( is_home() && is_front_page() ) {
if ( ! kadence()->option( 'post_archive_home_title' ) ) {
$title = 'hide';
}
}
if ( is_404() ) {
$title = 'normal';
$transparent = 'disable';
}
// Archive Feature.
if ( isset( $archivefeature ) && ( 'show' === $archivefeature || 'hide' === $archivefeature ) ) {
$feature = $archivefeature;
}
// Post Feature position.
if ( isset( $postf_position ) && ( 'above' === $postf_position || 'behind' === $postf_position || 'below' === $postf_position ) ) {
$f_position = $postf_position;
}
// Archive Boxed.
if ( isset( $archiveboxed ) && ( 'unboxed' === $archiveboxed || 'boxed' === $archiveboxed ) ) {
$boxed = $archiveboxed;
} else {
$option_boxed = kadence()->option( $archive_type . '_content_style' );
if ( empty( $option_boxed ) ) {
$option_boxed = kadence()->option( 'post_archive_content_style' );
}
if ( 'unboxed' === $option_boxed || 'boxed' === $option_boxed ) {
$boxed = $option_boxed;
}
}
// Archive Vertical Padding.
if ( isset( $archivevpadding ) && ( 'show' === $archivevpadding || 'hide' === $archivevpadding || 'top' === $archivevpadding || 'bottom' === $archivevpadding ) ) {
$vpadding = $archivevpadding;
} else {
$option_vpadding = kadence()->option( $archive_type . '_vertical_padding' );
if ( $option_vpadding && ( 'show' === $option_vpadding || 'hide' === $option_vpadding || 'top' === $option_vpadding || 'bottom' === $option_vpadding ) ) {
$vpadding = $option_vpadding;
}
}
// Archive Layout.
if ( isset( $archivelayout ) && ( 'narrow' === $archivelayout || 'fullwidth' === $archivelayout ) ) {
$layout = $archivelayout;
} elseif ( ( isset( $archivelayout ) && 'default' === $archivelayout ) || empty( $archivelayout ) ) {
$option_layout = kadence()->option( $archive_type . '_layout' );
if ( empty( $option_layout ) ) {
$option_layout = kadence()->option( 'post_archive_layout' );
}
if ( 'narrow' === $option_layout || 'fullwidth' === $option_layout ) {
$layout = $option_layout;
}
}
// Archive Sidebar.
if ( isset( $archivelayout ) && ( 'left' === $archivelayout || 'right' === $archivelayout ) ) {
$side = $archivelayout;
$sidebar = 'enable';
} elseif ( ( isset( $archivelayout ) && 'default' === $archivelayout ) || empty( $archivelayout ) ) {
$option_layout = kadence()->option( $archive_type . '_layout' );
if ( empty( $option_layout ) ) {
$option_layout = kadence()->option( 'post_archive_layout' );
}
if ( 'left' === $option_layout || 'right' === $option_layout ) {
$side = $option_layout;
$sidebar = 'enable';
}
}
}
$return_array = array(
'layout' => $layout,
'boxed' => $boxed,
'feature' => $feature,
'feature_position' => $f_position,
'comments' => $comments,
'navigation' => $navigation,
'title' => $title,
'transparent' => $transparent,
'side' => $side,
'sidebar' => $sidebar,
'vpadding' => $vpadding,
'sidebar_id' => $sidebar_id,
'footer' => $footer,
'header' => $header,
'content' => $content,
);
return $return_array;
}
/**
* Adds custom classes to indicate whether a sidebar is present to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function filter_body_classes( array $classes ) : array {
if ( self::no_header() ) {
$classes[] = 'no-header';
}
if ( self::no_footer() ) {
$classes[] = 'no-footer';
}
if ( self::has_sidebar() ) {
$classes[] = 'has-sidebar';
if ( 'left' === self::sidebar_side() ) {
$classes[] = 'has-left-sidebar';
}
if ( kadence()->option( 'sidebar_sticky' ) ) {
if ( kadence()->option( 'sidebar_sticky_last_widget' ) ) {
$classes[] = 'has-sticky-sidebar-widget';
} else {
$classes[] = 'has-sticky-sidebar';
}
}
}
$post_classname = get_post_meta( get_the_ID(), '_kad_post_classname', true );
if ( isset( $post_classname ) && ! empty( $post_classname ) ) {
$classes[] = $post_classname;
}
$classes[] = 'content-title-style-' . esc_attr( self::get_title_layout() );
$classes[] = 'content-width-' . esc_attr( self::get_layout() );
$classes[] = 'content-style-' . esc_attr( self::get_boxed() );
$classes[] = 'content-vertical-padding-' . esc_attr( self::get_vertical_padding() );
$classes[] = esc_attr( self::get_desk_transparent_class() );
$classes[] = esc_attr( self::get_mobile_transparent_class() );
return $classes;
}
}

View File

@@ -0,0 +1,960 @@
<?php
/**
* Kadence\LearnDash\Component class
*
* @package kadence
*/
namespace Kadence\LearnDash;
use Kadence\Component_Interface;
use Kadence\Kadence_CSS;
use Kadence_Blocks_Frontend;
use LearnDash_Settings_Section;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
/**
* Class for adding LearnDash plugin support.
*/
class Component implements Component_Interface {
/**
* Associative array of Google Fonts to load.
*
* Do not access this property directly, instead use the `get_google_fonts()` method.
*
* @var array
*/
protected static $google_fonts = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'learndash';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'learndash_styles' ), 60 );
add_filter( 'learndash_wrapper_class', array( $this, 'learndash_lesson_class' ), 10, 2 );
add_filter( 'learndash_course_grid_template', array( $this, 'learndash_course_grid_template' ), 10 );
add_filter( 'ld_course_list', array( $this, 'learndash_course_grid_class' ), 10, 3 );
add_action( 'after_setup_theme', array( $this, 'action_add_editor_styles' ) );
add_filter( 'kadence_dynamic_css', array( $this, 'dynamic_css' ), 20 );
add_action( 'wp_head', array( $this, 'frontend_gfonts' ), 80 );
}
/**
* Filters HTML output of course list.
*
* @since 2.1.0
*
* @param string $output HTML output of category dropdown.
* @param array $atts Shortcode attributes.
* @param array $filter Arguments to retrieve posts.
*/
public function learndash_course_grid_class( $output, $atts, $filter ) {
if ( defined( 'LEARNDASH_COURSE_GRID_VERSION' ) && version_compare( LEARNDASH_COURSE_GRID_VERSION, '2.0.0', '<' ) && kadence()->option( 'learndash_course_grid' ) ) {
// Return if not a grid.
if ( $atts['course_grid'] == 'false' ||
$atts['course_grid'] === false ||
empty( $atts['course_grid'] ) ) {
return $output;
}
$col = empty( $atts['col'] ) ? LEARNDASH_COURSE_GRID_COLUMNS : intval( $atts['col'] );
$col = $col > 6 ? 6 : $col;
$smcol = $col == 1 ? 1 : ceil( $col / 2 );
$output = str_replace( 'ld-course-list-items row', 'ld-course-list-items content-wrap grid-sm-col-' . $smcol . ' grid-lg-col-' . $col . ' grid-cols', $output );
}
return $output;
}
/**
* Enqueue Frontend Fonts
*/
public function frontend_gfonts() {
if ( empty( self::$google_fonts ) ) {
return;
}
if ( class_exists( 'Kadence_Blocks_Frontend' ) ) {
$ktblocks_instance = Kadence_Blocks_Frontend::get_instance();
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $ktblocks_instance::$gfonts ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$ktblocks_instance::$gfonts[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $ktblocks_instance::$gfonts[ $key ]['fontvariants'], true ) ) {
array_push( $ktblocks_instance::$gfonts[ $key ]['fontvariants'], $variant );
}
}
}
}
} else {
add_filter( 'kadence_theme_google_fonts_array', array( $this, 'filter_in_fonts' ) );
}
}
/**
* Filters in pro fronts for output with free.
*
* @param array $font_array any custom css.
* @return array
*/
public function filter_in_fonts( $font_array ) {
// Enqueue Google Fonts.
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $font_array ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$font_array[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $font_array[ $key ]['fontvariants'], true ) ) {
array_push( $font_array[ $key ]['fontvariants'], $variant );
}
}
}
}
return $font_array;
}
/**
* Enqueues WordPress theme styles for the editor.
*/
public function action_add_editor_styles() {
// Enqueue block editor stylesheet.
add_editor_style( 'assets/css/editor/learndash-editor-styles.min.css' );
}
/**
* Override grid template file.
*
* @param string $template the template to load.
*/
public function learndash_course_grid_template( $template ) {
if ( defined( 'LEARNDASH_COURSE_GRID_VERSION' ) && version_compare( LEARNDASH_COURSE_GRID_VERSION, '2.0.0', '<' ) && kadence()->option( 'learndash_course_grid' ) ) {
$template = get_template_directory() . '/inc/components/learndash/course_list_template.php';
}
return $template;
}
/**
* Add some css styles for learndash
*
* @param string $class the class for the wrapper.
* @param object $post the post object.
*/
public function learndash_lesson_class( $class, $post ) {
if ( is_object( $post ) && 'sfwd-lessons' === $post->post_type ) {
$class = $class . ' entry-content';
}
return $class;
}
/**
* Add some css styles for learndash
*/
public function learndash_styles() {
wp_enqueue_style( 'kadence-learndash', get_theme_file_uri( '/assets/css/learndash.min.css' ), array(), KADENCE_VERSION );
if ( class_exists( 'LearnDash_Settings_Section' ) && apply_filters( 'kadence_learndash_colors', true ) && ! defined( 'LDX_DESIGN_UPGRADE_PRO_LEARNDASH_VERSION' ) ) {
$colors = array(
'primary' => \LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'color_primary' ),
'secondary' => \LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'color_secondary' ),
);
if ( ( isset( $colors['primary'] ) && empty( $colors['primary'] ) ) || apply_filters( 'kadence_override_learndash_colors', false ) ) {
ob_start();
?>
.ld-course-list-items .ld_course_grid .thumbnail.course .ld_course_grid_price.ribbon-enrolled {
background: var(--global-palette-btn-bg-hover);
}
.ld-course-list-items .ld_course_grid .thumbnail.course .ld_course_grid_price.ribbon-enrolled:before {
border-top-color: var(--global-palette-btn-bg);
border-right-color: var(--global-palette-btn-bg);
}
.ld-course-list-items .ld_course_grid .btn-primary {
border-color: var(--global-palette-btn-bg);
background: var(--global-palette-btn-bg);
color: var(--global-palette-btn);
box-shadow: 0px 0px 0px -7px rgba(0,0,0,0.0);
}
.ld-course-list-items .ld_course_grid .btn-primary:hover {
color: var(--global-palette-btn-hover);
border-color: var(--global-palette-btn-bg-hover);
background: var(--global-palette-btn-bg-hover);
box-shadow: 0px 15px 25px -7px rgba(0,0,0,0.1);
}
.learndash-wrapper .ld-item-list .ld-item-list-item.ld-is-next,
.learndash-wrapper .wpProQuiz_content .wpProQuiz_questionListItem label:focus-within {
border-color: var(--global-palette1);
}
/*
.learndash-wrapper a:not(.ld-button):not(#quiz_continue_link):not(.ld-focus-menu-link):not(.btn-blue):not(#quiz_continue_link):not(.ld-js-register-account):not(#ld-focus-mode-course-heading):not(#btn-join):not(.ld-item-name):not(.ld-table-list-item-preview):not(.ld-lesson-item-preview-heading),
*/
.learndash-wrapper .ld-breadcrumbs a,
.learndash-wrapper .ld-lesson-item.ld-is-current-lesson .ld-lesson-item-preview-heading,
.learndash-wrapper .ld-lesson-item.ld-is-current-lesson .ld-lesson-title,
.learndash-wrapper .ld-primary-color-hover:hover,
.learndash-wrapper .ld-primary-color,
.learndash-wrapper .ld-primary-color-hover:hover,
.learndash-wrapper .ld-primary-color,
.learndash-wrapper .ld-tabs .ld-tabs-navigation .ld-tab.ld-active,
.learndash-wrapper .ld-button.ld-button-transparent,
.learndash-wrapper .ld-button.ld-button-reverse,
.learndash-wrapper .ld-icon-certificate,
.learndash-wrapper .ld-login-modal .ld-login-modal-login .ld-modal-heading,
#wpProQuiz_user_content a,
.learndash-wrapper .ld-item-list .ld-item-list-item a.ld-item-name:hover,
.learndash-wrapper .ld-focus-comments__heading-actions .ld-expand-button,
.learndash-wrapper .ld-focus-comments__heading a,
.learndash-wrapper .ld-focus-comments .comment-respond a,
.learndash-wrapper .ld-focus-comment .ld-comment-reply a.comment-reply-link:hover,
.learndash-wrapper .ld-expand-button.ld-button-alternate {
color: var(--global-palette1) !important;
}
.learndash-wrapper .ld-focus-comment.bypostauthor>.ld-comment-wrapper,
.learndash-wrapper .ld-focus-comment.role-group_leader>.ld-comment-wrapper,
.learndash-wrapper .ld-focus-comment.role-administrator>.ld-comment-wrapper {
background-color: <?php echo esc_attr( $this->learndash_hex2rgb( kadence()->palette_option( 'palette1' ), '0.03' ) ); ?> !important;
}
.learndash-wrapper .ld-primary-background,
.learndash-wrapper .ld-tabs .ld-tabs-navigation .ld-tab.ld-active:after {
background: var(--global-palette1) !important;
}
.learndash-wrapper .ld-course-navigation .ld-lesson-item.ld-is-current-lesson .ld-status-incomplete,
.learndash-wrapper .ld-focus-comment.bypostauthor:not(.ptype-sfwd-assignment) >.ld-comment-wrapper>.ld-comment-avatar img,
.learndash-wrapper .ld-focus-comment.role-group_leader>.ld-comment-wrapper>.ld-comment-avatar img,
.learndash-wrapper .ld-focus-comment.role-administrator>.ld-comment-wrapper>.ld-comment-avatar img {
border-color: var(--global-palette1) !important;
}
.learndash-wrapper .ld-loading::before {
border-top:3px solid var(--global-palette1) !important;
}
.learndash-wrapper .ld-button:hover:not(.learndash-link-previous-incomplete):not(.ld-button-transparent),
#learndash-tooltips .ld-tooltip:after,
#learndash-tooltips .ld-tooltip,
.learndash-wrapper .ld-primary-background,
.learndash-wrapper .btn-join,
.learndash-wrapper #btn-join,
.learndash-wrapper .ld-button:not(.ld-js-register-account):not(.learndash-link-previous-incomplete):not(.ld-button-transparent),
.learndash-wrapper .ld-expand-button,
.learndash-wrapper .wpProQuiz_content .wpProQuiz_button:not(.wpProQuiz_button_reShowQuestion):not(.wpProQuiz_button_restartQuiz),
.learndash-wrapper .wpProQuiz_content .wpProQuiz_button2,
.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-course-navigation-heading,
.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-focus-sidebar-trigger,
.learndash-wrapper .ld-focus-comments .form-submit #submit,
.learndash-wrapper .ld-login-modal input[type='submit'],
.learndash-wrapper .ld-login-modal .ld-login-modal-register,
.learndash-wrapper .wpProQuiz_content .wpProQuiz_certificate a.btn-blue,
.learndash-wrapper .ld-focus .ld-focus-header .ld-user-menu .ld-user-menu-items a,
#wpProQuiz_user_content table.wp-list-table thead th,
#wpProQuiz_overlay_close,
.learndash-wrapper .ld-expand-button.ld-button-alternate .ld-icon {
background-color: var(--global-palette1) !important;
}
.learndash-wrapper .ld-focus .ld-focus-header .ld-user-menu .ld-user-menu-items:before {
border-bottom-color: var(--global-palette1) !important;
}
.learndash-wrapper .ld-button.ld-button-transparent:hover {
background: transparent !important;
}
.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete .learndash_mark_complete_button,
.learndash-wrapper .ld-focus .ld-focus-header #sfwd-mark-complete #learndash_mark_complete_button,
.learndash-wrapper .ld-button.ld-button-transparent,
.learndash-wrapper .ld-button.ld-button-alternate,
.learndash-wrapper .ld-expand-button.ld-button-alternate {
background-color:transparent !important;
}
.learndash-wrapper .ld-focus-header .ld-user-menu .ld-user-menu-items a,
.learndash-wrapper .ld-button.ld-button-reverse:hover,
.learndash-wrapper .ld-alert-success .ld-alert-icon.ld-icon-certificate,
.learndash-wrapper .ld-alert-warning .ld-button:not(.learndash-link-previous-incomplete),
.learndash-wrapper .ld-primary-background.ld-status {
color:white !important;
}
.learndash-wrapper .ld-status.ld-status-unlocked {
background-color: <?php echo esc_attr( $this->learndash_hex2rgb( kadence()->palette_option( 'palette1' ), '0.2' ) ); ?> !important;
color: var(--global-palette1) !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_addToplist {
background-color: <?php echo esc_attr( $this->learndash_hex2rgb( kadence()->palette_option( 'palette1' ), '0.1' ) ); ?> !important;
border: 1px solid var(--global-palette1) !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_toplistTable th {
background: var(--global-palette1) !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_toplistTrOdd {
background-color: <?php echo esc_attr( $this->learndash_hex2rgb( kadence()->palette_option( 'palette1' ), '0.1' ) ); ?> !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewDiv li.wpProQuiz_reviewQuestionTarget {
background-color: var(--global-palette1) !important;
}
<?php
if ( isset( $colors['secondary'] ) && empty( $colors['secondary'] ) ) {
?>
.learndash-wrapper #quiz_continue_link,
.learndash-wrapper .ld-secondary-background,
.learndash-wrapper .learndash_mark_complete_button,
.learndash-wrapper #learndash_mark_complete_button,
.learndash-wrapper .ld-status-complete,
.learndash-wrapper .ld-alert-success .ld-button,
.learndash-wrapper .ld-alert-success .ld-alert-icon {
background-color: var(--global-palette2) !important;
}
.learndash-wrapper .learndash_mark_complete_button:hover, .learndash-wrapper #learndash_mark_complete_button:hover {
background-color: var(--global-palette2) !important;
}
.learndash-wrapper .wpProQuiz_content a#quiz_continue_link {
background-color: var(--global-palette2) !important;
}
.learndash-wrapper .course_progress .sending_progress_bar {
background: var(--global-palette2) !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_button_reShowQuestion:hover, .learndash-wrapper .wpProQuiz_content .wpProQuiz_button_restartQuiz:hover {
background-color: var(--global-palette2) !important;
opacity: 0.75;
}
.learndash-wrapper .ld-secondary-color-hover:hover,
.learndash-wrapper .ld-secondary-color,
.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete .learndash_mark_complete_button,
.learndash-wrapper .ld-focus .ld-focus-header #sfwd-mark-complete #learndash_mark_complete_button,
.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete:after {
color: var(--global-palette2) !important;
}
.learndash-wrapper .ld-secondary-in-progress-icon {
border-left-color: var(--global-palette2) !important;
border-top-color: var(--global-palette2) !important;
}
.learndash-wrapper .ld-alert-success {
border-color: var(--global-palette2);
background-color: transparent !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewQuestion li.wpProQuiz_reviewQuestionSolved,
.learndash-wrapper .wpProQuiz_content .wpProQuiz_box li.wpProQuiz_reviewQuestionSolved {
background-color: var(--global-palette2) !important;
}
.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewLegend span.wpProQuiz_reviewColor_Answer {
background-color: var(--global-palette2) !important;
}
<?php
}
$custom_css = ob_get_clean();
if ( ! empty( $custom_css ) ) {
wp_add_inline_style( 'kadence-learndash', $custom_css );
}
}
}
}
/**
* Converts the hex color values to rgb.
*
* @param string $color Color value in hex format.
* @param float|int|boolean $opacity The opacity of color.
*
* @return string Color value in rgb format.
*/
public function learndash_hex2rgb( $color, $opacity = false ) {
$default = 'transparent';
// Return default if no color provided.
if ( empty( $color ) ) {
return $default;
}
// Sanitize $color if "#" is provided.
if ( '#' === $color[0] ) {
$color = substr( $color, 1 );
}
// Check if color has 6 or 3 characters and get values.
if ( strlen( $color ) == 6 ) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
// Convert hexadec to rgb.
$rgb = array_map( 'hexdec', $hex );
// Check if opacity is set(rgba or rgb).
if ( $opacity ) {
if ( abs( $opacity ) > 1 ) {
$opacity = 1.0;
}
$output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
} else {
$output = 'rgb(' . implode( ',', $rgb ) . ')';
}
// Return rgb(a) color string.
return $output;
}
/**
* Generates the dynamic css based on customizer options.
*
* @param string $css any custom css.
* @return string
*/
public function dynamic_css( $css ) {
$generated_css = $this->generate_ld_css();
if ( ! empty( $generated_css ) ) {
$css .= "\n/* Kadence LearnDash CSS */\n" . $generated_css;
}
return $css;
}
/**
* Generates the dynamic css based on page options.
*
* @return string
*/
public function generate_ld_css() {
$css = new Kadence_CSS();
$media_query = array();
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
// Learndash.
if ( class_exists( 'SFWD_LMS' ) ) {
// Course Archive Backgrounds.
$css->set_selector( 'body.post-type-archive-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_background', 'desktop' ), $css );
$css->set_selector( 'body.post-type-archive-sfwd-courses .content-bg, body.content-style-unboxed.archive.post-type-archive-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.post-type-archive-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_background', 'tablet' ), $css );
$css->set_selector( 'body.post-type-archive-sfwd-courses .content-bg, body.content-style-unboxed.archive.post-type-archive-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.post-type-archive-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_background', 'mobile' ), $css );
$css->set_selector( 'body.post-type-archive-sfwd-courses .content-bg, body.content-style-unboxed.archive.post-type-archive-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Course Archive Title.
$css->set_selector( '.sfwd-courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_archive_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-courses-archive-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-courses_archive_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_archive_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_archive_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_archive_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_archive_title_height' ), 'mobile' ) );
$css->stop_media_query();
$css->set_selector( '.wp-site-blocks .sfwd-courses-archive-title h1' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_archive_title_color', 'color' ) ) );
$css->set_selector( '.sfwd-courses-archive-title .kadence-breadcrumbs' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_archive_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-courses-archive-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_archive_title_breadcrumb_color', 'hover' ) ) );
$css->set_selector( '.sfwd-courses-archive-title .archive-description' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_archive_title_description_color', 'color' ) ) );
$css->set_selector( '.sfwd-courses-archive-title .archive-description a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_archive_title_description_color', 'hover' ) ) );
// Course Title.
$css->set_selector( '.sfwd-courses-title h1' );
$css->render_font( kadence()->option( 'sfwd-courses_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-courses-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-courses_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-courses_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-courses_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-courses-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-courses_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-courses_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-courses_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Course Title Breadcrumbs.
$css->set_selector( '.sfwd-courses-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-courses-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-courses_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-courses-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-courses-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-courses_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Course Title.
$css->set_selector( '.sfwd-courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-courses-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-courses_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-courses_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-courses_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Course Backgrounds.
$css->set_selector( 'body.single-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_background', 'desktop' ), $css );
$css->set_selector( 'body.single-sfwd-courses .content-bg, body.content-style-unboxed.single-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_background', 'tablet' ), $css );
$css->set_selector( 'body.single-sfwd-courses .content-bg, body.content-style-unboxed.single-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-sfwd-courses' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_background', 'mobile' ), $css );
$css->set_selector( 'body.single-sfwd-courses .content-bg, body.content-style-unboxed.single-sfwd-courses .site' );
$css->render_background( kadence()->sub_option( 'sfwd-courses_content_background', 'mobile' ), $css );
$css->stop_media_query();
if ( class_exists( 'LearnDash_Settings_Section' ) ) {
$in_focus_mode = \LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'focus_mode_enabled' );
if ( ! $in_focus_mode ) {
// Lesson Title.
$css->set_selector( '.sfwd-lessons-title h1' );
$css->render_font( kadence()->option( 'sfwd-lessons_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-lessons-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-lessons_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-lessons_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-lessons_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-lessons-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-lessons_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-lessons_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-lessons_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Lesson Title Breadcrumbs.
$css->set_selector( '.sfwd-lessons-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-lessons_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-lessons-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-lessons_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-lessons-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-lessons-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-lessons_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Lesson Title.
$css->set_selector( '.sfwd-lessons-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-lessons-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-lessons_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-lessons-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-lessons_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-lessons-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-lessons-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-lessons_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-lessons-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-lessons_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-lessons-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-lessons_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Lesson Backgrounds.
$css->set_selector( 'body.single-sfwd-lessons' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_background', 'desktop' ), $css );
$css->set_selector( 'body.single-sfwd-lessons .content-bg, body.content-style-unboxed.single-sfwd-lessons .site' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-sfwd-lessons' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_background', 'tablet' ), $css );
$css->set_selector( 'body.single-sfwd-lessons .content-bg, body.content-style-unboxed.single-sfwd-lessons .site' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-sfwd-lessons' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_background', 'mobile' ), $css );
$css->set_selector( 'body.single-sfwd-lessons .content-bg, body.content-style-unboxed.single-sfwd-lessons .site' );
$css->render_background( kadence()->sub_option( 'sfwd-lessons_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Quiz Title.
$css->set_selector( '.sfwd-quiz-title h1' );
$css->render_font( kadence()->option( 'sfwd-quiz_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-quiz-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-quiz_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-quiz_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-quiz_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-quiz-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-quiz_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-quiz_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-quiz_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Quiz Title Breadcrumbs.
$css->set_selector( '.sfwd-quiz-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-quiz_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-quiz-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-quiz_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-quiz-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-quiz-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-quiz_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Quiz Title.
$css->set_selector( '.sfwd-quiz-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-quiz-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-quiz_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-quiz-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-quiz_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-quiz-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-quiz-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-quiz_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-quiz-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-quiz_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-quiz-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-quiz_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Quiz Backgrounds.
$css->set_selector( 'body.single-sfwd-quiz' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_background', 'desktop' ), $css );
$css->set_selector( 'body.single-sfwd-quiz .content-bg, body.content-style-unboxed.single-sfwd-quiz .site' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-sfwd-quiz' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_background', 'tablet' ), $css );
$css->set_selector( 'body.single-sfwd-quiz .content-bg, body.content-style-unboxed.single-sfwd-quiz .site' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-sfwd-quiz' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_background', 'mobile' ), $css );
$css->set_selector( 'body.single-sfwd-quiz .content-bg, body.content-style-unboxed.single-sfwd-quiz .site' );
$css->render_background( kadence()->sub_option( 'sfwd-quiz_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Topic Title.
$css->set_selector( '.sfwd-topic-title h1' );
$css->render_font( kadence()->option( 'sfwd-topic_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-topic-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-topic_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-topic_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-topic_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-topic-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-topic_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-topic_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-topic_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Topic Title Breadcrumbs.
$css->set_selector( '.sfwd-topic-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-topic_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-topic-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-topic_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-topic-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-topic-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-topic_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Topic Title.
$css->set_selector( '.sfwd-topic-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-topic-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-topic_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-topic-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-topic_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-topic-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-topic-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-topic_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-topic-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-topic_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-topic-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-topic_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Topic Backgrounds.
$css->set_selector( 'body.single-sfwd-topic' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_background', 'desktop' ), $css );
$css->set_selector( 'body.single-sfwd-topic .content-bg, body.content-style-unboxed.single-sfwd-topic .site' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-sfwd-topic' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_background', 'tablet' ), $css );
$css->set_selector( 'body.single-sfwd-topic .content-bg, body.content-style-unboxed.single-sfwd-topic .site' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-sfwd-topic' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_background', 'mobile' ), $css );
$css->set_selector( 'body.single-sfwd-topic .content-bg, body.content-style-unboxed.single-sfwd-topic .site' );
$css->render_background( kadence()->sub_option( 'sfwd-topic_content_background', 'mobile' ), $css );
$css->stop_media_query();
}
}
// Group Title.
$css->set_selector( '.wp-site-blocks .groupe-title h1' );
$css->render_font( kadence()->option( 'groupe_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.wp-site-blocks .groupe-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'groupe_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'groupe_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'groupe_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.wp-site-blocks .groupe-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'groupe_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'groupe_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'groupe_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Essay Group Breadcrumbs.
$css->set_selector( '.groupe-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'groupe_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'groupe_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.groupe-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'groupe_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.groupe-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'groupe_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'groupe_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'groupe_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.groupe-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'groupe_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'groupe_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'groupe_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Group Title.
$css->set_selector( '.groupe-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'groupe_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'groupe_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'groupe_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.groupe-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'groupe_title_height' ), 'desktop' ) );
$css->set_selector( '.groupe-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'groupe_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.groupe-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'groupe_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'groupe_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'groupe_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.groupe-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'groupe_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.groupe-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'groupe_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'groupe_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'groupe_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.groupe-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'groupe_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Essay Title.
$css->set_selector( '.wp-site-blocks .sfwd-essays-title h1' );
$css->render_font( kadence()->option( 'sfwd-essays_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.wp-site-blocks .sfwd-essays-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-essays_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-essays_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-essays_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.wp-site-blocks .sfwd-essays-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-essays_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-essays_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-essays_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Essay Title Breadcrumbs.
$css->set_selector( '.sfwd-essays-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-essays_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.sfwd-essays-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'sfwd-essays_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-essays-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-essays-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-essays_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Essay Title.
$css->set_selector( '.sfwd-essays-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-essays_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.sfwd-essays-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-essays_title_height' ), 'desktop' ) );
$css->set_selector( '.sfwd-essays-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'sfwd-essays_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.sfwd-essays-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-essays_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.sfwd-essays-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-essays_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.sfwd-essays-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'sfwd-essays_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'sfwd-essays_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.sfwd-essays-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'sfwd-essays_title_height' ), 'mobile' ) );
$css->stop_media_query();
// LearnDash Grid Title.
$css->set_selector( '.ld-course-list-items .ld_course_grid.entry .course .entry-title' );
$css->render_font( kadence()->option( 'sfwd-grid_title_font' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.ld-course-list-items .ld_course_grid.entry .course .entry-title' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-grid_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-grid_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-grid_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.ld-course-list-items .ld_course_grid.entry .course .entry-title' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'sfwd-grid_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'sfwd-grid_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'sfwd-grid_title_font' ), 'mobile' ) );
$css->stop_media_query();
}
self::$google_fonts = $css->fonts_output();
return $css->css_output();
}
}

View File

@@ -0,0 +1,258 @@
<?php
/**
* This template overrides the learndash grid output for better support with the Kadence Theme.
*
* @package Kadence
*/
global $post;
$col = empty( $shortcode_atts['col'] ) ? LEARNDASH_COURSE_GRID_COLUMNS : intval( $shortcode_atts['col'] );
$col = $col > 6 ? 6 : $col;
$smcol = $col == 1 ? 1 : $col / 2;
$col = 12 / $col;
$smcol = intval( ceil( 12 / $smcol ) );
$col = is_float( $col ) ? number_format( $col, 1 ) : $col;
$col = str_replace( '.', '-', $col );
$boxed = Kadence\kadence()->option( 'learndash_course_grid_style' );
if ( 'unboxed' === $boxed || 'boxed' === $boxed ) {
$boxed_class = 'grid-loop-' . $boxed;
} else {
$boxed_class = 'grid-loop-unboxed';
}
$course_post_id = $post->ID;
$course_id = $course_post_id;
$user_id = get_current_user_id();
$cg_short_description = get_post_meta( $post->ID, '_learndash_course_grid_short_description', true );
$enable_video = get_post_meta( $post->ID, '_learndash_course_grid_enable_video_preview', true );
$embed_code = get_post_meta( $post->ID, '_learndash_course_grid_video_embed_code', true );
$button_text = get_post_meta( $post->ID, '_learndash_course_grid_custom_button_text', true );
if ( isset( $shortcode_atts['course_id'] ) ) {
$button_link = learndash_get_step_permalink( get_the_ID(), $shortcode_atts['course_id'] );
} else {
$button_link = get_permalink();
}
$button_link = apply_filters( 'learndash_course_grid_custom_button_link', $button_link, $course_post_id );
$button_text = isset( $button_text ) && ! empty( $button_text ) ? $button_text : __( 'See more...', 'kadence' );
$button_text = apply_filters( 'learndash_course_grid_custom_button_text', $button_text, $course_post_id );
$options = get_option( 'sfwd_cpt_options' );
$currency_setting = class_exists( 'LearnDash_Settings_Section' ) ? LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Section_PayPal', 'paypal_currency' ) : null;
$currency = '';
if ( isset( $currency_setting ) || ! empty( $currency_setting ) ) {
$currency = $currency_setting;
} elseif ( isset( $options['modules'] ) && isset( $options['modules']['sfwd-courses_options'] ) && isset( $options['modules']['sfwd-courses_options']['sfwd-courses_paypal_currency'] ) ) {
$currency = $options['modules']['sfwd-courses_options']['sfwd-courses_paypal_currency'];
}
if ( class_exists( 'NumberFormatter' ) ) {
$locale = get_locale();
$number_format = new NumberFormatter( $locale . '@currency=' . $currency, NumberFormatter::CURRENCY );
$currency = $number_format->getSymbol( NumberFormatter::CURRENCY_SYMBOL );
}
/**
* Currency symbol filter hook
*
* @param string $currency Currency symbol
* @param int $course_id
*/
$currency = apply_filters( 'learndash_course_grid_currency', $currency, $course_id );
$course_options = get_post_meta( $course_post_id, "_sfwd-courses", true );
$legacy_short_description = isset( $course_options['sfwd-courses_course_short_description'] ) ? $course_options['sfwd-courses_course_short_description'] : '';
// For LD >= 3.0.
if ( function_exists( 'learndash_get_course_price' ) ) {
$price_args = learndash_get_course_price( $course_id );
$price = $price_args['price'];
$price_type = $price_args['type'];
} else {
$price = $course_options && isset( $course_options['sfwd-courses_course_price'] ) ? $course_options['sfwd-courses_course_price'] : __( 'Free', 'kadence' );
$price_type = $course_options && isset( $course_options['sfwd-courses_course_price_type'] ) ? $course_options['sfwd-courses_course_price_type'] : '';
}
if ( ! empty( $cg_short_description ) ) {
$short_description = $cg_short_description;
} elseif ( ! empty( $legacy_short_description ) ) {
$short_description = $legacy_short_description;
} else {
$short_description = '';
}
/**
* Filter: individual grid class
*
* @param int $course_id Course ID
* @param array $course_options Course options
* @var string
*/
$grid_class = apply_filters( 'learndash_course_grid_class', '', $course_id, $course_options );
$has_access = sfwd_lms_has_access( $course_id, $user_id );
$is_completed = learndash_course_completed( $user_id, $course_id );
$price_text = '';
if ( is_numeric( $price ) && ! empty( $price ) ) {
$price_format = apply_filters( 'learndash_course_grid_price_text_format', '{currency}{price}' );
$price_text = str_replace( array( '{currency}', '{price}' ), array( $currency, $price ), $price_format );
} elseif ( is_string( $price ) && ! empty( $price ) ) {
$price_text = $price;
} elseif ( empty( $price ) ) {
$price_text = __( 'Free', 'kadence' );
}
$class = 'ld_course_grid_price';
$course_class = '';
$ribbon_text = get_post_meta( $post->ID, '_learndash_course_grid_custom_ribbon_text', true );
$ribbon_text = isset( $ribbon_text ) && ! empty( $ribbon_text ) ? $ribbon_text : '';
if ( $has_access && ! $is_completed && $price_type != 'open' && empty( $ribbon_text ) ) {
$class .= ' ribbon-enrolled';
$course_class .= ' learndash-available learndash-incomplete ';
$ribbon_text = __( 'Enrolled', 'kadence' );
} elseif ( $has_access && $is_completed && $price_type != 'open' && empty( $ribbon_text ) ) {
$class .= '';
$course_class .= ' learndash-available learndash-complete';
$ribbon_text = __( 'Completed', 'kadence' );
} elseif ( $price_type == 'open' && empty( $ribbon_text ) ) {
if ( is_user_logged_in() && ! $is_completed ) {
$class .= ' ribbon-enrolled';
$course_class .= ' learndash-available learndash-incomplete';
$ribbon_text = __( 'Enrolled', 'kadence' );
} elseif ( is_user_logged_in() && $is_completed ) {
$class .= '';
$course_class .= ' learndash-available learndash-complete';
$ribbon_text = __( 'Completed', 'kadence' );
} else {
$course_class .= ' learndash-available';
$class .= ' ribbon-enrolled';
$ribbon_text = '';
}
} elseif ( $price_type == 'closed' && empty( $price ) ) {
$class .= ' ribbon-enrolled';
$course_class .= ' learndash-available';
if ( $is_completed ) {
$course_class .= ' learndash-complete';
} else {
$course_class .= ' learndash-incomplete';
}
if ( is_numeric( $price ) ) {
$ribbon_text = $price_text;
} else {
$ribbon_text = '';
}
} else {
if ( empty( $ribbon_text ) ) {
$class .= ! empty( $course_options['sfwd-courses_course_price'] ) ? ' price_' . $currency : ' free';
$course_class .= ' learndash-not-available learndash-incomplete';
$ribbon_text = $price_text;
} else {
$class .= ' custom';
$course_class .= ' learndash-not-available learndash-incomplete';
}
}
/**
* Filter: individual course ribbon text
*
* @param string $ribbon_text Returned ribbon text
* @param int $course_id Course ID
* @param string $price_type Course price type
*/
$ribbon_text = apply_filters( 'learndash_course_grid_ribbon_text', $ribbon_text, $course_id, $price_type );
if ( '' == $ribbon_text ) {
$class = '';
}
/**
* Filter: individual course ribbon class names
*
* @param string $class Returned class names
* @param int $course_id Course ID
* @param array $course_options Course's options
* @var string
*/
$class = apply_filters( 'learndash_course_grid_ribbon_class', $class, $course_id, $course_options );
/**
* Filter: individual course container class names
*
* @param string $course_class Returned class names
* @param int $course_id Course ID
* @param array $course_options Course's options
* @var string
*/
$course_class = apply_filters( 'learndash_course_grid_course_class', $course_class, $course_id, $course_options );
$thumb_size = isset( $shortcode_atts['thumb_size'] ) && ! empty( $shortcode_atts['thumb_size'] ) ? $shortcode_atts['thumb_size'] : 'course-thumb';
ob_start();
?>
<div class="ld_course_grid content-bg entry loop-entry <?php echo esc_attr( $boxed_class ); ?> <?php echo esc_attr( $grid_class ); ?>">
<article id="post-<?php the_ID(); ?>" <?php post_class( $course_class . ' thumbnail course' ); ?>>
<?php if ( $shortcode_atts['show_thumbnail'] == 'true' ) : ?>
<?php if ( $post->post_type == 'sfwd-courses' ) : ?>
<div class="<?php echo esc_attr( $class ); ?>">
<?php echo wp_kses_post( $ribbon_text ); ?>
</div>
<?php endif; ?>
<?php if ( 1 == $enable_video && ! empty( $embed_code ) ) : ?>
<div class="ld_course_grid_video_embed">
<?php
// Retrive oembed HTML if URL provided.
if ( preg_match( '/^http/', $embed_code ) ) {
echo wp_oembed_get( wp_kses_post( $embed_code ), array( 'height' => 600, 'width' => 400 ) );
} else {
echo wp_kses_post( $embed_code );
}
?>
</div>
<?php elseif( has_post_thumbnail() ) : ?>
<a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
<?php the_post_thumbnail( $thumb_size ); ?>
</a>
<?php else : ?>
<a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
<img alt="" src="<?php echo esc_url( plugins_url( 'no_image.jpg', LEARNDASH_COURSE_GRID_FILE ) ); ?>"/>
</a>
<?php endif;?>
<?php endif; ?>
<?php if ( $shortcode_atts['show_content'] == 'true' ) : ?>
<div class="caption entry-content-wrap">
<h3 class="entry-title"><?php the_title(); ?></h3>
<?php if ( ! empty( $short_description ) ) : ?>
<p class="entry-content"><?php echo do_shortcode( htmlspecialchars_decode( $short_description ) ); ?></p>
<?php endif; ?>
<p class="ld_course_grid_button"><a class="btn btn-primary" role="button" href="<?php echo esc_url( $button_link ); ?>" rel="bookmark"><?php echo esc_html( $button_text ); ?></a></p>
<?php if ( isset( $shortcode_atts['progress_bar'] ) && $shortcode_atts['progress_bar'] == 'true' ) : ?>
<div class="grid-progress"><?php echo do_shortcode( '[learndash_course_progress course_id="' . get_the_ID() . '" user_id="' . get_current_user_id() . '"]' ); ?></div>
<?php endif; ?>
</div><!-- .entry-header -->
<?php endif; ?>
</article><!-- #post-## -->
</div><!-- .ld_course_grid -->
<?php
/**
* Filter: course grid HTML output
*
* @param string $output Individual course grid HTML output
* @param object $post LD course WP_Post object
* @param array $shortcode_atts Shortcode attributes used for this course grid output
* @param int $user_id Current user ID this course grid is displayed to
* @return string Filtered course grid HTML output
*/
echo apply_filters( 'learndash_course_grid_html_output', ob_get_clean(), $post, $shortcode_atts, $user_id ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */

View File

@@ -0,0 +1,568 @@
<?php
/**
* Kadence\LifterLMS\Component class
*
* @package kadence
*/
namespace Kadence\LifterLMS;
use Kadence\Kadence_CSS;
use Kadence\Component_Interface;
use Kadence_Blocks_Frontend;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function add_theme_support;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
/**
* Class for adding LifterLMS plugin support.
*/
class Component implements Component_Interface {
/**
* Associative array of Google Fonts to load.
*
* Do not access this property directly, instead use the `get_google_fonts()` method.
*
* @var array
*/
protected static $google_fonts = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'lifterlms';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'kadence_dynamic_css', array( $this, 'dynamic_css' ), 20 );
add_action( 'wp_head', array( $this, 'frontend_gfonts' ), 80 );
add_action( 'after_setup_theme', array( $this, 'action_add_lifterlms_support' ) );
add_filter( 'llms_get_theme_default_sidebar', array( $this, 'llms_sidebar_function' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'lifterlms_styles' ), 60 );
// Remove Content Wrappers.
remove_action( 'lifterlms_before_main_content', 'lifterlms_output_content_wrapper' );
remove_action( 'lifterlms_after_main_content', 'lifterlms_output_content_wrapper_end' );
// Remove Title.
add_filter( 'lifterlms_show_page_title', '__return_false' );
// Remove Sidebar.
remove_action( 'lifterlms_sidebar', 'lifterlms_get_sidebar', 10 );
// Add Content wrappers.
add_action( 'lifterlms_before_main_content', array( $this, 'output_content_wrapper' ) );
add_action( 'lifterlms_after_main_content', array( $this, 'output_main_wrapper_end' ), 8 );
add_action( 'lifterlms_after_main_content', 'lifterlms_get_sidebar', 9 );
add_action( 'lifterlms_after_main_content', array( $this, 'output_content_wrapper_end' ), 10 );
add_filter( 'post_class', array( $this, 'set_lifter_entry_class' ), 10, 3 );
add_filter( 'llms_get_loop_list_classes', array( $this, 'set_lifter_grid_class' ) );
// Change Lifter Columns.
add_filter( 'lifterlms_loop_columns', array( $this, 'set_lifter_columns' ) );
// Remove normal archive Description.
remove_action( 'lifterlms_archive_description', 'lifterlms_archive_description' );
add_filter( 'llms_display_outline_thumbnails', array( $this, 'lifter_syllabus_thumbnails' ) );
// Add div with class for Navigation Position.
add_action( 'lifterlms_before_student_dashboard', array( $this, 'dashboard_wrapper_open' ), 5 );
// Close added div with class for Navigation Position.
add_action( 'lifterlms_after_student_dashboard', array( $this, 'dashboard_wrapper_close' ), 20 );
// Could use to move the nav out of the header area, absolute position seems to work just as well though.
// remove_action( 'lifterlms_student_dashboard_header', 'lifterlms_template_student_dashboard_navigation' );
// add_action( 'lifterlms_before_student_dashboard_content', 'lifterlms_template_student_dashboard_navigation', 5 );
}
/**
* Adds opening div with class for Navigation Position.
*/
public function dashboard_wrapper_open() {
echo '<div class="kadence-llms-dash-wrap kadence-llms-dash-nav-' . esc_attr( kadence()->option( 'llms_dashboard_navigation_layout' ) ) . '">';
}
/**
* Adds closing div with class for Navigation Position.
*/
public function dashboard_wrapper_close() {
echo '</div>';
}
/**
* Adds thumbnail control for syllabus thumbnails
*
* @param boolean $show the whether to show the thumbnail.
*/
public function lifter_syllabus_thumbnails( $show ) {
if ( kadence()->option( 'course_syllabus_thumbs' ) ) {
$show = true;
} else {
$show = false;
}
return $show;
}
/**
* Changes the columns for lifter archives.
*
* @param array $columns the columns.
*/
public function set_lifter_columns( $columns ) {
$dash_id = llms_get_page_id( 'myaccount' );
if ( get_the_ID() === $dash_id ) {
$columns = absint( kadence()->option( 'llms_dashboard_archive_columns' ) );
} elseif ( is_archive() ) {
if ( is_post_type_archive( 'course' ) || is_tax( 'course_cat' ) || is_tax( 'course_tag' ) || is_tax( 'course_track' ) ) {
$columns = absint( kadence()->option( 'course_archive_columns' ) );
} elseif ( is_post_type_archive( 'llms_membership' ) || is_tax( 'membership_cat' ) || is_tax( 'membership_tag' ) ) {
$columns = absint( kadence()->option( 'llms_membership_archive_columns' ) );
}
}
return $columns;
}
/**
* Adds grid class to archive items.
*
* @param array $classes the classes.
*/
public function set_lifter_grid_class( $classes ) {
$classes[] = 'grid-cols';
if ( in_array( 'cols-4', $classes, true ) ) {
$classes[] = 'grid-sm-col-3';
$classes[] = 'grid-lg-col-4';
$classes = array_diff( $classes, array( 'cols-4' ) );
} elseif ( in_array( 'cols-2', $classes, true ) ) {
$classes[] = 'grid-sm-col-2';
$classes[] = 'grid-lg-col-2';
$classes = array_diff( $classes, array( 'cols-2' ) );
} else {
$classes[] = 'grid-sm-col-2';
$classes[] = 'grid-lg-col-3';
$classes = array_diff( $classes, array( 'cols-3' ) );
}
return $classes;
}
/**
* Adds entry class to loop items.
*
* @param array $classes the classes.
* @param string $class the class.
* @param int $post_id the post id.
*/
public function set_lifter_entry_class( $classes, $class, $post_id ) {
if ( in_array( 'llms-loop-item', $classes, true ) ) {
$classes[] = 'entry';
$classes[] = 'content-bg';
}
return $classes;
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
echo '<div id="primary" class="content-area"><div class="content-container site-container">';
$this->output_main_wrapper();
if ( is_archive() && kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
}
/**
* Adds theme main output Wrapper.
*/
public function output_main_wrapper() {
echo '<main id="main" class="site-main" role="main">';
}
/**
* Adds theme main end output Wrapper.
*/
public function output_main_wrapper_end() {
echo '</main>';
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
echo '</div></div>';
}
/**
* Add some css styles for lifterLMS
*/
public function lifterlms_styles() {
wp_enqueue_style( 'kadence-lifterlms', get_theme_file_uri( '/assets/css/lifterlms.min.css' ), array(), KADENCE_VERSION );
}
/**
* Adds theme support for the Lifter plugin.
*
* See: https://lifterlms.com/docs/lifterlms-sidebar-support
*/
public function action_add_lifterlms_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
* @param string $id default sidebar id (an empty string).
* @return string
*/
public function llms_sidebar_function( $id ) {
$sidebar_id = 'primary-sidebar';
return $sidebar_id;
}
/**
* Enqueue Frontend Fonts
*/
public function frontend_gfonts() {
if ( empty( self::$google_fonts ) ) {
return;
}
if ( class_exists( 'Kadence_Blocks_Frontend' ) ) {
$ktblocks_instance = Kadence_Blocks_Frontend::get_instance();
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $ktblocks_instance::$gfonts ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$ktblocks_instance::$gfonts[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $ktblocks_instance::$gfonts[ $key ]['fontvariants'], true ) ) {
array_push( $ktblocks_instance::$gfonts[ $key ]['fontvariants'], $variant );
}
}
}
}
} else {
add_filter( 'kadence_theme_google_fonts_array', array( $this, 'filter_in_fonts' ) );
}
}
/**
* Filters in pro fronts for output with free.
*
* @param array $font_array any custom css.
* @return array
*/
public function filter_in_fonts( $font_array ) {
// Enqueue Google Fonts.
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $font_array ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$font_array[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $font_array[ $key ]['fontvariants'], true ) ) {
array_push( $font_array[ $key ]['fontvariants'], $variant );
}
}
}
}
return $font_array;
}
/**
* Generates the dynamic css based on customizer options.
*
* @param string $css any custom css.
* @return string
*/
public function dynamic_css( $css ) {
$generated_css = $this->generate_lifter_css();
if ( ! empty( $generated_css ) ) {
$css .= "\n/* Kadence Lifter CSS */\n" . $generated_css;
}
return $css;
}
/**
* Generates the dynamic css based on page options.
*
* @return string
*/
public function generate_lifter_css() {
$css = new Kadence_CSS();
$media_query = array();
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
// Lifter CSS.
if ( class_exists( 'LifterLMS' ) ) {
// Course Backgrounds.
$css->set_selector( 'body.single-course' );
$css->render_background( kadence()->sub_option( 'course_background', 'desktop' ), $css );
$css->set_selector( 'body.single-course .content-bg, body.content-style-unboxed.single-course .site' );
$css->render_background( kadence()->sub_option( 'course_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-course' );
$css->render_background( kadence()->sub_option( 'course_background', 'tablet' ), $css );
$css->set_selector( 'body.single-course .content-bg, body.content-style-unboxed.single-course .site' );
$css->render_background( kadence()->sub_option( 'course_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-course' );
$css->render_background( kadence()->sub_option( 'course_background', 'mobile' ), $css );
$css->set_selector( 'body.single-course .content-bg, body.content-style-unboxed.single-course .site' );
$css->render_background( kadence()->sub_option( 'course_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Lesson Backgrounds.
$css->set_selector( 'body.single-lesson' );
$css->render_background( kadence()->sub_option( 'lesson_background', 'desktop' ), $css );
$css->set_selector( 'body.single-lesson .content-bg, body.content-style-unboxed.single-lesson .site' );
$css->render_background( kadence()->sub_option( 'lesson_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-lesson' );
$css->render_background( kadence()->sub_option( 'lesson_background', 'tablet' ), $css );
$css->set_selector( 'body.single-lesson .content-bg, body.content-style-unboxed.single-lesson .site' );
$css->render_background( kadence()->sub_option( 'lesson_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-lesson' );
$css->render_background( kadence()->sub_option( 'lesson_background', 'mobile' ), $css );
$css->set_selector( 'body.single-lesson .content-bg, body.content-style-unboxed.single-lesson .site' );
$css->render_background( kadence()->sub_option( 'lesson_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Course Archive Backgrounds.
$css->set_selector( 'body.archive.tax-course_cat, body.post-type-archive-course' );
$css->render_background( kadence()->sub_option( 'course_archive_background', 'desktop' ), $css );
$css->set_selector( 'body.archive.tax-course_cat .content-bg, body.content-style-unboxed.archive.tax-course_cat .site, body.post-type-archive-course .content-bg, body.content-style-unboxed.archive.post-type-archive-course .site' );
$css->render_background( kadence()->sub_option( 'course_archive_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.archive.tax-course_cat, body.post-type-archive-course' );
$css->render_background( kadence()->sub_option( 'course_archive_background', 'tablet' ), $css );
$css->set_selector( 'body.archive.tax-course_cat .content-bg, body.content-style-unboxed.archive.tax-course_cat .site, body.post-type-archive-course .content-bg, body.content-style-unboxed.archive.post-type-archive-course .site' );
$css->render_background( kadence()->sub_option( 'course_archive_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.archive.tax-course_cat, body.post-type-archive-course' );
$css->render_background( kadence()->sub_option( 'course_archive_background', 'mobile' ), $css );
$css->set_selector( 'body.archive.tax-course_cat .content-bg, body.content-style-unboxed.archive.tax-course_cat .site, body.post-type-archive-course .content-bg, body.content-style-unboxed.archive.post-type-archive-course .site' );
$css->render_background( kadence()->sub_option( 'course_archive_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Membership Archive Backgrounds.
$css->set_selector( 'body.archive.tax-membership_cat, body.post-type-archive-llms_membership' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_background', 'desktop' ), $css );
$css->set_selector( 'body.archive.tax-membership_cat .content-bg, body.content-style-unboxed.archive.tax-membership_cat .site, body.post-type-archive-llms_membership .content-bg, body.content-style-unboxed.archive.post-type-archive-llms_membership .site' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.archive.tax-membership_cat, body.post-type-archive-llms_membership' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_background', 'tablet' ), $css );
$css->set_selector( 'body.archive.tax-membership_cat .content-bg, body.content-style-unboxed.archive.tax-membership_cat .site, body.post-type-archive-llms_membership .content-bg, body.content-style-unboxed.archive.post-type-archive-llms_membership .site' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.archive.tax-membership_cat, body.post-type-archive-llms_membership' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_background', 'mobile' ), $css );
$css->set_selector( 'body.archive.tax-membership_cat .content-bg, body.content-style-unboxed.archive.tax-membership_cat .site, body.post-type-archive-llms_membership .content-bg, body.content-style-unboxed.archive.post-type-archive-llms_membership .site' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Course Title.
$css->set_selector( '.wp-site-blocks .course-title h1' );
$css->render_font( kadence()->option( 'course_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.wp-site-blocks .course-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'course_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'course_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'course_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.wp-site-blocks .course-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'course_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'course_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'course_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Course Title Breadcrumbs.
$css->set_selector( '.course-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'course_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.course-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.course-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'course_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'course_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'course_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.course-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'course_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'course_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'course_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Course Title.
$css->set_selector( '.course-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.course-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_title_height' ), 'desktop' ) );
$css->set_selector( '.course-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'course_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.course-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.course-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.course-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.course-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Lesson Title.
$css->set_selector( '.wp-site-blocks .lesson-title h1' );
$css->render_font( kadence()->option( 'lesson_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.wp-site-blocks .lesson-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'lesson_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'lesson_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'lesson_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.wp-site-blocks .lesson-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'lesson_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'lesson_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'lesson_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Lesson Title Breadcrumbs.
$css->set_selector( '.lesson-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'lesson_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'lesson_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.lesson-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'lesson_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.lesson-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'lesson_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'lesson_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'lesson_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.lesson-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'lesson_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'lesson_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'lesson_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Above Lesson Title.
$css->set_selector( '.lesson-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'lesson_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'lesson_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'lesson_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.lesson-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'lesson_title_height' ), 'desktop' ) );
$css->set_selector( '.lesson-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'lesson_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.lesson-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'lesson_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'lesson_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'lesson_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.lesson-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'lesson_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.lesson-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'lesson_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'lesson_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'lesson_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.lesson-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'lesson_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Course Archive Title.
$css->set_selector( '.course-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_archive_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_archive_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_archive_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.course-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_archive_title_height' ), 'desktop' ) );
$css->set_selector( '.course-archive-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'course_archive_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.course-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_archive_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_archive_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_archive_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.course-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_archive_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.course-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'course_archive_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'course_archive_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'course_archive_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.course-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'course_archive_title_height' ), 'mobile' ) );
$css->stop_media_query();
$css->set_selector( '.wp-site-blocks .course-archive-title h1' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_archive_title_color', 'color' ) ) );
$css->set_selector( '.course-archive-title .kadence-breadcrumbs' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_archive_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.course-archive-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_archive_title_breadcrumb_color', 'hover' ) ) );
$css->set_selector( '.course-archive-title .archive-description' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_archive_title_description_color', 'color' ) ) );
$css->set_selector( '.course-archive-title .archive-description a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'course_archive_title_description_color', 'hover' ) ) );
// Membership Archive Title.
$css->set_selector( '.llms_membership-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.llms_membership-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'llms_membership_archive_title_height' ), 'desktop' ) );
$css->set_selector( '.llms_membership-archive-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'llms_membership_archive_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.llms_membership-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.llms_membership-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'llms_membership_archive_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.llms_membership-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'llms_membership_archive_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'llms_membership_archive_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.llms_membership-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'llms_membership_archive_title_height' ), 'mobile' ) );
$css->stop_media_query();
$css->set_selector( '.wp-site-blocks .llms_membership-archive-title h1' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'llms_membership_archive_title_color', 'color' ) ) );
$css->set_selector( '.llms_membership-archive-title .kadence-breadcrumbs' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'llms_membership_archive_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.llms_membership-archive-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'llms_membership_archive_title_breadcrumb_color', 'hover' ) ) );
$css->set_selector( '.llms_membership-archive-title .archive-description' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'llms_membership_archive_title_description_color', 'color' ) ) );
$css->set_selector( '.llms_membership-archive-title .archive-description a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'llms_membership_archive_title_description_color', 'hover' ) ) );
}
self::$google_fonts = $css->fonts_output();
return $css->css_output();
}
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* Kadence\Localization\Component class
*
* @package kadence
*/
namespace Kadence\Localization;
use Kadence\Component_Interface;
use function add_action;
use function load_theme_textdomain;
use function get_template_directory;
/**
* Class for managing localization.
*/
class Component implements Component_Interface {
/**
* Absolute path to the translation directory.
*
* @var string
*/
public $translation_directory = '';
/**
* Constructor.
*/
public function __construct() {
// Define the translation directory.
$this->translation_directory = get_template_directory() . '/languages';
}
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'localization';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_load_textdomain' ), 1 );
}
/**
* Loads the theme textdomain.
*/
public function action_load_textdomain() {
/*
* Make the theme available for translation. Translations can be filed in the /languages/ directory.
*
* If you want to distribute your theme on wordpress.org and use their language packs feature, you
* should not bundle translations in your theme. In that case you also need to get rid of the
* second parameter in the following function call.
*/
load_theme_textdomain( 'kadence', $this->translation_directory );
}
}

View File

@@ -0,0 +1,154 @@
<?php
/**
* Kadence\Microdata\Component class
*
* @package kadence
*/
namespace Kadence\Microdata;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function apply_filters;
use function Kadence\kadence;
/**
* Class for managing Microdata support.
*
* Exposes template tags:
* * `kadence()->print_microdata()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'microdata';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'init', array( $this, 'disable_sitemap_filter' ) );
}
/**
* Check if the user has chosen to disable sitemaps.
*
* @return void
*/
public function disable_sitemap_filter() {
$disable_sitemap = kadence()->option( 'disable_sitemap' ) ? true : false;
if( $disable_sitemap ) {
add_filter( 'wp_sitemaps_enabled', '__return_false' );
}
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'print_microdata' => array( $this, 'print_microdata' ),
);
}
/**
* Prints microdata directly into html elements.
*
* @param string $context html context for microdata.
*/
public function print_microdata( string $context ) {
// If not using, return early.
if ( ! kadence()->option( 'microdata' ) || ! apply_filters( 'kadence_microdata', true, $context ) ) {
return;
}
echo $this->get_microdata( $context ); // phpcs:ignore
}
/**
* Get any necessary microdata.
*
* @param string $context The element to target.
* @return string Our final attribute to add to the element.
*/
public function get_microdata( $context ) {
$data = false;
if ( 'html' === $context ) {
$type = 'WebPage';
if ( class_exists( 'woocommerce' ) && is_product() ) {
$type = 'IndividualProduct';
} elseif ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) {
$type = 'Blog';
} elseif ( is_author() ) {
$type = 'ProfilePage';
}
if ( is_search() ) {
$type = 'SearchResultsPage';
}
$type = apply_filters( 'kadence_html_itemtype', $type );
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html( $type )
);
}
if ( 'header' === $context ) {
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
}
if ( 'navigation' === $context ) {
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
}
if ( 'article' === $context ) {
$type = apply_filters( 'kadence_article_itemtype', 'CreativeWork' );
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html( $type )
);
}
if ( 'post-author' === $context ) {
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
}
if ( 'comment-body' === $context ) {
$data = 'itemtype="https://schema.org/Comment" itemscope';
}
if ( 'comment-author' === $context ) {
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
}
if ( 'sidebar' === $context ) {
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
}
if ( 'footer' === $context ) {
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
}
if ( 'video' === $context ) {
$data = 'itemprop="video" itemtype="http://schema.org/VideoObject" itemscope';
}
if ( $data ) {
return apply_filters( "kadence_{$context}_schema", $data );
}
}
}

View File

@@ -0,0 +1,308 @@
<?php
/**
* Kadence\Nav_Menus\Component class
*
* @package kadence
*/
namespace Kadence\Nav_Menus;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use WP_Query;
use function add_action;
use function add_filter;
use function register_nav_menus;
use function has_nav_menu;
use function wp_nav_menu;
/**
* Class for managing navigation menus.
*
* Exposes template tags:
* * `kadence()->is_primary_nav_menu_active()`
* * `kadence()->display_primary_nav_menu( array $args = [] )`
* * `kadence()->display_fallback_menu( array $args = [] )`
* * `kadence()->is_mobile_nav_menu_active( array $args = [] )`
* * `kadence()->display_mobile_nav_menu( array $args = [] )`
*/
class Component implements Component_Interface, Templating_Component_Interface {
const PRIMARY_NAV_MENU_SLUG = 'primary';
const MOBILE_NAV_MENU_SLUG = 'mobile';
const SECONDARY_NAV_MENU_SLUG = 'secondary';
const FOOTER_NAV_MENU_SLUG = 'footer';
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'nav_menus';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', [ $this, 'action_register_nav_menus' ] );
add_filter( 'nav_menu_item_title', [ $this, 'filter_primary_nav_menu_dropdown_symbol' ], 10, 4 );
add_filter( 'walker_nav_menu_start_el', [ $this, 'filter_mobile_nav_menu_dropdown_symbol' ], 10, 4 );
require_once get_template_directory() . '/inc/components/nav_menus/nav-widget-settings.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags(): array {
return [
'is_primary_nav_menu_active' => [ $this, 'is_primary_nav_menu_active' ],
'display_primary_nav_menu' => [ $this, 'display_primary_nav_menu' ],
'is_secondary_nav_menu_active' => [ $this, 'is_secondary_nav_menu_active' ],
'display_secondary_nav_menu' => [ $this, 'display_secondary_nav_menu' ],
'is_footer_nav_menu_active' => [ $this, 'is_footer_nav_menu_active' ],
'display_footer_nav_menu' => [ $this, 'display_footer_nav_menu' ],
'display_fallback_menu' => [ $this, 'display_fallback_menu' ],
'is_mobile_nav_menu_active' => [ $this, 'is_mobile_nav_menu_active' ],
'display_mobile_nav_menu' => [ $this, 'display_mobile_nav_menu' ],
];
}
/**
* Registers the navigation menus.
*/
public function action_register_nav_menus() {
register_nav_menus(
[
static::PRIMARY_NAV_MENU_SLUG => esc_html__( 'Primary', 'kadence' ),
static::SECONDARY_NAV_MENU_SLUG => esc_html__( 'Secondary', 'kadence' ),
static::MOBILE_NAV_MENU_SLUG => esc_html__( 'Mobile', 'kadence' ),
static::FOOTER_NAV_MENU_SLUG => esc_html__( 'Footer', 'kadence' ),
]
);
}
/**
* Adds a dropdown symbol to nav menu items with children.
*
* @param string $title The menu item's title.
* @param object $item The current menu item usually a post object.
* @param stdClass $args An object of wp_nav_menu arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
public function filter_primary_nav_menu_dropdown_symbol( $title, $item, $args, $depth ) {
// // Only for our primary and secondary menu location.
// if ( empty( $args->theme_location ) || ( static::PRIMARY_NAV_MENU_SLUG !== $args->theme_location && static::SECONDARY_NAV_MENU_SLUG !== $args->theme_location ) ) {
// return $title;
// }
// // This can still get called because menu location isn't always correct.
// if ( ! empty( $args->menu_id ) && 'mobile-menu' === $args->menu_id ) {
// return $title;
// }
if ( ! isset( $args->sub_arrows ) || empty( $args->sub_arrows ) ) {
return $title;
}
// Add the dropdown for items that have children.
if ( ! empty( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) {
$title = '<span class="nav-drop-title-wrap">' . $title . '<span class="dropdown-nav-toggle">' . kadence()->get_icon( 'arrow-down' ) . '</span></span>';
}
// aria-label="' . esc_attr__( 'Expand child menu', 'kadence' ) . '"
return $title;
}
/**
* Adds a dropdown symbol to nav menu items with children.
*
* @param string $item_output The menu item's starting HTML output.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param object $args An object of wp_nav_menu.
* @return string Modified nav menu HTML.
*/
public function filter_mobile_nav_menu_dropdown_symbol( $item_output, $item, $depth, $args ) {
// Only for our Mobile menu location.
if ( ! isset( $args->show_toggles ) || empty( $args->show_toggles ) ) {
return $item_output;
}
// Add the dropdown for items that have children.
if ( ! empty( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) {
if ( kadence()->is_amp() ) {
return $item_output;
}
$menu_id = ( isset( $args->menu_id ) && ! empty( $args->menu_id ) ? '#' . $args->menu_id : '.menu' );
$toggle_target_string = $menu_id . ' .menu-item-' . $item->ID . ' > .sub-menu';
return '<div class="drawer-nav-drop-wrap">' . $item_output . '<button class="drawer-sub-toggle" data-toggle-duration="10" data-toggle-target="' . esc_attr( $toggle_target_string ) . '" aria-expanded="false"><span class="screen-reader-text">' . esc_html__( 'Toggle child menu', 'kadence' ) . '</span>' . kadence()->get_icon( 'arrow-down', '', false, false ) . '</button></div>';
}
return $item_output;
}
/**
* Checks whether the primary navigation menu is active.
*
* @return bool True if the primary navigation menu is active, false otherwise.
*/
public function is_primary_nav_menu_active(): bool {
return (bool) has_nav_menu( static::PRIMARY_NAV_MENU_SLUG );
}
/**
* Checks whether the secondary navigation menu is active.
*
* @return bool True if the secondary navigation menu is active, false otherwise.
*/
public function is_secondary_nav_menu_active(): bool {
return (bool) has_nav_menu( static::SECONDARY_NAV_MENU_SLUG );
}
/**
* Checks whether the footer navigation menu is active.
*
* @return bool True if the footer navigation menu is active, false otherwise.
*/
public function is_footer_nav_menu_active(): bool {
return (bool) has_nav_menu( static::FOOTER_NAV_MENU_SLUG );
}
/**
* Checks whether the mobile navigation menu is active.
*
* @return bool True if the mobile navigation menu is active, false otherwise.
*/
public function is_mobile_nav_menu_active(): bool {
return (bool) has_nav_menu( static::MOBILE_NAV_MENU_SLUG );
}
/**
* Displays the fallback page navigation menu.
*
* @param array $args Optional. Array of arguments. See wp page menu documentation for a list of supported.
*/
public function display_fallback_menu( array $args = [] ) {
$latest = new WP_Query(
[
'post_type' => 'page',
'orderby' => 'menu_order title',
'order' => 'ASC',
'posts_per_page' => 5,
]
);
$page_ids = wp_list_pluck( $latest->posts, 'ID' );
$page_ids = implode( ',', $page_ids );
$fallback_args = [
'depth' => -1,
'include' => $page_ids,
'show_home' => false,
'before' => '',
'after' => '',
'menu_id' => 'primary-menu',
'menu_class' => 'menu',
'container' => 'ul',
];
add_filter( 'wp_page_menu', [ $this, 'change_page_menu_classes' ], 10, 2 );
wp_page_menu( $fallback_args );
remove_filter( 'wp_page_menu', [ $this, 'change_page_menu_classes' ], 10, 2 );
}
/**
* Displays the primary navigation menu.
*
* @param array $args Optional. Array of arguments. See wp nav menu documentation for a list of supported arguments.
*/
public function change_page_menu_classes( $menu, $args ) {
$menu = str_replace( 'page_item', 'menu-item', $menu );
return $menu;
}
/**
* Displays the primary navigation menu.
*
* @param array $args Optional. Array of arguments. See wp nav menu documentation for a list of supported arguments.
*/
public function display_mobile_nav_menu( array $args = [] ) {
if ( ! isset( $args['container'] ) ) {
$args['container'] = 'ul';
}
if ( ! isset( $args['addon_support'] ) ) {
$args['addon_support'] = true;
}
if ( ! isset( $args['mega_support'] ) && apply_filters( 'kadence_mobile_allow_mega_support', true ) ) {
$args['mega_support'] = true;
}
$args['show_toggles'] = ( kadence()->option( 'mobile_navigation_collapse' ) ? true : false );
$args['theme_location'] = static::MOBILE_NAV_MENU_SLUG;
wp_nav_menu( $args );
}
/**
* Displays the primary navigation menu.
*
* @param array $args Optional. Array of arguments. See wp nav menu documentation for a list of supported arguments.
*/
public function display_primary_nav_menu( array $args = [] ) {
if ( ! isset( $args['container'] ) ) {
$args['container'] = 'ul';
}
if ( ! isset( $args['sub_arrows'] ) ) {
$args['sub_arrows'] = true;
}
if ( ! isset( $args['mega_support'] ) ) {
$args['mega_support'] = true;
}
if ( ! isset( $args['addon_support'] ) ) {
$args['addon_support'] = true;
}
$args['theme_location'] = static::PRIMARY_NAV_MENU_SLUG;
wp_nav_menu( $args );
}
/**
* Displays the Secondary navigation menu.
*
* @param array $args Optional. Array of arguments. See wp nav menu documentation for a list of supported arguments.
*/
public function display_secondary_nav_menu( array $args = [] ) {
if ( ! isset( $args['container'] ) ) {
$args['container'] = 'ul';
}
if ( ! isset( $args['sub_arrows'] ) ) {
$args['sub_arrows'] = true;
}
if ( ! isset( $args['mega_support'] ) ) {
$args['mega_support'] = true;
}
if ( ! isset( $args['addon_support'] ) ) {
$args['addon_support'] = true;
}
$args['theme_location'] = static::SECONDARY_NAV_MENU_SLUG;
wp_nav_menu( $args );
}
/**
* Displays the footer navigation menu.
*
* @param array $args Optional. Array of arguments. See wp nav menu documentation for a list of supported arguments.
*/
public function display_footer_nav_menu( array $args = [] ) {
if ( ! isset( $args['container'] ) ) {
$args['container'] = 'ul';
}
if ( ! isset( $args['depth'] ) ) {
$args['depth'] = 1;
}
if ( ! isset( $args['addon_support'] ) ) {
$args['addon_support'] = true;
}
$args['theme_location'] = static::FOOTER_NAV_MENU_SLUG;
wp_nav_menu( $args );
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* Kadence\Nav_Menus\Component class
*
* @package kadence
*/
namespace Kadence\Nav_Menus;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use WP_Post;
use WP_Query;
use function add_action;
use function add_filter;
use function register_nav_menus;
use function has_nav_menu;
use function wp_nav_menu;
/**
* Class for adding collapse option to navigation widget.
*/
class Nav_Widget_Settings {
/**
* Default settings.
*
* @var array;
*/
protected $defaults = array(
'collapse' => false,
);
/**
* Default widgets.
*
* @var array;
*/
protected $widgets = array(
'nav_menu',
);
/**
* Construct.
*
* @var array;
*/
public function __construct() {
// Hook in all the right places.
add_action( 'in_widget_form', array( $this, 'add_settings' ), 10, 3 );
add_filter( 'widget_update_callback', array( $this, 'save_settings' ), 10, 4 );
add_filter( 'widget_nav_menu_args', array( $this, 'frontend_settings' ), 10, 4 );
}
/**
* Adds the custom settings to all widgets' forms.
*
* @param WP_Widget $widget An instance of a WP_Widget derived subclass.
* @param mixed $return Return null if new fields are added.
* @param array $instance An array of the widget's settings.
*/
public function add_settings( $widget, $return, $instance ) {
if ( ! $this->is_supported( $widget ) ) {
return null;
}
// Make sure $instance contains at least our default values.
$instance = wp_parse_args( $instance, $this->defaults );
?>
<p>
<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $widget->get_field_id( 'collapse' ) ); ?>" name="<?php echo esc_attr( $widget->get_field_name( 'collapse' ) ); ?>"<?php checked( $instance['collapse'] ); ?> />
<label for="<?php echo esc_attr( $widget->get_field_id( 'collapse' ) ); ?>"><?php esc_html_e( 'Collapse sub menu items', 'kadence' ); ?></label>
</p>
<?php
}
/**
* Saves the custom settings.
*
* @param array $instance The current widget instance's settings.
* @param array $new_instance Array of new widget settings.
* @param array $old_instance Array of old widget settings.
* @param WP_Widget $widget The current widget instance.
*
* @return array The widget instance's settings to get saved.
*/
public function save_settings( $instance, $new_instance, $old_instance, $widget ) {
if ( ! $this->is_supported( $widget ) ) {
return $instance;
}
// Make sure $instance contains at least our default values.
$instance = wp_parse_args( $instance, $this->defaults );
// Now check that a value is actually present, and assign it sanitized.
if ( isset( $new_instance['collapse'] ) ) {
$instance['collapse'] = ! empty( $new_instance['collapse'] ) ? 1 : 0;
}
return $instance;
}
/**
* Filters the arguments for the Navigation Menu widget.
*
* @since 4.2.0
* @since 4.4.0 Added the `$instance` parameter.
*
* @param array $nav_menu_args {
* An array of arguments passed to wp_nav_menu() to retrieve a navigation menu.
*
* @type callable|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
* @type mixed $menu Menu ID, slug, or name.
* }
* @param WP_Term $nav_menu Nav menu object for the current menu.
* @param array $args Display arguments for the current widget.
* @param array $instance Array of settings for the current widget.
*/
public function frontend_settings( $nav_menu_args, $nav_menu, $args, $instance ) {
if ( isset( $instance['collapse'] ) && $instance['collapse'] ) {
$nav_menu_args['show_toggles'] = true;
$nav_menu_args['container_class'] = 'collapse-sub-navigation';
$nav_menu_args['menu_class'] = 'menu has-collapse-sub-nav';
if ( ! isset( $nav_menu_args['menu_id'] ) && isset( $args['widget_id'] ) ) {
$nav_menu_args['menu_id'] = 'menu-' . $args['widget_id'];
}
}
return $nav_menu_args;
}
/**
* Checks to make sure this is only for nav widget.
*
* @param WP_Widget $widget The current widget instance.
*
* @return bool if the right widget.
*/
protected function is_supported( $widget ) {
if ( in_array( $widget->id_base, $this->widgets, true ) ) {
return true;
}
return false;
}
}
new Nav_Widget_Settings();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
<?php
/**
* Kadence\Polylang\Component class
*
* @package kadence
*/
namespace Kadence\Polylang;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function apply_filters;
use function get_template_part;
use function get_post_type;
/**
* Class for adding Polylang plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'polylang';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ), 60 );
}
/**
* Add some css styles for Restrict Content Pro
*/
public function add_styles() {
wp_enqueue_style( 'kadence-polylang', get_theme_file_uri( '/assets/css/polylang.min.css' ), array(), KADENCE_VERSION );
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* Kadence\PWA\Component class
*
* @package kadence
*/
namespace Kadence\PWA;
use Kadence\Component_Interface;
use function add_action;
use function add_theme_support;
/**
* Class for managing PWA support.
*
* @link https://wordpress.org/plugins/pwa/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'pwa';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'after_setup_theme', array( $this, 'action_add_service_worker_support' ) );
}
/**
* Adds support for theme-specific service worker integrations.
*/
public function action_add_service_worker_support() {
add_theme_support( 'service_worker', true );
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* Kadence\Rankmath\Component class
*
* @package kadence
*/
namespace Kadence\Rankmath;
use Kadence\Component_Interface;
/**
* Class for adding Tankmath plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'rankmath';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ), 60 );
}
/**
* Add some css styles for Restrict Content Pro
*/
public function add_styles() {
wp_enqueue_style( 'kadence-rankmath', get_theme_file_uri( '/assets/css/rankmath.min.css' ), array(), KADENCE_VERSION );
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Kadence\Restrict_Content_Pro\Component class
*
* @package kadence
*/
namespace Kadence\Restrict_Content_Pro;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function apply_filters;
use function get_template_part;
use function get_post_type;
/**
* Class for adding Restrict Content Pro plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'restrict_content_pro';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ), 60 );
}
/**
* Add some css styles for Restrict Content Pro
*/
public function add_styles() {
wp_enqueue_style( 'kadence-rcp', get_theme_file_uri( '/assets/css/rcp.min.css' ), array(), KADENCE_VERSION );
}
}

View File

@@ -0,0 +1,168 @@
<?php
/**
* Kadence\Scripts\Component class
*
* @package kadence
*/
namespace Kadence\Scripts;
use Kadence\Component_Interface;
use function Kadence\kadence;
use WP_Post;
use function add_action;
use function add_filter;
use function wp_enqueue_script;
use function get_theme_file_uri;
use function get_theme_file_path;
use function wp_script_add_data;
use function wp_localize_script;
/**
* Class for adding scripts to the front end.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'scripts';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'action_enqueue_scripts' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'ie_11_support_scripts' ), 60 );
}
/**
* Add some very basic support for IE11
*/
public function ie_11_support_scripts() {
if ( apply_filters( 'kadence_add_ie11_support', false ) || kadence()->option( 'ie11_basic_support' ) ) {
wp_enqueue_style( 'kadence-ie11', get_theme_file_uri( '/assets/css/ie.min.css' ), array(), KADENCE_VERSION );
wp_enqueue_script(
'kadence-css-vars-poly',
get_theme_file_uri( '/assets/js/css-vars-ponyfill.min.js' ),
array(),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-css-vars-poly', 'async', true );
wp_script_add_data( 'kadence-css-vars-poly', 'precache', true );
wp_enqueue_script(
'kadence-ie11',
get_theme_file_uri( '/assets/js/ie.min.js' ),
array(),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-ie11', 'async', true );
wp_script_add_data( 'kadence-ie11', 'precache', true );
}
}
/**
* Enqueues a script that improves navigation menu accessibility as well as sticky header etc.
*/
public function action_enqueue_scripts() {
// If the AMP plugin is active, return early.
if ( kadence()->is_amp() ) {
return;
}
$breakpoint = 1024;
if ( kadence()->sub_option( 'header_mobile_switch', 'size' ) ) {
$breakpoint = kadence()->sub_option( 'header_mobile_switch', 'size' );
}
// Enqueue the slide script.
wp_register_script(
'kad-splide',
get_theme_file_uri( '/assets/js/splide.min.js' ),
array(),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kad-splide', 'async', true );
wp_script_add_data( 'kad-splide', 'precache', true );
// Enqueue the slide script.
wp_register_script(
'kadence-slide-init',
get_theme_file_uri( '/assets/js/splide-init.min.js' ),
array( 'kad-splide', 'kadence-navigation' ),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-slide-init', 'async', true );
wp_script_add_data( 'kadence-slide-init', 'precache', true );
wp_localize_script(
'kadence-slide-init',
'kadenceSlideConfig',
array(
'of' => __( 'of', 'kadence' ),
'to' => __( 'to', 'kadence' ),
'slide' => __( 'Slide', 'kadence' ),
'next' => __( 'Next', 'kadence' ),
'prev' => __( 'Previous', 'kadence' ),
)
);
if ( kadence()->option( 'lightbox' ) ) {
// Enqueue the lightbox script.
wp_enqueue_script(
'kadence-simplelightbox',
get_theme_file_uri( '/assets/js/simplelightbox.min.js' ),
array(),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-simplelightbox', 'async', true );
wp_script_add_data( 'kadence-simplelightbox', 'precache', true );
// Enqueue the slide script.
wp_enqueue_script(
'kadence-lightbox-init',
get_theme_file_uri( '/assets/js/lightbox-init.min.js' ),
array( 'kadence-simplelightbox' ),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-lightbox-init', 'async', true );
wp_script_add_data( 'kadence-lightbox-init', 'precache', true );
}
// Main js file.
$file = 'navigation.min.js';
// Lets make it possile to load a lighter file if things are not being used.
if ( 'no' === kadence()->option( 'header_sticky' ) && 'no' === kadence()->option( 'mobile_header_sticky' ) && ! kadence()->option( 'enable_scroll_to_id' ) && ! kadence()->option( 'scroll_up' ) ) {
$file = 'navigation-lite.min.js';
}
wp_enqueue_script(
'kadence-navigation',
get_theme_file_uri( '/assets/js/' . $file ),
array(),
KADENCE_VERSION,
true
);
wp_script_add_data( 'kadence-navigation', 'async', true );
wp_script_add_data( 'kadence-navigation', 'precache', true );
wp_localize_script(
'kadence-navigation',
'kadenceConfig',
array(
'screenReader' => array(
'expand' => __( 'Child menu', 'kadence' ),
'expandOf' => __( 'Child menu of', 'kadence' ),
'collapse' => __( 'Child menu', 'kadence' ),
'collapseOf' => __( 'Child menu of', 'kadence' ),
),
'breakPoints' => array(
'desktop' => esc_attr( $breakpoint ),
'tablet' => 768,
),
'scrollOffset' => apply_filters( 'kadence_scroll_to_id_additional_offset', 0 ),
)
);
}
}

View File

@@ -0,0 +1,372 @@
<?php
/**
* Kadence\Style_Guide\Component class
*
* @package kadence
*/
namespace Kadence\Style_Guide;
use Kadence\Component_Interface;
use function Kadence\kadence;
/**
* Class for managing style guide.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'style_guide';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) );
add_action( 'wp_footer', array( $this, 'style_guide_template' ) );
}
/**
* Customizer Preview css
*
* @since 1.0.0
* @return void
*/
public function preview_scripts() {
wp_enqueue_style( 'kadence-style-guide-styles', get_template_directory_uri() . '/assets/css/style-guide.min.css', array(), KADENCE_VERSION );
wp_enqueue_script( 'kadence-style-guide-previewer', get_template_directory_uri() . '/assets/js/style-guide-previewer.min.js', array( 'jquery', 'customize-preview' ), KADENCE_VERSION, false );
}
/**
* Customizer Controls css
*
* @since 1.0.0
* @return void
*/
public function controls_scripts() {
wp_enqueue_script( 'kadence-style-guide-controls', get_template_directory_uri() . '/assets/js/style-guide-controls.min.js', array(), KADENCE_VERSION );
wp_enqueue_style( 'kadence-style-guide-controls', get_template_directory_uri() . '/assets/css/style-guide-controls.min.css', array(), KADENCE_VERSION );
}
/**
* Get Option Type
*
* @access public
* @return string
*/
public function style_guide_template() {
if ( ! is_customize_preview() ) {
return;
}
?>
<div class="kt-style-guide-wrapper">
<?php echo do_shortcode( $this->render_style_guide_markup() ); ?>
</div>
<?php
}
/**
* Customizer Easy Navigation Tour Markup.
*
* @return mixed HTML Markup.
* @since 4.8.0
*/
public function render_style_guide_markup() {
$settings = apply_filters(
'kadence_style_guide_color_palette',
array(
'color_groups' => array(
'accent' => array(
'title' => __( 'Accents', 'kadence' ),
'colors' => array(
'palette1' => array(
'title' => __( 'Accent', 'kadence' ),
'code' => 'var(--global-palette1)',
),
'palette2' => array(
'title' => __( 'Accent - alt', 'kadence' ),
'code' => 'var(--global-palette2)',
),
'palette10' => array(
'title' => __( 'Accent - complement', 'kadence' ),
'code' => 'var(--global-palette10)',
),
),
),
'contrast' => array(
'title' => __( 'Contrast', 'kadence' ),
'colors' => array(
'palette3' => array(
'title' => __( 'Strongest text', 'kadence' ),
'code' => 'var(--global-palette3)',
),
'palette4' => array(
'title' => __( 'Strong text', 'kadence' ),
'code' => 'var(--global-palette4)',
),
'palette5' => array(
'title' => __( 'Medium text', 'kadence' ),
'code' => 'var(--global-palette5)',
),
'palette6' => array(
'title' => __( 'Subtle text', 'kadence' ),
'code' => 'var(--global-palette6)',
),
),
),
'base' => array(
'title' => __( 'Base', 'kadence' ),
'colors' => array(
'palette7' => array(
'title' => __( 'Subtle background', 'kadence' ),
'code' => 'var(--global-palette7)',
),
'palette8' => array(
'title' => __( 'Lighter background', 'kadence' ),
'code' => 'var(--global-palette8)',
),
'palette9' => array(
'title' => __( 'White or offwhite', 'kadence' ),
'code' => 'var(--global-palette9)',
),
),
),
'notice' => array(
'title' => __( 'Notices', 'kadence' ),
'colors' => array(
'palette11' => array(
'title' => __( 'Success', 'kadence' ),
'code' => 'var(--global-palette11)',
),
'palette12' => array(
'title' => __( 'Info', 'kadence' ),
'code' => 'var(--global-palette12)',
),
'palette13' => array(
'title' => __( 'Alert', 'kadence' ),
'code' => 'var(--global-palette13)',
),
'palette14' => array(
'title' => __( 'Warning', 'kadence' ),
'code' => 'var(--global-palette14)',
),
'palette15' => array(
'title' => __( 'Rating', 'kadence' ),
'code' => 'var(--global-palette15)',
),
),
),
),
)
);
ob_start();
?>
<button class="kt-close-tour" type="button">
<span class="screen-reader-text"><?php esc_html_e( 'Close', 'kadence' ); ?></span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>
</button>
<div class="kt-tour-inner-wrap">
<div class="kt-quick-tour-body">
<div class="kt-sg-2-col-grid">
<div class="kt-styler-card">
<p class="kt-sg-card-title"> <?php esc_html_e( 'Site Title & Logo', 'kadence' ); ?>
<div class="kt-sg-element-wrap kt-sg-logo-section <?php echo esc_attr( kadence()->option('logo-title-inline' ) ? 'kt-logo-title-inline' : '' ); ?>">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'section', 'title_tagline' ) ); ?>
<?php do_action( 'kadence_site_branding' ); ?>
</div>
</div>
<div class="kt-sg-1-col-grid">
<div class="kt-styler-card">
<p class="kt-sg-card-title"> <?php esc_html_e( 'Site Icon', 'kadence' ); ?>
<div class="kt-sg-element-wrap">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'section', 'kadence_customizer_site_identity' ) ); ?>
<?php $this->site_icon_update(); ?>
</div>
</div>
<div class="kt-styler-card">
<p class="kt-sg-card-title"> <?php esc_html_e( 'Buttons', 'kadence' ); ?>
<div class="kt-sg-button-element-wrap">
<div class="kt-sg-element-wrap">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'section', 'kadence_customizer_general_buttons', 'general', '', true ) ); ?>
<button class="button kt-quick-tour-item-trigger" <?php echo $this->get_style_guide_shortcut_trigger_attributes( 'section', 'kadence_customizer_general_buttons'); ?>>
<?php esc_html_e( 'Base', 'kadence' ); ?>
</button>
</div>
<div class="kt-sg-element-wrap">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'section', 'kadence_customizer_secondary_button', 'general', '', true ) ); ?>
<button class="button button-style-secondary kt-quick-tour-item-trigger" <?php echo $this->get_style_guide_shortcut_trigger_attributes( 'section', 'kadence_customizer_secondary_button'); ?>>
<?php esc_html_e( 'Secondary', 'kadence' ); ?>
</button>
</div>
<div class="kt-sg-element-wrap">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'section', 'kadence_customizer_outline_button', 'general', '', true ) ); ?>
<button class="button button-style-outline kt-quick-tour-item-trigger" <?php echo $this->get_style_guide_shortcut_trigger_attributes( 'section', 'kadence_customizer_outline_button'); ?>>
<?php esc_html_e( 'Outline', 'kadence' ); ?>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="kt-sg-colors-section kt-styler-card">
<p class="kt-sg-card-title"> <?php esc_html_e( 'Colors', 'kadence' ); ?>
<div class="kt-sg-colors-section-wrap">
<?php
foreach ( $settings['color_groups'] as $key => $group ) {
?>
<div class="kt-sg-color-group-wrap">
<p class="kt-sg-color-group-title"> <?php echo esc_html( $group['title'] ); ?></p>
<div class="kt-sg-color-items-wrap">
<?php
foreach ( $group['colors'] as $key => $data_attrs ) {
?>
<div class="kt-sg-color-item-wrap">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'kadence_color_palette', 'general', 'data-reference="kt-' . esc_attr( $key ) . '"' ) ); ?>
<span class="kt-sg-color-picker" style="background:<?php echo esc_attr( $data_attrs['code'] ); ?>"> </span>
<span class="kt-sg-field-title"> <?php echo esc_html( $data_attrs['title'] ); ?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
</div>
</div>
<div class="kt-sg-content-section-wrap kt-styler-card">
<p class="kt-sg-card-title"> <?php esc_html_e( 'Typography', 'kadence' ); ?>
<div class="kt-sg-content-inner-wrap">
<div class="kt-sg-heading-more-section">
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h1_font', 'general' ) ); ?>
<h1 class="kt-sg-heading"> <?php esc_html_e( 'H1 Heading', 'kadence' ); ?> </h1>
</div>
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h2_font', 'general' ) ); ?>
<h2 class="kt-sg-heading"> <?php esc_html_e( 'H2 Heading', 'kadence' ); ?> </h2>
</div>
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h3_font', 'general' ) ); ?>
<h3 class="kt-sg-heading"> <?php esc_html_e( 'H3 Heading', 'kadence' ); ?> </h3>
</div>
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h4_font', 'general' ) ); ?>
<h4 class="kt-sg-heading"> <?php esc_html_e( 'H4 Heading', 'kadence' ); ?> </h4>
</div>
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h5_font', 'general' ) ); ?>
<h5 class="kt-sg-heading"> <?php esc_html_e( 'H5 Heading', 'kadence' ); ?> </h5>
</div>
<div class="kt-sg-heading-card">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'h6_font', 'general' ) ); ?>
<h6 class="kt-sg-heading"> <?php esc_html_e( 'H6 Heading', 'kadence' ); ?> </h6>
</div>
</div>
<div class="kt-sg-content-section">
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'base_font', 'general' ) ); ?>
<p> <?php esc_html_e( 'This is your website\'s main body text; it represents the standard paragraph style used across pages and posts. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur cursus pellentesque sem, ac maximus tortor venenatis ac. Aenean convallis metus libero, ut sagittis nisi commodo nec. Sed tempor tempor erat, blandit pellentesque tortor. Proin ipsum velit, dictum ac luctus a, eleifend et sapien.', 'kadence' ); ?> </p>
<?php echo do_shortcode( $this->get_style_guide_shortcut_trigger( 'control', 'base_font', 'general' ) ); ?>
<p> <?php esc_html_e( 'Experiment with various font families, sizes, weights, and styles to establish a clear hierarchy and visual rhythm across your website. Each level of text, from bold, attention-grabbing headings to clean, readable body copy, works together to create balance, enhance readability, and guide users smoothly through your content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur cursus pellentesque sem, ac maximus tortor venenatis ac. Aenean convallis metus libero, ut sagittis nisi commodo nec. Sed tempor tempor erat, blandit pellentesque tortor.', 'kadence' ); ?> </p>
<p class="kt-sg-card-title"> <?php esc_html_e( 'Quote', 'kadence' ); ?>
<blockquote>
<p> <?php esc_html_e( 'Good typography is invisible. Bad typography is everywhere.', 'kadence' ); ?> </p> <br/>
<footer> <?php esc_html_e( 'Anonymous', 'kadence' ); ?> </footer>
</blockquote>
<p class="kt-sg-content-divider"></p>
<p class="kt-sg-card-title"> <?php esc_html_e( 'Unordered List', 'kadence' ); ?>
<ul>
<li> <?php esc_html_e( 'List Item 1', 'kadence' ); ?> </li>
<li> <?php esc_html_e( 'List Item 2', 'kadence' ); ?> </li>
<li> <?php esc_html_e( 'List Item 3', 'kadence' ); ?> </li>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php
return ob_get_clean();
}
/**
* Render customizer style guide shortcut pencil.
*
* @param string $type Section|Control.
* @param string $name Section name|Control name.
* @param string $context General|Design name.
* @param string $extras if any other parameter to pass.
*
* @return string Trigger for style guide shortcut.
* @since 4.8.0
*/
public function get_style_guide_shortcut_trigger( $type, $name, $context = 'general', $extras = '', $is_small = false ) {
$small_class_string = $is_small ? 'kt-quick-tour-item-small' : '';
return '<span class="kt-quick-tour-item kt-quick-tour-item-trigger ' . $small_class_string . '" data-type="' . $type . '" data-name="' . $name . '" data-context="' . $context . '" ' . $extras . '> <span class="kt-sg-customizer-shortcut"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M0.5 6C0.5 2.96243 2.96243 0.5 6 0.5H18C21.0376 0.5 23.5 2.96243 23.5 6V18C23.5 21.0376 21.0376 23.5 18 23.5H6C2.96243 23.5 0.5 21.0376 0.5 18V6Z" fill="white" fill-opacity="0.8"/> <path d="M0.5 6C0.5 2.96243 2.96243 0.5 6 0.5H18C21.0376 0.5 23.5 2.96243 23.5 6V18C23.5 21.0376 21.0376 23.5 18 23.5H6C2.96243 23.5 0.5 21.0376 0.5 18V6Z" stroke="#E2E8F0"/> <g clip-path="url(#clip0_8460_9362)"> <path d="M14.5 7.50081C14.6273 7.35032 14.7849 7.22784 14.9625 7.14115C15.1402 7.05446 15.334 7.00547 15.5318 6.99731C15.7296 6.98915 15.9269 7.022 16.1112 7.09375C16.2955 7.1655 16.4627 7.27459 16.6022 7.41407C16.7416 7.55354 16.8503 7.72034 16.9213 7.90383C16.9922 8.08732 17.0239 8.28347 17.0143 8.4798C17.0047 8.67612 16.954 8.8683 16.8654 9.04409C16.7769 9.21988 16.6524 9.37542 16.5 9.50081L9.75 16.2508L7 17.0008L7.75 14.2508L14.5 7.50081Z" stroke="#020617" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M13.5 8.5L15.5 10.5" stroke="#020617" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> </g> <defs> <clipPath id="clip0_8460_9362"> <rect width="12" height="12" fill="white" transform="translate(6 6)"/> </clipPath> </defs> </svg> </span> </span>';
}
/**
* Render customizer style guide shortcut pencil.
*
* @param string $type Section|Control.
* @param string $name Section name|Control name.
* @param string $context General|Design name.
* @param string $extras if any other parameter to pass.
*
* @return string Trigger for style guide shortcut.
* @since 4.8.0
*/
public function get_style_guide_shortcut_trigger_attributes( $type, $name, $context = 'general', $extras = '' ) {
return 'data-type="' . $type . '" data-name="' . $name . '" data-context="' . $context . '" ' . $extras . '';
}
/**
* Render site icon.
*
* @since 4.8.0
*/
public function site_icon_update() {
$uploaded_icon_url = get_site_icon_url( 32 );
$site_icon_url = empty( $uploaded_icon_url ) ? admin_url() . 'images/wordpress-logo.svg' : $uploaded_icon_url;
?>
<p class="kt-sg-site-icon-wrap">
<span class="kt-sg-site-icon-aside-divider"></span>
<span class="kt-sg-site-icon-inner-wrap">
<img class="kt-sg-site-icon" alt="<?php esc_attr_e( 'Site Icon', 'kadence' ); ?>" src="<?php echo esc_url( $site_icon_url ); ?>" />
<span class="kt-sg-site-title"> <?php echo esc_html( get_bloginfo( 'name' ) ); ?> </span>
<span class="kt-sg-site-blogdescription"> <?php echo esc_attr( ! empty( get_bloginfo( 'description' ) ) ? ' - ' . get_bloginfo( 'description' ) : '' ); ?> </span>
</span>
<span class="kt-sg-site-icon-aside-divider"></span>
</p>
<?php
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
<?php
/**
* Kadence\Surecart\Component class
*
* @package kadence
*/
namespace Kadence\Surecart;
use Kadence\Component_Interface;
/**
* Class for adding Tankmath plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'surecart';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ), 60 );
}
/**
* Add some css styles for Restrict Content Pro
*/
public function add_styles() {
wp_enqueue_style( 'kadence-surecart', get_theme_file_uri( '/assets/css/surecart.min.css' ), array(), KADENCE_VERSION );
}
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* Kadence\Template_Parts\Component class
*
* @package kadence
*/
namespace Kadence\Template_Parts;
use Kadence\Component_Interface;
use Kadence\Templating_Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function do_action;
use function is_active_sidebar;
use function dynamic_sidebar;
/**
* Class for managing template parts.
*
* Exposes template tags:
* * `kadence()->get_template()`
*/
class Component implements Component_Interface, Templating_Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'template_parts';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
}
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array {
return array(
'get_template' => array( $this, 'get_template' ),
);
}
/**
* Get other templates assing attributes and including the file.
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialised template.
* @param array $args Arguments. (default: array).
*/
public static function get_template( $slug, $name = null, $args = array() ) {
/**
* Pass custom variables to the template file.
*/
foreach ( (array) $args as $key => $value ) {
set_query_var( $key, $value );
}
return get_template_part( $slug, $name );
}
}

View File

@@ -0,0 +1,131 @@
<?php
/**
* Kadence\Template_Tags class
*
* @package kadence
*/
namespace Kadence;
use InvalidArgumentException;
use BadMethodCallException;
use RuntimeException;
/**
* Template tags entry point.
*
* This class provides access to all available template tag methods.
*
* Its instance can be accessed through `kadence()`. For example, if there is a template tag called `posted_on`, it can
* be accessed via `kadence()->posted_on()`.
*/
class Template_Tags {
/**
* Associative array of all available template tags.
*
* Method names are the keys, their callback information the values.
*
* @var array
*/
protected $template_tags = [];
/**
* Constructor.
*
* Sets the theme components.
*
* @param array $components Optional. List of theme templating components. Each of these must implement the
* Templating_Component_Interface interface.
*
* @throws InvalidArgumentException Thrown if one of the $components does not implement
* Templating_Component_Interface.
*/
public function __construct( array $components = [] ) {
// Set the template tags for the components.
foreach ( $components as $component ) {
// Bail if a templating component is invalid.
if ( ! $component instanceof Templating_Component_Interface ) {
throw new InvalidArgumentException(
sprintf(
/* translators: 1: classname/type of the variable, 2: interface name */
__( 'The theme templating component %1$s does not implement the %2$s interface.', 'kadence' ),
gettype( $component ),
Templating_Component_Interface::class
)
);
}
$this->set_template_tags( $component );
}
}
/**
* Magic call method.
*
* Will proxy to the template tag $method, unless it is not available, in which case an exception will be thrown.
*
* @param string $method Template tag name.
* @param array $args Template tag arguments.
* @return mixed Template tag result, or null if template tag only outputs markup.
*
* @throws BadMethodCallException Thrown if the template tag does not exist.
*/
public function __call( string $method, array $args ) {
if ( ! isset( $this->template_tags[ $method ] ) ) {
throw new BadMethodCallException(
sprintf(
/* translators: %s: template tag name */
__( 'The template tag %s does not exist.', 'kadence' ),
'kadence()->' . $method . '()'
)
);
}
return call_user_func_array( $this->template_tags[ $method ]['callback'], $args );
}
/**
* Sets template tags for a given theme templating component.
*
* @param Templating_Component_Interface $component Theme templating component.
*
* @throws InvalidArgumentException Thrown when one of the template tags is invalid.
* @throws RuntimeException Thrown when one of the template tags conflicts with an existing one.
*/
protected function set_template_tags( Templating_Component_Interface $component ) {
$tags = $component->template_tags();
foreach ( $tags as $method_name => $callback ) {
if ( is_callable( $callback ) ) {
$callback = [ 'callback' => $callback ];
}
if ( ! is_array( $callback ) || ! isset( $callback['callback'] ) ) {
throw new InvalidArgumentException(
sprintf(
/* translators: 1: template tag method name, 2: component class name */
__( 'The template tag method %1$s registered by theme component %2$s must either be a callable or an array.', 'kadence' ),
$method_name,
get_class( $component )
)
);
}
if ( isset( $this->template_tags[ $method_name ] ) ) {
throw new RuntimeException(
sprintf(
/* translators: 1: template tag method name, 2: component class name */
__( 'The template tag method %1$s registered by theme component %2$s conflicts with an already registered template tag of the same name.', 'kadence' ),
$method_name,
get_class( $component )
)
);
}
$this->template_tags[ $method_name ] = $callback;
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* Kadence\Templating_Component_Interface interface
*
* @package kadence
*/
namespace Kadence;
/**
* Interface for a theme component that exposes template tags.
*/
interface Templating_Component_Interface {
/**
* Gets template tags to expose as methods on the Template_Tags class instance, accessible through `kadence()`.
*
* @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be
* a callable or an array with key 'callable'. This approach is used to reserve the possibility of
* adding support for further arguments in the future.
*/
public function template_tags() : array;
}

View File

@@ -0,0 +1,653 @@
<?php
/**
* Kadence\The_Events_Calendar\Component class
*
* @package kadence
*/
namespace Kadence\The_Events_Calendar;
use Kadence\Component_Interface;
use Kadence\Kadence_CSS;
use Kadence_Blocks_Frontend;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function apply_filters;
use function get_template_part;
use function tribe_get_events_link;
use function tribe_get_event_label_plural;
/**
* Class for adding The_Events_Calendar plugin support.
*/
class Component implements Component_Interface {
/**
* Associative array of Google Fonts to load.
*
* Do not access this property directly, instead use the `get_google_fonts()` method.
*
* @var array
*/
protected static $google_fonts = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'the_events_calendar';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'kadence_tribe_events_before_main_tag', array( $this, 'tribe_wapper_before' ) );
add_action( 'kadence_tribe_events_after_main_tag', array( $this, 'tribe_wapper_after' ) );
add_action( 'kadence_tribe_archive_events_before_template', array( $this, 'tribe_archive_wapper_before' ), 5 );
add_action( 'kadence_tribe_archive_events_after_template', array( $this, 'tribe_archive_wapper_after' ) );
add_action( 'kadence_tribe_events_header', array( $this, 'tribe_event_title_area' ), 10, 2 );
add_filter( 'kadence_dynamic_css', array( $this, 'dynamic_css' ), 20 );
add_action( 'wp_head', array( $this, 'frontend_gfonts' ), 80 );
add_action( 'wp_enqueue_scripts', array( $this, 'tribe_styles' ), 60 );
add_filter( 'kadence_theme_options_defaults', array( $this, 'add_option_defaults' ) );
add_filter( 'tribe_default_events_block_single_classes', array( $this, 'events_template_classes' ) );
}
/**
* Add event template classes.
*
* @param array $classes template classes.
* @return array
*/
public function events_template_classes( $classes ) {
$classes[] = 'entry';
$classes[] = 'content-bg';
return $classes;
}
/**
* Generates the dynamic css based on customizer options.
*
* @param string $css any custom css.
* @return string
*/
public function dynamic_css( $css ) {
$generated_css = $this->generate_events_css();
if ( ! empty( $generated_css ) ) {
$css .= "\n/* Kadence Events CSS */\n" . $generated_css;
}
return $css;
}
/**
* Generates the dynamic css based on page options.
*
* @return string
*/
public function generate_events_css() {
$css = new Kadence_CSS();
$media_query = array();
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
$css->set_selector( ':root' );
$css->add_property( '--tec-color-background-events', 'transparent' );
$css->add_property( '--tec-color-text-event-date', 'var(--global-palette3)' );
$css->add_property( '--tec-color-text-event-title', 'var(--global-palette3)' );
$css->add_property( '--tec-color-text-events-title', 'var(--global-palette3)' );
$css->add_property( '--tec-color-background-view-selector-list-item-hover', 'var(--global-palette7)' );
$css->add_property( '--tec-color-background-secondary', 'var(--global-palette8)' );
$css->add_property( '--tec-color-link-primary', 'var(--global-palette3)' );
$css->add_property( '--tec-color-icon-active', 'var(--global-palette3)' );
$css->add_property( '--tec-color-day-marker-month', 'var(--global-palette4)' );
$css->add_property( '--tec-color-border-active-month-grid-hover', 'var(--global-palette5)' );
$css->add_property( '--tec-color-accent-primary', 'var(--global-palette1)' );
$css->add_property( '--tec-color-border-default', 'var(--global-gray-400)' );
// Events Hero Title Area.
$css->set_selector( '.tribe_events-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'tribe_events_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'tribe_events_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'tribe_events_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.tribe_events-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'tribe_events_title_height' ), 'desktop' ) );
$css->set_selector( '.tribe_events-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'tribe_events_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.tribe_events-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'tribe_events_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'tribe_events_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'tribe_events_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.tribe_events-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'tribe_events_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.tribe_events-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'tribe_events_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'tribe_events_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'tribe_events_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.tribe_events-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'tribe_events_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Events Title Font.
$css->set_selector( '.single-tribe_events #inner-wrap .tribe_events-title h1' );
$css->render_font( kadence()->option( 'tribe_events_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.single-tribe_events #inner-wrap .tribe_events-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.single-tribe_events #inner-wrap .tribe_events-title h1' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Events Title Breadcrumbs.
$css->set_selector( '.tribe_events-title .kadence-breadcrumbs' );
$css->render_font( kadence()->option( 'tribe_events_title_breadcrumb_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'tribe_events_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.tribe_events-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'tribe_events_title_breadcrumb_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.tribe_events-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.tribe_events-title .kadence-breadcrumbs' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_breadcrumb_font' ), 'mobile' ) );
$css->stop_media_query();
// Events Title Back Link.
$css->set_selector( '.tribe_events-title .tribe-events-back a' );
$css->render_font( kadence()->option( 'tribe_events_title_back_link_font' ), $css );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'tribe_events_title_back_link_color', 'color' ) ) );
$css->set_selector( '.tribe_events-title .tribe-events-back a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'tribe_events_title_back_link_color', 'hover' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.tribe_events-title .tribe-events-back a' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_back_link_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_back_link_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_back_link_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.tribe_events-title .tribe-events-back a' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'tribe_events_title_back_link_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'tribe_events_title_back_link_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'tribe_events_title_back_link_font' ), 'mobile' ) );
$css->stop_media_query();
// Single Event Backgrounds.
$css->set_selector( 'body.single-tribe_events' );
$css->render_background( kadence()->sub_option( 'tribe_events_background', 'desktop' ), $css );
$css->set_selector( 'body.single-tribe_events .content-bg, body.content-style-unboxed.single-tribe_events .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.single-tribe_events' );
$css->render_background( kadence()->sub_option( 'tribe_events_background', 'tablet' ), $css );
$css->set_selector( 'body.single-tribe_events .content-bg, body.content-style-unboxed.single-tribe_events .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.single-tribe_events' );
$css->render_background( kadence()->sub_option( 'tribe_events_background', 'mobile' ), $css );
$css->set_selector( 'body.single-tribe_events .content-bg, body.content-style-unboxed.single-tribe_events .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Events Backgrounds.
$css->set_selector( 'body.post-type-archive-tribe_events .site, body.post-type-archive-tribe_events.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_archive_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.post-type-archive-tribe_events .site, body.post-type-archive-tribe_events.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_archive_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.post-type-archive-tribe_events .site, body.post-type-archive-tribe_events.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'tribe_events_archive_content_background', 'mobile' ), $css );
$css->stop_media_query();
$new_styles = [];
$css->set_selector( '#primary .tribe-events, #primary .tribe-events-single' );
// Events Bar.
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'events_bar_text_color' ) ) {
$text_color = $this->get_tribe_option( 'tec_events_bar', 'events_bar_text_color' );
// Text color.
if ( ! empty( $text_color ) ) {
$css->add_property( '--tec-color-text-events-bar-input', $text_color);
$css->add_property( '--tec-color-text-events-bar-input-placeholder', $text_color);
$css->add_property( '--tec-color-text-view-selector-list-item', $text_color);
$css->add_property( '--tec-color-text-view-selector-list-item-hover', $text_color);
}
}
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'find_events_button_text_color' ) ) {
$button_text_color = $this->get_tribe_option( 'tec_events_bar', 'find_events_button_text_color' );
if ( ! empty( $button_text_color ) ) {
$css->add_property( '--tec-color-text-events-bar-submit-button', $button_text_color);
}
}
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'events_bar_icon_color_choice' ) ) {
if ( 'custom' === $this->get_tribe_option( 'tec_events_bar', 'events_bar_icon_color_choice' ) ) {
$icon_color = $this->get_tribe_option( 'tec_events_bar', 'events_bar_icon_color' );
} elseif (
'accent' === $this->get_tribe_option( 'tec_events_bar', 'events_bar_icon_color_choice' )
&& $this->should_include_tribe_setting_css( 'global_elements', 'accent_color' )
) {
$icon_color = $this->get_tribe_option( 'global_elements', 'accent_color' );
}
if ( ! empty( $icon_color ) ) {
$css->add_property( '--tec-color-icon-events-bar', $icon_color);
$css->add_property( '--tec-color-icon-events-bar-hover', $icon_color);
$css->add_property( '--tec-color-icon-events-bar-active', $icon_color);
}
}
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'find_events_button_color_choice' ) ) {
$button_color = $this->get_tribe_option( 'tec_events_bar', 'find_events_button_color' );
$button_color_rgb = $css->hex2rgb( $button_color );
} elseif ( $this->should_include_tribe_setting_css( 'global_elements', 'accent_color' ) ) {
$button_color = $this->get_tribe_option( 'global_elements', 'accent_color' );
$button_color_rgb = $css->hex2rgb( $button_color );
}
if ( ! empty( $button_color ) ) {
$css->add_property( '--tec-color-background-events-bar-submit-button', $button_color);
//$new_styles[] = "--tec-color-background-events-bar-submit-button: {$button_color};";
}
if ( ! empty( $button_color_rgb ) ) {
$css->add_property( '--tec-color-background-events-bar-submit-button-hover', 'rgba( ' . $button_color_rgb . ', 0.8)');
$css->add_property( '--tec-color-background-events-bar-submit-button-active', 'rgba( ' . $button_color_rgb . ', 0.9)');
}
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'events_bar_background_color_choice' ) ) {
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'events_bar_background_color' ) ) {
if ( 'custom' == $this->get_tribe_option( 'tec_events_bar', 'events_bar_background_color_choice' ) ) {
$background_color = $this->get_tribe_option( 'tec_events_bar', 'events_bar_background_color' );
} elseif (
'global_background' == $this->get_tribe_option( 'tec_events_bar', 'events_bar_background_color_choice' )
&& $this->should_include_tribe_setting_css( 'global_elements', 'background_color' )
) {
$background_color = $this->get_tribe_option( 'global_elements', 'background_color' );
}
}
if ( ! empty( $background_color ) ) {
$css->add_property( '--tec-color-background-events-bar', $background_color);
$css->add_property( '--tec-color-background-events-bar-tabs', $background_color);
}
}
if ( $this->should_include_tribe_setting_css( 'tec_events_bar', 'events_bar_border_color_choice' ) ) {
$border_color = $this->get_tribe_option( 'tec_events_bar', 'events_bar_border_color' );
if ( ! empty( $border_color ) ) {
$css->add_property( '--tec-color-border-events-bar', $border_color);
}
}
// Event Title overrides.
if ( $this->should_include_tribe_setting_css( 'global_elements', 'event_title_color' ) ) {
$title_color = $this->get_tribe_option( 'global_elements', 'event_title_color' );
$css->add_property( '--tec-color-text-events-title', $title_color);
$css->add_property( '--tec-color-text-event-title', $title_color);
}
if (
$this->should_include_tribe_setting_css( 'month_view', 'multiday_event_bar_color_choice' )
&& $this->should_include_tribe_setting_css( 'month_view', 'multiday_event_bar_color' )
) {
$bar_color = $this->get_tribe_option( 'month_view', 'multiday_event_bar_color' );
$bar_color_rgb = $css->hex2rgb( $bar_color );
$css->add_property( '--tec-color-background-primary-multiday', 'rgba( ' . $bar_color_rgb . ', 0.24)');
$css->add_property( '--tec-color-background-primary-multiday-hover', 'rgba( ' . $bar_color_rgb . ', 0.34)');
$css->add_property( '--tec-color-background-primary-multiday-active', 'rgba( ' . $bar_color_rgb . ', 0.34)');
$css->add_property( '--tec-color-background-secondary-multiday', 'rgba( ' . $bar_color_rgb . ', 0.24)');
$css->add_property( '--tec-color-background-secondary-multiday-hover', 'rgba( ' . $bar_color_rgb . ', 0.34)');
}
if ( $this->should_include_tribe_setting_css( 'month_view', 'date_marker_color' ) ) {
$date_marker_color = $this->get_tribe_option( 'month_view', 'date_marker_color' );
$css->add_property( '--tec-color-day-marker-month', $date_marker_color);
$css->add_property( '--tec-color-day-marker-past-month', $date_marker_color);
}
if ( $this->should_include_tribe_setting_css( 'month_view', 'days_of_week_color' ) ) {
$days_of_week_color = $this->get_tribe_option( 'month_view', 'days_of_week_color' );$css->add_property( '--tec-color-text-day-of-week-month', $days_of_week_color);
}
self::$google_fonts = $css->fonts_output();
return $css->css_output();
}
/**
* Function to simplify getting an option value.
*
* @since 4.13.3
*
* @param string $setting The setting slug, like 'grid_lines_color'.
*
* @return string The setting value;
*/
public function get_tribe_option( $section, $setting ) {
if ( empty( $setting ) || empty( $section ) ) {
return '';
}
if ( ! function_exists( 'tribe' ) ) {
return '';
}
return tribe( 'customizer' )->get_option( array( $section, $setting ) );
}
/**
* Check if a setting should be included in the CSS output by making sure it's not the default.
*
* @param string $section_slug The slug for the section.
* @param string $setting The setting slug.
*
* @return boolean If the setting should be added to the style template.
*/
public function should_include_tribe_setting_css( $section_slug, $setting ) {
if ( empty( $setting ) || empty( $section_slug ) ) {
return false;
}
if ( ! function_exists( 'tribe' ) ) {
return false;
}
$setting_value = tribe( 'customizer' )->get_option( array( $section_slug, $setting ) );
$section = tribe( 'customizer' )->get_section( $section_slug );
// Something has gone wrong and we can't get the section.
if ( false === $section ) {
return false;
}
return ! empty( $setting_value ) && $section->get_default( $setting ) !== $setting_value;
}
/**
* Outputs the theme wrappers.
*/
public function tribe_event_title_area( $area = 'normal', $template_class = null ) {
$enable = kadence()->option( 'tribe_events_title' );
if ( ! $enable ) {
return;
}
$placement = kadence()->option( 'tribe_events_title_layout' );
if ( $area !== $placement ) {
return;
}
if ( 'normal' === $area ) {
if ( ! kadence()->show_in_content_title() ) {
return;
}
$classes = array();
$classes[] = 'entry-header';
$classes[] = 'tribe_events-title';
$classes[] = 'title-align-' . ( kadence()->sub_option( 'tribe_events_title_align', 'desktop' ) ? kadence()->sub_option( 'tribe_events_title_align', 'desktop' ) : 'inherit' );
$classes[] = 'title-tablet-align-' . ( kadence()->sub_option( 'tribe_events_title_align', 'tablet' ) ? kadence()->sub_option( 'tribe_events_title_align', 'tablet' ) : 'inherit' );
$classes[] = 'title-mobile-align-' . ( kadence()->sub_option( 'tribe_events_title_align', 'mobile' ) ? kadence()->sub_option( 'tribe_events_title_align', 'mobile' ) : 'inherit' );
?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php
}
$elements = kadence()->option( 'tribe_events_title_elements' );
if ( isset( $elements ) && is_array( $elements ) && ! empty( $elements ) ) {
foreach ( $elements as $item ) {
if ( kadence()->sub_option( 'tribe_events_title_element_' . $item, 'enabled' ) ) {
switch ( $item ) {
case 'breadcrumb':
$template = apply_filters( 'kadence_title_elements_template_path', 'template-parts/title/' . $item, $item, $area );
get_template_part( $template );
break;
case 'back_link':
if ( null !== $template_class & is_object( $template_class ) ) {
$template_class->template( 'single-event/back-link' );
} else {
$template = apply_filters( 'kadence_title_elements_template_path', 'template-parts/title/' . $item, $item, $area );
get_template_part( $template );
}
break;
case 'title':
do_action( 'kadence_single_before_entry_title' );
if ( null !== $template_class & is_object( $template_class ) ) {
$template_class->template( 'single-event/title' );
} else {
the_title( '<h1 class="entry-title tribe-events-single-event-title">', '</h1>' );
}
do_action( 'kadence_single_after_entry_title' );
break;
default:
# code...
break;
}
}
}
}
if ( 'normal' === $area ) {
?>
</div>
<?php
}
}
/**
* Add Defaults
*
* @access public
* @param array $defaults registered option defaults with kadence theme.
* @return array
*/
public function add_option_defaults( $defaults ) {
// event.
$event_addons = array(
'tribe_events_title' => true,
'tribe_events_title_layout' => 'normal',
'tribe_events_title_inner_layout' => 'standard',
'tribe_events_title_height' => array(
'size' => array(
'mobile' => '',
'tablet' => '',
'desktop' => '',
),
'unit' => array(
'mobile' => 'px',
'tablet' => 'px',
'desktop' => 'px',
),
),
'tribe_events_title_font' => array(
'size' => array(
'desktop' => '',
),
'lineHeight' => array(
'desktop' => '',
),
'family' => 'inherit',
'google' => false,
'weight' => '',
'variant' => '',
'color' => '',
),
'tribe_events_layout' => 'narrow',
'tribe_events_content_style' => 'boxed',
'tribe_events_vertical_padding' => 'show',
'tribe_events_sidebar_id' => 'sidebar-primary',
'tribe_events_title_elements' => array( 'breadcrumb', 'back_link', 'title' ),
'tribe_events_title_element_title' => array(
'enabled' => true,
),
'tribe_events_title_element_breadcrumb' => array(
'enabled' => false,
'show_title' => true,
),
'tribe_events_title_element_back_link' => array(
'enabled' => true,
),
'tribe_events_background' => '',
'tribe_events_content_background' => '',
'tribe_events_title_background' => array(
'desktop' => array(
'color' => '',
),
),
'tribe_events_title_featured_image' => false,
'tribe_events_title_overlay_color' => array(
'color' => '',
),
'tribe_events_title_top_border' => array(),
'tribe_events_title_bottom_border' => array(),
'tribe_events_title_align' => array(
'mobile' => '',
'tablet' => '',
'desktop' => '',
),
'tribe_events_title_breadcrumb_color' => array(
'color' => '',
'hover' => '',
),
'tribe_events_title_breadcrumb_font' => array(
'size' => array(
'desktop' => '',
),
'lineHeight' => array(
'desktop' => '',
),
'family' => 'inherit',
'google' => false,
'weight' => '',
'variant' => '',
),
'tribe_events_title_back_link_color' => array(
'color' => '',
'hover' => '',
),
'tribe_events_title_back_link_font' => array(
'size' => array(
'desktop' => '',
),
'lineHeight' => array(
'desktop' => '',
),
'family' => 'inherit',
'google' => false,
'weight' => '',
'variant' => '',
),
'tribe_events_archive_title' => false,
'tribe_events_archive_title_layout' => 'normal',
'tribe_events_archive_layout' => 'normal',
'tribe_events_archive_sidebar_id' => 'sidebar-primary',
'tribe_events_archive_content_style' => 'unboxed',
'tribe_events_archive_vertical_padding' => 'show',
'transparent_header_tribe_events_archive' => true,
);
$defaults = array_merge(
$defaults,
$event_addons
);
return $defaults;
}
/**
* Outputs the theme wrappers.
*/
public function tribe_archive_wapper_before() {
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<?php
}
/**
* Outputs the theme wrappers.
*/
public function tribe_archive_wapper_after() {
get_sidebar();
?>
</div>
</div>
<?php
}
/**
* Outputs the theme wrappers.
*/
public function tribe_wapper_before() {
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<?php
}
/**
* Outputs the theme wrappers.
*/
public function tribe_wapper_after() {
get_sidebar();
?>
</div>
</div>
<?php
}
/**
* Add some css styles for Tribe Events
*/
public function tribe_styles() {
wp_enqueue_style( 'kadence-tribe', get_theme_file_uri( '/assets/css/tribe-events.min.css' ), array(), KADENCE_VERSION );
}
/**
* Enqueue Frontend Fonts
*/
public function frontend_gfonts() {
if ( empty( self::$google_fonts ) ) {
return;
}
if ( class_exists( 'Kadence_Blocks_Frontend' ) ) {
$ktblocks_instance = Kadence_Blocks_Frontend::get_instance();
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $ktblocks_instance::$gfonts ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$ktblocks_instance::$gfonts[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $ktblocks_instance::$gfonts[ $key ]['fontvariants'], true ) ) {
array_push( $ktblocks_instance::$gfonts[ $key ]['fontvariants'], $variant );
}
}
}
}
} else {
add_filter( 'kadence_theme_google_fonts_array', array( $this, 'filter_in_fonts' ) );
}
}
/**
* Filters in pro fronts for output with free.
*
* @param array $font_array any custom css.
* @return array
*/
public function filter_in_fonts( $font_array ) {
// Enqueue Google Fonts.
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $font_array ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$font_array[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $font_array[ $key ]['fontvariants'], true ) ) {
array_push( $font_array[ $key ]['fontvariants'], $variant );
}
}
}
}
return $font_array;
}
}

View File

@@ -0,0 +1,130 @@
<?php
/**
* Kadence\Third_Party\Component class
*
* @package kadence
*/
namespace Kadence\Third_Party;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function get_template_part;
/**
* Class for integrating with the block Third_Party.
*
* @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug(): string {
return 'third_party';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
// WeDocs.
remove_action( 'wedocs_before_main_content', 'wedocs_template_wrapper_start' );
remove_action( 'wedocs_after_main_content', 'wedocs_template_wrapper_end' );
add_action( 'wedocs_before_main_content', [ $this, 'output_content_wrapper' ] );
add_action( 'wedocs_after_main_content', [ $this, 'output_content_wrapper_end' ] );
add_action( 'kadence_gallery_post_before', [ $this, 'output_content_wrapper' ] );
add_action( 'kadence_gallery_post_after', [ $this, 'output_content_wrapper_end' ] );
add_action( 'kadence_gallery_post_before_content', [ $this, 'output_content_inner' ] );
add_action( 'kadence_gallery_post_after_content', [ $this, 'output_content_inner_end' ] );
add_filter( 'kadence_gallery_single_show_title', '__return_false' );
add_action( 'kadence_gallery_album_before', [ $this, 'output_content_wrapper' ] );
add_action( 'kadence_gallery_album_after', [ $this, 'output_content_wrapper_end' ] );
add_action( 'kadence_gallery_album_before_content', [ $this, 'output_archive_content_inner' ] );
add_action( 'kadence_gallery_album_after_content', [ $this, 'output_content_inner_end' ] );
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner() {
if ( kadence()->show_feature_above() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
?>
<div class="entry-content-wrap">
<?php
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/entry_header', get_post_type() );
}
if ( kadence()->show_feature_below() ) {
get_template_part( 'template-parts/content/entry_thumbnail', get_post_type() );
}
}
/**
* Adds theme output Wrapper.
*/
public function output_content_inner_end() {
?>
</div>
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_archive_content_inner() {
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_archive_content' );
if ( kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
?>
<div id="archive-container" class="content-wrap">
<?php
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
?>
<div id="primary" class="content-area">
<div class="content-container site-container">
<div id="main" class="site-main">
<?php
/**
* Hook for anything before main content
*/
do_action( 'kadence_before_main_content' );
?>
<div class="content-wrap">
<?php
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
/**
* Hook for anything after main content
*/
do_action( 'kadence_after_main_content' );
?>
</div><!-- #main -->
<?php
get_sidebar();
?>
</div>
</div><!-- #primary -->
<?php
}
}

View File

@@ -0,0 +1,476 @@
<?php
/**
* Kadence\TutorLMS\Component class
*
* @package kadence
*/
namespace Kadence\TutorLMS;
use Kadence\Kadence_CSS;
use Kadence\Component_Interface;
use Kadence_Blocks_Frontend;
use function Kadence\kadence;
use function add_action;
use function add_filter;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
/**
* Class for adding TutorLMS plugin support.
*/
class Component implements Component_Interface {
/**
* Associative array of Google Fonts to load.
*
* Do not access this property directly, instead use the `get_google_fonts()` method.
*
* @var array
*/
protected static $google_fonts = array();
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'tutorlms';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'tutorlms_styles' ), 60 );
add_filter( 'kadence_theme_options_defaults', array( $this, 'add_option_defaults' ) );
add_filter( 'kadence_dynamic_css', array( $this, 'dynamic_css' ), 20 );
add_action( 'wp_head', array( $this, 'frontend_gfonts' ), 80 );
add_filter( 'body_class', array( $this, 'filter_body_classes' ) );
// Courses.
// Outer Wrap.
add_action( 'tutor_course/single/before/wrap', array( $this, 'output_course_content_wrapper' ) );
add_action( 'tutor_course/single/after/wrap', array( $this, 'output_course_content_wrapper_end' ) );
add_action( 'tutor_course/single/enrolled/before/wrap', array( $this, 'output_course_content_wrapper_enrolled' ) );
add_action( 'tutor_course/single/enrolled/after/wrap', array( $this, 'output_course_content_wrapper_end' ) );
// Inner.
add_action( 'tutor_course/single/before/inner-wrap', array( $this, 'output_inner_content_wrapper' ) );
add_action( 'tutor_course/single/after/inner-wrap', array( $this, 'output_inner_content_wrapper_end' ) );
add_action( 'tutor_course/single/enrolled/before/inner-wrap', array( $this, 'output_inner_content_wrapper_enrolled' ) );
add_action( 'tutor_course/single/enrolled/after/inner-wrap', array( $this, 'output_inner_content_wrapper_end' ), 80 );
// Pages.
add_action( 'tutor_dashboard/before/wrap', array( $this, 'output_content_wrapper' ) );
add_action( 'tutor_dashboard/after/wrap', array( $this, 'output_content_wrapper_end' ) );
add_action( 'tutor_student/before/wrap', array( $this, 'output_content_wrapper' ) );
add_action( 'tutor_student/after/wrap', array( $this, 'output_content_wrapper_end' ) );
add_action( 'tutor_course/archive/before/wrap', array( $this, 'output_content_wrapper' ) );
add_action( 'tutor_course/archive/after/wrap', array( $this, 'output_content_wrapper_end' ) );
}
/**
* Outputs the above header tutor lead.
*/
public function header_lead_enrolled() {
get_template_part( 'tutor/single/course/enrolled/above-lead-info' );
}
/**
* Outputs the tutor lead.
*/
public function header_lead() {
if ( defined( 'TUTOR_VERSION' ) && version_compare( TUTOR_VERSION, '2.0.0' ) >= 0 ) {
$is_enrolled = tutor_utils()->is_enrolled();
( isset( $is_enrolled ) && $is_enrolled ) ? tutor_course_enrolled_lead_info() : tutor_course_lead_info();
// remove normal Lead template.
add_filter( 'should_tutor_load_template', array( $this, 'remove_lead_template' ), 10, 3 );
} else {
get_template_part( 'tutor/single/course/lead-info' );
}
}
/**
* Removes the content.
*
* @param bool $load if the template should load.
* @param string $template the name of the template.
* @param array $variables for the template.
*/
public function remove_lead_template( $load, $template, $variables ) {
if ( 'single.course.enrolled.lead-info' === $template || 'single.course.lead-info' === $template ) {
$load = false;
}
return $load;
}
/**
* Adds theme output Inner Wrapper.
*/
public function output_inner_content_wrapper_enrolled() {
echo '<div class="entry content-bg single-entry"><div class="entry-content-wrap">';
if ( 'above' === kadence()->option( 'courses_title_layout' ) ) {
// remove normal Lead template.
add_filter( 'should_tutor_load_template', array( $this, 'remove_lead_template' ), 10, 3 );
// Add content lead template.
if ( defined( 'TUTOR_VERSION' ) && ! ( version_compare( TUTOR_VERSION, '2.0.0' ) >= 0 ) ) {
get_template_part( 'tutor/single/course/enrolled/content-lead-info' );
}
}
}
/**
* Adds theme output Inner Wrapper.
*/
public function output_inner_content_wrapper() {
echo '<div class="entry content-bg single-entry"><div class="entry-content-wrap">';
if ( 'above' === kadence()->option( 'courses_title_layout' ) ) {
// remove normal Lead template.
add_filter( 'should_tutor_load_template', array( $this, 'remove_lead_template' ), 10, 3 );
// Add content lead template.
if ( defined( 'TUTOR_VERSION' ) && ! ( version_compare( TUTOR_VERSION, '2.0.0' ) >= 0 ) ) {
get_template_part( 'tutor/single/course/content-lead-info' );
}
}
}
/**
* Adds theme output Inner Wrapper.
*/
public function output_inner_content_wrapper_end() {
echo '</div></div>';
}
/**
* Adds theme output Wrapper enrolled.
*/
public function output_course_content_wrapper_enrolled() {
kadence()->print_styles( 'kadence-content' );
remove_action( 'kadence_entry_hero', 'Kadence\kadence_entry_header', 10, 2 );
add_action( 'kadence_entry_hero', array( $this, 'header_lead_enrolled' ), 10, 2 );
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
echo '<div id="primary" class="content-area"><div class="content-container site-container"><main id="main" class="site-main" role="main">';
}
/**
* Adds theme output Wrapper.
*/
public function output_course_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
remove_action( 'kadence_entry_hero', 'Kadence\kadence_entry_header', 10, 2 );
add_action( 'kadence_entry_hero', array( $this, 'header_lead' ), 10, 2 );
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
echo '<div id="primary" class="content-area"><div class="content-container site-container"><main id="main" class="site-main" role="main">';
}
/**
* Adds theme end output Wrapper.
*/
public function output_course_content_wrapper_end() {
echo '</main></div></div>';
}
/**
* Adds theme output Wrapper.
*/
public function output_content_wrapper() {
kadence()->print_styles( 'kadence-content' );
if ( is_archive() ) {
/**
* Hook for Hero Section
*/
do_action( 'kadence_hero_header' );
}
echo '<div id="primary" class="content-area"><div class="content-container site-container"><main id="main" class="site-main" role="main">';
if ( is_archive() && kadence()->show_in_content_title() ) {
get_template_part( 'template-parts/content/archive_header' );
}
}
/**
* Adds theme end output Wrapper.
*/
public function output_content_wrapper_end() {
echo '</main>';
if ( is_archive() ) {
get_sidebar();
}
echo '</div></div>';
}
/**
* Add some css styles for tutorlms
*/
public function tutorlms_styles() {
wp_enqueue_style( 'kadence-tutorlms', get_theme_file_uri( '/assets/css/tutorlms.min.css' ), array(), KADENCE_VERSION );
}
/**
* Add Defaults
*
* @access public
* @param array $defaults registered option defaults with kadence theme.
* @return array
*/
public function add_option_defaults( $defaults ) {
// Tutor.
$tutor_addons = array(
'courses_title_layout' => 'normal',
'courses_title_inner_layout' => 'standard',
'courses_title_align' => 'left',
'courses_enroll_overlay' => true,
'courses_title_height' => array(
'size' => array(
'mobile' => '',
'tablet' => '',
'desktop' => 375,
),
'unit' => array(
'mobile' => 'px',
'tablet' => 'px',
'desktop' => 'px',
),
),
'courses_title_font' => array(
'size' => array(
'desktop' => '',
),
'lineHeight' => array(
'desktop' => '',
),
'family' => 'inherit',
'google' => false,
'weight' => '',
'variant' => '',
'color' => '',
),
'courses_layout' => 'right',
'courses_content_style' => 'boxed',
'courses_vertical_padding' => 'show',
'courses_archive_title' => true,
'courses_archive_title_layout' => 'above',
'courses_archive_layout' => 'normal',
'courses_archive_sidebar_id' => 'sidebar-primary',
'courses_archive_content_style' => 'unboxed',
'courses_archive_vertical_padding' => 'show',
'courses_archive_title_inner_layout' => 'standard',
'courses_archive_title_elements' => array( 'breadcrumb', 'title' ),
'courses_archive_title_element_title' => array(
'enabled' => true,
),
'courses_archive_title_element_breadcrumb' => array(
'enabled' => false,
'show_title' => true,
),
// 'courses_title_elements' => array( 'breadcrumb', 'reviews', 'title', 'meta' ),
// 'courses_title_element_title' => array(
// 'enabled' => true,
// ),
// 'courses_title_element_breadcrumb' => array(
// 'enabled' => false,
// ),
// 'courses_title_element_reviews' => array(
// 'enabled' => true,
// ),
// 'courses_title_element_meta' => array(
// 'id' => 'meta',
// 'enabled' => false,
// 'author' => true,
// 'authorImage' => true,
// 'authorEnableLabel' => true,
// 'authorLabel' => '',
// 'courseLevel' => true,
// 'courseShare' => false,
// ),
// 'header_html2_typography' => array(
// 'size' => array(
// 'desktop' => '',
// ),
// 'lineHeight' => array(
// 'desktop' => '',
// ),
// 'family' => 'inherit',
// 'google' => false,
// 'weight' => '',
// 'variant' => '',
// 'color' => '',
// ),
);
$defaults = array_merge(
$defaults,
$tutor_addons
);
return $defaults;
}
/**
* Enqueue Frontend Fonts
*/
public function frontend_gfonts() {
if ( empty( self::$google_fonts ) ) {
return;
}
if ( class_exists( 'Kadence_Blocks_Frontend' ) ) {
$ktblocks_instance = Kadence_Blocks_Frontend::get_instance();
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $ktblocks_instance::$gfonts ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$ktblocks_instance::$gfonts[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $ktblocks_instance::$gfonts[ $key ]['fontvariants'], true ) ) {
array_push( $ktblocks_instance::$gfonts[ $key ]['fontvariants'], $variant );
}
}
}
}
} else {
add_filter( 'kadence_theme_google_fonts_array', array( $this, 'filter_in_fonts' ) );
}
}
/**
* Filters in pro fronts for output with free.
*
* @param array $font_array any custom css.
* @return array
*/
public function filter_in_fonts( $font_array ) {
// Enqueue Google Fonts.
foreach ( self::$google_fonts as $key => $font ) {
if ( ! array_key_exists( $key, $font_array ) ) {
$add_font = array(
'fontfamily' => $font['fontfamily'],
'fontvariants' => ( isset( $font['fontvariants'] ) && ! empty( $font['fontvariants'] ) && is_array( $font['fontvariants'] ) ? $font['fontvariants'] : array() ),
'fontsubsets' => ( isset( $font['fontsubsets'] ) && ! empty( $font['fontsubsets'] ) && is_array( $font['fontsubsets'] ) ? $font['fontsubsets'] : array() ),
);
$font_array[ $key ] = $add_font;
} else {
foreach ( $font['fontvariants'] as $variant ) {
if ( ! in_array( $variant, $font_array[ $key ]['fontvariants'], true ) ) {
array_push( $font_array[ $key ]['fontvariants'], $variant );
}
}
}
}
return $font_array;
}
/**
* Generates the dynamic css based on customizer options.
*
* @param string $css any custom css.
* @return string
*/
public function dynamic_css( $css ) {
$generated_css = $this->generate_tutor_css();
if ( ! empty( $generated_css ) ) {
$css .= "\n/* Kadence Tutor CSS */\n" . $generated_css;
}
return $css;
}
/**
* Generates the dynamic css based on page options.
*
* @return string
*/
public function generate_tutor_css() {
$css = new Kadence_CSS();
$media_query = array();
$media_query['mobile'] = apply_filters( 'kadence_mobile_media_query', '(max-width: 767px)' );
$media_query['tablet'] = apply_filters( 'kadence_tablet_media_query', '(max-width: 1024px)' );
$media_query['desktop'] = apply_filters( 'kadence_desktop_media_query', '(min-width: 1025px)' );
// Above Course Title.
$css->set_selector( '.courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_title_height' ), 'desktop' ) );
$css->set_selector( '.courses-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color( kadence()->sub_option( 'courses_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.courses-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.courses-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_title_height' ), 'mobile' ) );
$css->stop_media_query();
// Course Title.
$css->set_selector( '.tutor-single-course-lead-info h1.tutor-course-header-h1, .tutor-course-details-title.tutor-fs-4' );
$css->render_font( kadence()->option( 'courses_title_font' ), $css, 'heading' );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.tutor-single-course-lead-info h1.tutor-course-header-h1, .tutor-course-details-title.tutor-fs-4' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'courses_title_font' ), 'tablet' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'courses_title_font' ), 'tablet' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'courses_title_font' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.tutor-single-course-lead-info h1.tutor-course-header-h1, .tutor-course-details-title.tutor-fs-4' );
$css->add_property( 'font-size', $css->render_font_size( kadence()->option( 'courses_title_font' ), 'mobile' ) );
$css->add_property( 'line-height', $css->render_font_height( kadence()->option( 'courses_title_font' ), 'mobile' ) );
$css->add_property( 'letter-spacing', $css->render_font_spacing( kadence()->option( 'courses_title_font' ), 'mobile' ) );
$css->stop_media_query();
// Courses Backgrounds.
$css->set_selector( 'body.post-type-archive-courses .site, body.post-type-archive-courses.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'courses_archive_content_background', 'desktop' ), $css );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( 'body.post-type-archive-courses .site, body.post-type-archive-courses.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'courses_archive_content_background', 'tablet' ), $css );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( 'body.post-type-archive-courses .site, body.post-type-archive-courses.content-style-unboxed .site' );
$css->render_background( kadence()->sub_option( 'courses_archive_content_background', 'mobile' ), $css );
$css->stop_media_query();
// Events Hero Title Area.
$css->set_selector( '.courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_archive_title_background', 'desktop' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_archive_title_top_border', 'desktop' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_archive_title_bottom_border', 'desktop' ) ) );
$css->set_selector( '.entry-hero.courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_archive_title_height' ), 'desktop' ) );
$css->set_selector( '.courses-archive-hero-section .hero-section-overlay' );
$css->add_property( 'background', $css->render_color_or_gradient( kadence()->sub_option( 'courses_archive_title_overlay_color', 'color' ) ) );
$css->start_media_query( $media_query['tablet'] );
$css->set_selector( '.courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_archive_title_background', 'tablet' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_archive_title_top_border', 'tablet' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_archive_title_bottom_border', 'tablet' ) ) );
$css->set_selector( '.entry-hero.courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_archive_title_height' ), 'tablet' ) );
$css->stop_media_query();
$css->start_media_query( $media_query['mobile'] );
$css->set_selector( '.courses-archive-hero-section .entry-hero-container-inner' );
$css->render_background( kadence()->sub_option( 'courses_archive_title_background', 'mobile' ), $css );
$css->add_property( 'border-top', $css->render_border( kadence()->sub_option( 'courses_archive_title_top_border', 'mobile' ) ) );
$css->add_property( 'border-bottom', $css->render_border( kadence()->sub_option( 'courses_archive_title_bottom_border', 'mobile' ) ) );
$css->set_selector( '.entry-hero.courses-archive-hero-section .entry-header' );
$css->add_property( 'min-height', $css->render_range( kadence()->option( 'courses_archive_title_height' ), 'mobile' ) );
$css->stop_media_query();
$css->set_selector( '.wp-site-blocks .courses-archive-title h1' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'courses_archive_title_color', 'color' ) ) );
$css->set_selector( '.courses-archive-title .kadence-breadcrumbs' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'courses_archive_title_breadcrumb_color', 'color' ) ) );
$css->set_selector( '.courses-archive-title .kadence-breadcrumbs a:hover' );
$css->add_property( 'color', $css->render_color( kadence()->sub_option( 'courses_archive_title_breadcrumb_color', 'hover' ) ) );
self::$google_fonts = $css->fonts_output();
return $css->css_output();
}
/**
* Adds custom classes to indicate whether a sidebar is present to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array Filtered body classes.
*/
public function filter_body_classes( array $classes ) : array {
if ( is_singular( 'courses' ) ) {
$classes[] = 'courses-sidebar-overlay-' . ( kadence()->option( 'courses_enroll_overlay' ) ? 'true' : 'false' );
}
return $classes;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
<?php
/**
* Kadence\Zoom_Recipe_Card\Component class
*
* @package kadence
*/
namespace Kadence\Zoom_Recipe_Card;
use Kadence\Component_Interface;
use function Kadence\kadence;
use function add_action;
use function have_posts;
use function the_post;
use function is_search;
use function get_template_part;
use function get_post_type;
/**
* Class for adding Woocommerce plugin support.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'zoom_recipe_card';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_action( 'wp_enqueue_scripts', array( $this, 'zoom_recipe_card_styles' ), 60 );
add_action( 'after_setup_theme', array( $this, 'action_add_editor_styles' ) );
}
/**
* Enqueues WordPress theme styles for the editor.
*/
public function action_add_editor_styles() {
// Enqueue block editor stylesheet.
add_editor_style( 'assets/css/editor/zoom-recipe-editor-styles.min.css' );
}
/**
* Add some css styles for zoom_recipe_card
*/
public function zoom_recipe_card_styles() {
wp_enqueue_style( 'kadence-zoom-recipe-card', get_theme_file_uri( '/assets/css/zoom-recipe-card.min.css' ), array(), KADENCE_VERSION );
}
}