diff --git a/assets/js/scripts-global.js b/assets/js/scripts-global.js index 825e17e..bb0f8f4 100644 --- a/assets/js/scripts-global.js +++ b/assets/js/scripts-global.js @@ -5,7 +5,7 @@ * @copyright WebMan Design, Oliver Juhas * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 * * Contents: * @@ -63,13 +63,20 @@ // Processing - e.preventDefault(); - + // Scroll the page to top. $( 'html, body' ) .animate( { scrollTop : 0 }, 600 ); + // Reset focus on top of the page. + $( 'body' ) + .attr( 'tabindex', 0 ) + .focus(); + + // Do not alter URL in browser. + return false; + } ); } diff --git a/changelog.md b/changelog.md index 2a75173..8460ae8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,28 @@ # Reykjavik Changelog +## 1.1.0 + +* **Add**: Elementor Pro Theme Builder compatibility! +* **Fix**: Compatibility with Beaver Builder 2.1+ +* **Fix**: Beaver Themer post preview selector not working +* **Fix**: Back to top button accessibility +* **Fix**: Customizer logo partial refresh +* **Fix**: Preventing PHP error when WooCommerce shop page is not set + +### Files changed: + + changelog.md + functions.php + style.css + assets/js/scripts-global.js + includes/customize/class-customize.php + includes/plugins/beaver-builder/class-beaver-builder-assets.php + includes/plugins/beaver-themer/class-beaver-themer.php + includes/plugins/elementor/class-elementor.php + includes/plugins/elementor/elementor.php + includes/plugins/woocommerce/class-woocommerce-pages.php + + ## 1.0.8 * **Fix**: Jetpack Infinite Scroll compatibility diff --git a/functions.php b/functions.php index 737c56c..091a42b 100644 --- a/functions.php +++ b/functions.php @@ -8,7 +8,7 @@ * @copyright WebMan Design, Oliver Juhas * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 * * Contents: * @@ -187,6 +187,16 @@ require REYKJAVIK_PATH_PLUGINS . 'breadcrumb-navxt/breadcrumb-navxt.php'; } + // Elementor + + /** + * @subpackage Page Builder + * @subpackage Theme Builder + */ + if ( class_exists( '\Elementor\Plugin' ) ) { + require REYKJAVIK_PATH_PLUGINS . 'elementor/elementor.php'; + } + // One Click Demo Import if ( class_exists( 'OCDI_Plugin' ) && is_admin() ) { diff --git a/includes/customize/class-customize.php b/includes/customize/class-customize.php index 178eeda..01f4848 100644 --- a/includes/customize/class-customize.php +++ b/includes/customize/class-customize.php @@ -6,7 +6,7 @@ * @copyright WebMan Design, Oliver Juhas * * @since 1.0.0 - * @version 1.0.7 + * @version 1.1.0 * * Contents: * @@ -102,7 +102,7 @@ public static function init() { * Modify native WordPress options and setup partial refresh * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 * * @param object $wp_customize WP customizer object. */ @@ -123,7 +123,7 @@ public static function setup( $wp_customize ) { // Site title $wp_customize->selective_refresh->add_partial( 'blogname', array( - 'selector' => '.site-title-text', + 'selector' => '.site-title', 'render_callback' => __CLASS__ . '::partial_blogname', ) ); diff --git a/includes/frontend/class-post.php b/includes/frontend/class-post.php index 6b84764..844a16c 100644 --- a/includes/frontend/class-post.php +++ b/includes/frontend/class-post.php @@ -86,7 +86,7 @@ private function __construct() { add_filter( 'wmhook_reykjavik_disable_header', __CLASS__ . '::is_page_template_blank' ); add_filter( 'wmhook_reykjavik_disable_footer', __CLASS__ . '::is_page_template_blank' ); - add_filter( 'wmhook_reykjavik_title_primary_disable', __CLASS__ . '::is_page_template_blank' ); + add_filter( 'wmhook_reykjavik_title_primary_disable', __CLASS__ . '::is_page_template_blank' ); add_filter( 'wmhook_reykjavik_breadcrumb_navxt_disabled', __CLASS__ . '::is_page_template_blank' ); add_filter( 'wmhook_reykjavik_title_primary_disable', __CLASS__ . '::page_builder_primary_title', 20 ); diff --git a/includes/plugins/beaver-builder/class-beaver-builder-assets.php b/includes/plugins/beaver-builder/class-beaver-builder-assets.php index 40f98d3..cac7abb 100644 --- a/includes/plugins/beaver-builder/class-beaver-builder-assets.php +++ b/includes/plugins/beaver-builder/class-beaver-builder-assets.php @@ -6,7 +6,7 @@ * @copyright WebMan Design, Oliver Juhas * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 * * Contents: * @@ -90,24 +90,35 @@ public static function init() { * Load plugin stylesheets after the theme stylesheet * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 */ public static function late_load() { - // Processing + // Requirements check + + if ( (bool) apply_filters( 'wmhook_reykjavik_beaver_builder_assets_late_load', false ) ) { + return; + } - // Layout stylesheets - remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_all_layouts_styles_scripts' ); + // Helper variables + + $priority = 120; + $callbacks = array( + 'FLBuilder::enqueue_all_layouts_styles_scripts' => 10, + 'FLBuilder::enqueue_ui_styles_scripts' => 11, + 'FLBuilderUISettingsForms::enqueue_settings_config' => 11, + ); - add_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_all_layouts_styles_scripts', 198 ); + $order = 0; - // UI stylesheets - remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_ui_styles_scripts' ); - remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_ui_styles_scripts', 11 ); + // Processing - add_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_ui_styles_scripts', 198 ); + foreach ( $callbacks as $callback => $default_priority ) { + remove_action( 'wp_enqueue_scripts', $callback, $default_priority ); + add_action( 'wp_enqueue_scripts', $callback, $priority + $order++ ); + } } // /late_load diff --git a/includes/plugins/beaver-themer/class-beaver-themer.php b/includes/plugins/beaver-themer/class-beaver-themer.php index 0acb4b3..a9431e0 100644 --- a/includes/plugins/beaver-themer/class-beaver-themer.php +++ b/includes/plugins/beaver-themer/class-beaver-themer.php @@ -6,7 +6,7 @@ * @copyright WebMan Design, Oliver Juhas * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 * * Contents: * @@ -32,7 +32,7 @@ class Reykjavik_Beaver_Themer { * Constructor * * @since 1.0.0 - * @version 1.0.0 + * @version 1.1.0 */ private function __construct() { @@ -48,8 +48,9 @@ private function __construct() { // Actions - add_action( 'wp', __CLASS__ . '::sidebar_disable' ); + add_action( 'init', __CLASS__ . '::late_load', 900 ); + add_action( 'wp', __CLASS__ . '::sidebar_disable' ); add_action( 'wp', __CLASS__ . '::headers_footers', 999 ); // Filters @@ -89,6 +90,43 @@ public static function init() { * 10) Setup */ + /** + * Load plugin assets a bit later (see Beaver Builder compatibility) + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function late_load() { + + // Requirements check + + if ( (bool) apply_filters( 'wmhook_reykjavik_beaver_builder_assets_late_load', false ) ) { + return; + } + + + // Helper variables + + $priority = 120; + $callbacks = array( + 'FLThemeBuilderLayoutFrontendEdit::enqueue_scripts' => 11, + ); + + // Has to be enqueued after `{%= prefix_class %}_Beaver_Builder_Assets::late_load()` UI assets. + $order = 3; + + + // Processing + + foreach ( $callbacks as $callback => $default_priority ) { + remove_action( 'wp_enqueue_scripts', $callback, $default_priority ); + add_action( 'wp_enqueue_scripts', $callback, $priority + $order++ ); + } + + } // /late_load + + + /** * Custom header and footer renderer * diff --git a/includes/plugins/elementor/class-elementor.php b/includes/plugins/elementor/class-elementor.php new file mode 100644 index 0000000..e27d83f --- /dev/null +++ b/includes/plugins/elementor/class-elementor.php @@ -0,0 +1,491 @@ +register_core_location( 'header' ); + $manager->register_core_location( 'footer' ); + + } // /register_locations + + + + /** + * Setup display of custom sections + * + * @subpackage Theme Builder + * @subpackage Customize Options + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function display_setup() { + + // Helper variables + + $locations = self::get_locations(); + + + // Requirements check + + if ( empty( $locations ) ) { + return; + } + + + // Processing + + foreach ( $locations as $location => $location_args ) { + if ( self::is_location_active( $location ) ) { + switch ( $location ) { + + /** + * Site header + * + * Removing theme header, displaying the theme builder one, dequeuing header + * related assets, and disabling theme's sticky header. + */ + case 'header': + remove_all_actions( 'tha_header_top' ); + remove_all_actions( 'tha_header_bottom' ); + + add_action( 'tha_header_top', __CLASS__ . '::header' ); + + add_action( 'wp_enqueue_scripts', __CLASS__ . '::dequeue_header_scripts', 110 ); + break; + + /** + * Site footer + * + * Removing theme footer, displaying the theme builder one. + */ + case 'footer': + remove_all_actions( 'tha_footer_top' ); + remove_all_actions( 'tha_footer_bottom' ); + + add_action( 'tha_footer_top', __CLASS__ . '::footer' ); + break; + + /** + * Site content area (singulars and archives) + * + * For all the locations that are editable by Elementor in content area we need + * to remove theme content wrappers and all sections and elements hooked into + * THA content wrapper action hooks. This will also effectively remove a sidebar + * from such locations. + * + * As we do not register support for such locations (see `register_locations()` + * above), Elementor Theme Builder will take over the whole theme content area + * and display content as needed. + */ + default: + if ( $location_args['edit_in_content'] ) { + remove_all_actions( 'tha_content_before' ); + remove_all_actions( 'tha_content_top' ); + remove_all_actions( 'tha_content_bottom' ); + remove_all_actions( 'tha_content_after' ); + + // We still need to disable sidebar for correct body class. + add_filter( 'wmhook_reykjavik_sidebar_disable', '__return_true' ); + } + break; + + } + } + } + + } // /display_setup + + + + + + /** + * 30) Display + */ + + /** + * Display header + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function header() { + + // Processing + + elementor_theme_do_location( 'header' ); + + } // /header + + + + /** + * Display footer + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function footer() { + + // Processing + + elementor_theme_do_location( 'footer' ); + + } // /footer + + + + + + /** + * 40) Getters + */ + + /** + * Get theme builder instance or check if it's loaded + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + * + * @param boolean $get_instance Get theme builder instance or just check if it's loaded? + */ + public static function get_theme_builder( $get_instance = true ) { + + // Output + + if ( $get_instance ) { + return ElementorPro\Modules\ThemeBuilder\Module::instance(); + } else { + return is_callable( 'ElementorPro\Modules\ThemeBuilder\Module::instance' ); + } + + } // /get_theme_builder + + + + /** + * Get locations + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function get_locations() { + + // Output + + return self::get_theme_builder()->get_locations_manager()->get_locations(); + + } // /get_locations + + + + /** + * Get documents for specific location + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + * + * @param string $location + */ + public static function get_documents_for_location( $location = '' ) { + + // Output + + return self::get_theme_builder()->get_conditions_manager()->get_documents_for_location( $location ); + + } // /get_documents_for_location + + + + /** + * Does the location have any documents, is it active? + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + * + * @param string $location + */ + public static function is_location_active( $location = '' ) { + + // Requirements check + + if ( + function_exists( 'elementor_location_exits' ) + && ! elementor_location_exits( $location ) + ) { + return; + } + + + // Helper variables + + $documents = self::get_documents_for_location( $location ); + + + // Output + + return ! empty( $documents ); + + } // /is_location_active + + + + + + /** + * 100) Others + */ + + /** + * Dequeue theme header scripts + * + * @subpackage Theme Builder + * + * @since 1.1.0 + * @version 1.1.0 + */ + public static function dequeue_header_scripts() { + + // Processing + + wp_dequeue_script( 'reykjavik-scripts-nav-a11y' ); + wp_dequeue_script( 'reykjavik-scripts-nav-mobile' ); + + } // /dequeue_header_scripts + + + + /** + * Page builder content layout setup for Elementor templates + * + * @subpackage Theme Builder + * @subpackage Custom Fields + * + * @since 1.1.0 + * @version 1.1.0 + * + * @param null|array|string $value + * @param absint $post_id + * @param string $meta_key + */ + public static function content_layout( $value = null, $post_id = 0, $meta_key = '' ) { + + // Processing + + if ( + 'content_layout' === $meta_key + && 'elementor_library' === get_post_type( $post_id ) + ) { + return 'stretched'; + } + + + // Output + + return $value; + + } // /content_layout + + + + + +} // /Reykjavik_Elementor + +add_action( 'after_setup_theme', 'Reykjavik_Elementor::init' ); diff --git a/includes/plugins/elementor/elementor.php b/includes/plugins/elementor/elementor.php new file mode 100644 index 0000000..56133ee --- /dev/null +++ b/includes/plugins/elementor/elementor.php @@ -0,0 +1,53 @@ +__get( 'page_template' ) ) : ( '' ); // Processing if ( - in_array( $shop_page->__get( 'page_template' ), array( - 'templates/no-intro.php', - 'templates/blank.php', - ) ) - || get_post_meta( $shop_page_id, 'no_intro', true ) - ) { + in_array( $shop_page_template, array( + 'templates/no-intro.php', + 'templates/blank.php', + ) ) + || get_post_meta( $shop_page_id, 'no_intro', true ) + ) { $disable = true; } diff --git a/style.css b/style.css index e7dce22..d672d26 100644 --- a/style.css +++ b/style.css @@ -3,12 +3,12 @@ Theme Name: Reykjavik Theme URI: https://www.webmandesign.eu/portfolio/reykjavik-wordpress-theme/ Author: WebMan Design Author URI: https://www.webmandesign.eu/ -Version: 1.0.8 +Version: 1.1.0 Text Domain: reykjavik Domain Path: /languages License: GNU General Public License v3 License URI: https://www.gnu.org/licenses/gpl-3.0.html -Description: Reykjavik is fresh, lightweight, speed and SEO optimized, accessibility ready WordPress theme perfect for your next business, portfolio, blog or WooCommerce e-shop website. You can customize all elements of the theme to your needs. The theme works perfectly with Beaver Builder, Beaver Themer, Elementor, Visual Composer or other page builder to create fantastic layouts. It features mobile-optimized codebase and design with unique, easy-to-access mobile navigation. Build your website in no time with integrated one-click demo import functionality. Impress your website visitors with this beautiful free theme! More at WebMan Design (https://www.webmandesign.eu) +Description: Reykjavik is fresh, lightweight, speed and SEO optimized, accessibility ready WordPress theme perfect for your next business, portfolio, blog or WooCommerce e-shop website. You can customize all elements of the theme to your needs. The theme works perfectly with Beaver Builder, Beaver Themer, Elementor, Elementor Pro Theme Builder, Visual Composer or other page builder to create fantastic layouts. It features mobile-optimized codebase and design with unique, easy-to-access mobile navigation. Build your website in no time with integrated one-click demo import functionality. Impress your website visitors with this beautiful free theme! More at WebMan Design (https://www.webmandesign.eu) Tags: one-column, two-columns, right-sidebar, grid-layout, flexible-header, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-image-header, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, blog, e-commerce, portfolio Requires at least: 4.7