From 0f404ca2c5da292dc43f2d90c617adf9a04e45b8 Mon Sep 17 00:00:00 2001 From: NituShrestha Date: Thu, 28 Jan 2021 15:47:30 +0545 Subject: [PATCH 01/12] Add Hooks file --- inc/hooks/header.php | 0 inc/hooks/hooks.php | 1 + 2 files changed, 1 insertion(+) create mode 100644 inc/hooks/header.php create mode 100644 inc/hooks/hooks.php diff --git a/inc/hooks/header.php b/inc/hooks/header.php new file mode 100644 index 00000000..e69de29b diff --git a/inc/hooks/hooks.php b/inc/hooks/hooks.php new file mode 100644 index 00000000..b3d9bbc7 --- /dev/null +++ b/inc/hooks/hooks.php @@ -0,0 +1 @@ + Date: Fri, 29 Jan 2021 08:15:54 +0545 Subject: [PATCH 02/12] Use hook for header --- header.php | 12 ++++++++---- inc/hooks/header.php | 25 +++++++++++++++++++++++++ inc/hooks/hooks.php | 18 ++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/header.php b/header.php index ed130ce0..3127c2d3 100644 --- a/header.php +++ b/header.php @@ -19,12 +19,16 @@ > - - - diff --git a/inc/hooks/header.php b/inc/hooks/header.php index e69de29b..ef73bbe3 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -0,0 +1,25 @@ + + + + + Date: Fri, 29 Jan 2021 08:48:46 +0545 Subject: [PATCH 03/12] Use hook for before header --- header.php | 15 +++++++++++---- inc/hooks/header.php | 26 ++++++++++++++++++++++++++ inc/hooks/hooks.php | 3 +++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/header.php b/header.php index 3127c2d3..59d841d8 100644 --- a/header.php +++ b/header.php @@ -49,11 +49,18 @@ } ?> - -
- + +/** +* Functions hooked into spacious_action_before action. +* +* @hooked spacious_page_start - 10 +* @hooked spacious_skip_content_link - 15 +*/ +do_action( 'spacious_action_before' ); ?> + + + +
+ + + Date: Fri, 29 Jan 2021 09:48:12 +0545 Subject: [PATCH 04/12] Use hook for header top bar --- header.php | 48 +++++++--------------- inc/hooks/header.php | 68 ++++++++++++++++++++++++++++++++ inc/hooks/hooks.php | 8 ++++ inc/spacious-dynamic-classes.php | 35 ++++++++++++++++ 4 files changed, 126 insertions(+), 33 deletions(-) create mode 100644 inc/spacious-dynamic-classes.php diff --git a/header.php b/header.php index 59d841d8..ab4ba02b 100644 --- a/header.php +++ b/header.php @@ -57,43 +57,25 @@ * @hooked spacious_page_start - 10 * @hooked spacious_skip_content_link - 15 */ -do_action( 'spacious_action_before' ); ?> +do_action( 'spacious_action_before' ); +/* + * Hook: spacious_before_header + */ +do_action( 'spacious_before_header' ); - - - - - + + +
+
diff --git a/inc/hooks/header.php b/inc/hooks/header.php index 8b70b9cb..19b7cc81 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -129,3 +129,33 @@ function spacious_header_image_position() { } endif; + +if ( ! function_exists( 'spacious_nav_container_open' ) ) : + + function spacious_nav_container_open() { + ?> +
+ +
+ +
+ Date: Tue, 2 Feb 2021 13:13:58 +0545 Subject: [PATCH 07/12] Use hook for header left/right section --- header.php | 86 ++++--------------------------------- inc/hooks/header.php | 100 +++++++++++++++++++++++++++++++++++++++++++ inc/hooks/hooks.php | 6 +++ 3 files changed, 114 insertions(+), 78 deletions(-) diff --git a/header.php b/header.php index 319234bd..473d35d0 100644 --- a/header.php +++ b/header.php @@ -91,87 +91,17 @@ * @hooked spacious_nav_inner_wrap - 10 * @hooked spacious_nav_text_wrap - 15 */ -do_action( 'spacious_action_nav_container' ); ?> +do_action( 'spacious_action_nav_container' ); -
- -
- - -
- - - -
- -

- -

- -

- -

- -

- -
- -
-
- -
- -
- - - -
- -
- -
- -
-
- -
- - - +/** +* Functions hooked into spacious_action_header_section action. +* +* @hooked spacious_header_left_section - 10 +* @hooked spacious_header_right_section - 15 +*/ +do_action( 'spacious_action_header_section' ); ?> -
diff --git a/inc/hooks/header.php b/inc/hooks/header.php index 19b7cc81..d444abd7 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -159,3 +159,103 @@ function spacious_nav_text_wrap() { } endif; + + + +if ( ! function_exists( 'spacious_header_left_section' ) ) : + + function spacious_header_left_section() { + ?> +
+ +
+ + + +
+ + + +
+ +

+ +

+ +

+ +

+ +

+ +
+ +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ +
+
+ +
+ + + + +
+ Date: Tue, 2 Feb 2021 13:24:08 +0545 Subject: [PATCH 08/12] Use hook for header section content --- header.php | 38 ++++++---------------- inc/hooks/header.php | 76 ++++++++++++++++++++++++++++++++++++++++++++ inc/hooks/hooks.php | 7 ++++ 3 files changed, 93 insertions(+), 28 deletions(-) diff --git a/header.php b/header.php index 473d35d0..24a99926 100644 --- a/header.php +++ b/header.php @@ -100,36 +100,18 @@ * @hooked spacious_header_left_section - 10 * @hooked spacious_header_right_section - 15 */ -do_action( 'spacious_action_header_section' ); ?> +do_action( 'spacious_action_header_section' ); +/** +* Functions hooked into spacious_action_header_section action. +* +* @hooked spacious_nav_text_wrap_close - 5 +* @hooked spacious_inner_wrap_end - 15 +* @hooked spacious_bottom_menu - 20 +* @hooked spacious_nav_container_close - 25 +*/ +do_action( 'spacious_action_header_section_close' ); ?> -
-
- -
-
- - -
- -
- -
- -
-
- -
-
-
- -
+
+ +
+ + +
+
+ + +
+ +
+ +
+ +
+
+ +
+
+
+ + + + Date: Tue, 2 Feb 2021 14:32:23 +0545 Subject: [PATCH 09/12] Use hook for header title --- header.php | 52 ++++++------------------------ inc/hooks/header.php | 77 ++++++++++++++++++++++++++++++++++++++++++++ inc/hooks/hooks.php | 5 +++ 3 files changed, 91 insertions(+), 43 deletions(-) diff --git a/header.php b/header.php index 24a99926..2401ea47 100644 --- a/header.php +++ b/header.php @@ -110,52 +110,18 @@ * @hooked spacious_bottom_menu - 20 * @hooked spacious_nav_container_close - 25 */ -do_action( 'spacious_action_header_section_close' ); ?> +do_action( 'spacious_action_header_section_close' ); +/** + * Functions hooked into spacious_action_header_content action. + * + * @hooked spacious_header_image_below - 5 + * @hooked spacious_slider_activation - 10 + * @hooked spacious_header_title_content - 15 + */ +do_action( 'spacious_action_header_content' ); ?> - - - -
-
-
- - -

- -

- - -
- -
-
- diff --git a/inc/hooks/header.php b/inc/hooks/header.php index 1996f7e5..c7e04983 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -335,3 +335,80 @@ function spacious_nav_container_close() { } endif; + +if ( ! function_exists( 'spacious_header_image_below' ) ) : + + /** + * Header image position below. + */ + function spacious_header_image_below() { + + if ( 'below' === get_theme_mod( 'spacious_header_image_position', 'above' ) ) { + spacious_render_header_image(); + } + + } + +endif; + +if ( ! function_exists( 'spacious_slider_activation' ) ) : + + /** + * Slider activation. + */ + function spacious_slider_activation() { + + if ( get_theme_mod( 'spacious_activate_slider', '0' ) == '1' ) { + if ( get_theme_mod( 'spacious_blog_slider', '0' ) != '1' ) { + if ( is_home() || is_front_page() ) { + spacious_featured_image_slider(); + } + } else { + if ( is_front_page() ) { + spacious_featured_image_slider(); + } + } + } + + } + +endif; + +if ( ! function_exists( 'spacious_header_title_content' ) ) : + + /** + * Slider activation. + */ + function spacious_header_title_content() { + + + if ( ( '' != spacious_header_title() ) && ! ( is_front_page() ) && ( ! get_theme_mod( 'spacious_header_title_hide', 0 ) ) ) { + if ( ! ( get_theme_mod( 'spacious_blog_slider', '0' ) != '1' && is_home() ) ) { ?> +
+
+
+ + +

+ +

+ + +
+ +
+
+ Date: Tue, 2 Feb 2021 14:36:49 +0545 Subject: [PATCH 10/12] Use hook for header end --- header.php | 51 +++++++++++++++++++++++++------------------- inc/hooks/header.php | 14 ++++++++++++ inc/hooks/hooks.php | 3 +++ 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/header.php b/header.php index 2401ea47..154db055 100644 --- a/header.php +++ b/header.php @@ -85,31 +85,31 @@ do_action( 'spacious_action_header_image' ); /** -* Functions hooked into spacious_action_nav_container action. -* -* @hooked spacious_nav_container_open - 5 -* @hooked spacious_nav_inner_wrap - 10 -* @hooked spacious_nav_text_wrap - 15 -*/ + * Functions hooked into spacious_action_nav_container action. + * + * @hooked spacious_nav_container_open - 5 + * @hooked spacious_nav_inner_wrap - 10 + * @hooked spacious_nav_text_wrap - 15 + */ do_action( 'spacious_action_nav_container' ); /** -* Functions hooked into spacious_action_header_section action. -* -* @hooked spacious_header_left_section - 10 -* @hooked spacious_header_right_section - 15 -*/ + * Functions hooked into spacious_action_header_section action. + * + * @hooked spacious_header_left_section - 10 + * @hooked spacious_header_right_section - 15 + */ do_action( 'spacious_action_header_section' ); /** -* Functions hooked into spacious_action_header_section action. -* -* @hooked spacious_nav_text_wrap_close - 5 -* @hooked spacious_inner_wrap_end - 15 -* @hooked spacious_bottom_menu - 20 -* @hooked spacious_nav_container_close - 25 -*/ + * Functions hooked into spacious_action_header_section action. + * + * @hooked spacious_nav_text_wrap_close - 5 + * @hooked spacious_inner_wrap_end - 15 + * @hooked spacious_bottom_menu - 20 + * @hooked spacious_nav_container_close - 25 + */ do_action( 'spacious_action_header_section_close' ); /** @@ -119,11 +119,18 @@ * @hooked spacious_slider_activation - 10 * @hooked spacious_header_title_content - 15 */ -do_action( 'spacious_action_header_content' ); ?> +do_action( 'spacious_action_header_content' ); + +/** + * Functions hooked into spacious_action_after_header action. + * + * @hooked spacious_header_end - 10 + */ +do_action( 'spacious_action_after_header' ); + +do_action( 'spacious_after_header' ); +do_action( 'spacious_before_main' ); ?> - - -
diff --git a/inc/hooks/header.php b/inc/hooks/header.php index c7e04983..e3d7b9bc 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -412,3 +412,17 @@ function spacious_header_title_content() { endif; + +if ( ! function_exists( 'spacious_header_end' ) ) : + + /** + * Header ends. + */ + function spacious_header_end() { + ?> + + Date: Tue, 2 Feb 2021 14:45:51 +0545 Subject: [PATCH 11/12] Use hook for main div start --- header.php | 12 +++++++++--- inc/hooks/header.php | 25 +++++++++++++++++++++++++ inc/hooks/hooks.php | 6 +++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/header.php b/header.php index 154db055..784550d5 100644 --- a/header.php +++ b/header.php @@ -130,7 +130,13 @@ do_action( 'spacious_after_header' ); -do_action( 'spacious_before_main' ); ?> +do_action( 'spacious_before_main' ); + +/** +* Functions hooked into spacious_action_main action. +* +* @hooked spacious_main_start - 5 +* @hooked spacious_main_inner_wrap - 10 +*/ +do_action( 'spacious_action_main' ); -
-
diff --git a/inc/hooks/header.php b/inc/hooks/header.php index e3d7b9bc..ec5355bd 100644 --- a/inc/hooks/header.php +++ b/inc/hooks/header.php @@ -426,3 +426,28 @@ function spacious_header_end() { endif; +if ( ! function_exists( 'spacious_main_start' ) ) : + + /** + * main starts. + */ +function spacious_main_start() { + ?> +
+ +
+ Date: Tue, 2 Feb 2021 15:55:38 +0545 Subject: [PATCH 12/12] Use hook for footer contents --- footer.php | 75 ++++++++++++++++----------- functions.php | 12 ++++- inc/hooks/footer.php | 119 +++++++++++++++++++++++++++++++++++++++++++ inc/hooks/hooks.php | 14 +++++ 4 files changed, 189 insertions(+), 31 deletions(-) create mode 100644 inc/hooks/footer.php diff --git a/footer.php b/footer.php index 156fd7a2..3597ce2f 100644 --- a/footer.php +++ b/footer.php @@ -8,36 +8,51 @@ * @subpackage Spacious * @since Spacious 1.0 */ -?> - -
-
- - -
- - -
- -
- - + +/** +* Functions hooked into spacious_action_main_end action. +* +* @hooked spacious_main_inner_wrap_end - 5 +* @hooked spacious_main_end - 10 +*/ +do_action( 'spacious_action_main_end' ); + +/** + * Hook: spacious_before_footer + */ +do_action( 'spacious_before_footer' ); + + +/** + * Functions hooked into spacious_action_footer_start action. + * + * @hooked spacious_footer_wrapper_start + */ +do_action( 'spacious_action_footer_start' ); + +/** + * Functions hooked into spacious_action_footer_content action. + * + * @hooked spacious_footer_content + */ +do_action( 'spacious_action_footer_content' ); + +/** + * Functions hooked into spacious_action_footer_end action. + * + * @hooked spacious_footer_wrapper_end + */ +do_action( 'spacious_action_footer_end' ); + +/** + * Functions hooked into spacious_action_after_footer action. + * + * @hooked spacious_after_footer - 5 + * @hooked spacious_footer_page_end - 15 + */ +do_action( 'spacious_action_after_footer' ); + +wp_footer(); ?> diff --git a/functions.php b/functions.php index 248874db..dcfaa5ee 100644 --- a/functions.php +++ b/functions.php @@ -359,7 +359,7 @@ function spacious_setup() { add_action( 'after_setup_theme', 'spacious_setup' ); // Theme version. -$spacious_theme = wp_get_theme('spacious'); +$spacious_theme = wp_get_theme( 'spacious' ); define( 'SPACIOUS_THEME_VERSION', $spacious_theme->get( 'Version' ) ); /** @@ -410,6 +410,16 @@ function spacious_setup() { require_once SPACIOUS_INCLUDES_DIR . '/class-spacious-dynamic-css.php'; require_once SPACIOUS_INCLUDES_DIR . '/migration.php'; +/** + * Load required theme hook files. + */ +require_once SPACIOUS_INCLUDES_DIR . '/hooks/hooks.php'; +require_once SPACIOUS_INCLUDES_DIR . '/hooks/header.php'; +require_once SPACIOUS_INCLUDES_DIR . '/hooks/footer.php'; + +/** Dynamic class file include. */ +require_once SPACIOUS_INCLUDES_DIR . '/spacious-dynamic-classes.php'; + /** Load demo import migration scripts. */ require_once SPACIOUS_INCLUDES_DIR . '/demo-import-migration.php'; diff --git a/inc/hooks/footer.php b/inc/hooks/footer.php new file mode 100644 index 00000000..3d046bf8 --- /dev/null +++ b/inc/hooks/footer.php @@ -0,0 +1,119 @@ + +
+ +
+ +
+ + + + +
+ + + +
+