@@ -121,7 +121,7 @@ public function override_header($name)
121121 if (! $ this ->has_template ('header ' )) {
122122 return ;
123123 }
124-
124+
125125 require WCF_ADDONS_PATH . '/templates/header.php ' ;
126126
127127 $ templates = array ();
@@ -195,6 +195,7 @@ public function header_builder_content()
195195 $ archive_template_id = $ this ->get_template_id ('header ' );
196196 if ($ archive_template_id != '0 ' ) {
197197 // PHPCS - should not be escaped.
198+
198199 echo self ::render_build_content ($ archive_template_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
199200 }
200201 }
@@ -283,8 +284,18 @@ private function get_template_loader_default_file()
283284 public function has_template ($ tmpType = '' )
284285 {
285286 $ template_ID = self ::get_current_post_by_condition ($ tmpType );
286-
287+
287288 if ($ template_ID ) {
289+ if ($ tmpType == 'header ' ){
290+ $ GLOBALS ['aae_header_smoother ' ] = get_post_meta ( $ template_ID , 'aae_header_smoother ' , true );
291+ $ offsetY = get_post_meta ( $ template_ID , 'aae_header_smoother_offsety ' , true );
292+ $ offsetY = preg_replace ( '/[^0-9.\-]/ ' , '' , $ offsetY );
293+ if ($ offsetY && is_numeric ($ offsetY )){
294+ $ GLOBALS ['aae_header_smoother_offsetY ' ] = $ offsetY ;
295+ }
296+
297+ }
298+
288299 return $ template_ID ;
289300 }
290301
@@ -501,20 +512,23 @@ public function get_current_post_by_condition($tmpType = '')
501512
502513 return $ templates ['post-singulars ' ];
503514 }
515+
504516 // if template type single ignore post type page
505- if (('page ' === get_post_type () || self ::CPTTYPE === get_post_type ()) && 'single ' === $ tmpType ) {
517+ if ((( 'page ' === get_post_type () && ! is_front_page () ) || ( self ::CPTTYPE === get_post_type () && ! is_front_page () )) && 'single ' === $ tmpType ) {
506518 return false ;
507519 }
508-
520+
509521 // check for custom post type singular
510522 $ custom_single = get_post_type () . '-singular ' ;
511523
512524 if (array_key_exists ($ custom_single , $ templates )) {
525+
513526 return $ templates [$ custom_single ];
514527 }
515528
516529 // all singular
517- if (array_key_exists ('singulars ' , $ templates )) {
530+ if (array_key_exists ('singulars ' , $ templates ) && !is_front_page ()) {
531+
518532 return $ templates ['singulars ' ];
519533 }
520534 }
@@ -1439,6 +1453,23 @@ class="bi bi-x-lg" viewBox="0 0 16 16"><path
14391453 <option value="zoomBounce"><?php echo esc_html__ ('Zoom + Bounce ' , 'animation-addons-for-elementor ' ); ?> </option>
14401454 <option value="fadeSlideup"><?php echo esc_html__ ('Fade + Slide Up ' , 'animation-addons-for-elementor ' ); ?> </option>
14411455 </select>
1456+ </div>
1457+ <!-- Header Smoother -->
1458+ <div class="wcf-addons-template-edit-field aae-header-smoother-location hidden">
1459+ <label class="wcf-addons-template-edit-label"><?php echo esc_html__ ('Smoother? ' , 'animation-addons-for-elementor ' ); ?> </label>
1460+ <select class="wcf-addons-template-edit-input" name="aae-header-smoother-location"
1461+ id="aae-header-smoother-location">
1462+ <option value=""><?php echo esc_html__ ('Default ' , 'animation-addons-for-elementor ' ); ?> </option>
1463+ <option value="yes"><?php echo esc_html__ ('Yes ' , 'animation-addons-for-elementor ' ); ?> </option>
1464+ <option value="no"><?php echo esc_html__ ('No ' , 'animation-addons-for-elementor ' ); ?> </option>
1465+ </select>
1466+ </div>
1467+
1468+ <div class="wcf-addons-template-edit-field aae-header-smoother-location yoffset hidden">
1469+ <label class="wcf-addons-template-edit-label"><?php echo esc_html__ ('OffsetY(px) ' , 'animation-addons-for-elementor ' ); ?> </label>
1470+ <input class="wcf-addons-template-edit-input" id="aae-header-smoother-yoffset" type="text"
1471+ name="aae-header-smoother-yoffset"
1472+ placeholder="120">
14421473 </div>
14431474
14441475 </div>
@@ -1501,6 +1532,8 @@ public function save_template_request()
15011532 $ popupEffect = ! empty ($ _POST ['tmpEffect ' ]) ? sanitize_text_field (wp_unslash ($ _POST ['tmpEffect ' ])) : 'flip ' ;
15021533 $ selector = ! empty ($ _POST ['tmpSelector ' ]) ? sanitize_text_field (wp_unslash ($ _POST ['tmpSelector ' ])) : '' ;
15031534 $ scrollPostion = ! empty ($ _POST ['tmpScrollPostion ' ]) ? sanitize_text_field (wp_unslash ($ _POST ['tmpScrollPostion ' ])) : 0 ;
1535+ $ headerSmoother = ! empty ($ _POST ['tmpHeaderSmoother ' ]) ? sanitize_text_field (wp_unslash ($ _POST ['tmpHeaderSmoother ' ])) : '' ;
1536+ $ headerSmootheroffset = ! empty ($ _POST ['tmpHeaderSmootherOffsetY ' ]) ? sanitize_text_field (wp_unslash ($ _POST ['tmpHeaderSmootherOffsetY ' ])) : '' ;
15041537
15051538 $ data = array (
15061539 'title ' => $ title ,
@@ -1512,7 +1545,9 @@ public function save_template_request()
15121545 'tmpTrigger ' => $ popuptrigger ,
15131546 'tmpSelector ' => $ selector ,
15141547 'tmpScrollPostion ' => $ scrollPostion ,
1515- 'tmpEffect ' => $ popupEffect
1548+ 'tmpEffect ' => $ popupEffect ,
1549+ 'tmpHeaderSmoother ' => $ headerSmoother ,
1550+ 'tmpHeaderSmootherOffsetY ' => $ headerSmootheroffset
15161551 );
15171552
15181553 if ($ tmpid ) {
@@ -1563,6 +1598,8 @@ public function get_post_By_id()
15631598 $ popupEffect = ! empty (get_post_meta ($ tmpid , 'effect ' , true )) ? get_post_meta ($ tmpid , 'effect ' , true ) : 'flip ' ;
15641599 $ popup_selector = ! empty (get_post_meta ($ tmpid , 'popup_selector ' , true )) ? get_post_meta ($ tmpid , 'popup_selector ' , true ) : '' ;
15651600 $ scrollPostion = ! empty (get_post_meta ($ tmpid , 'scrollPostion ' , true )) ? get_post_meta ($ tmpid , 'scrollPostion ' , true ) : '' ;
1601+ $ aae_header_smoother = ! empty (get_post_meta ($ tmpid , 'aae_header_smoother ' , true )) ? get_post_meta ($ tmpid , 'aae_header_smoother ' , true ) : '' ;
1602+ $ header_smootheroffsety = ! empty (get_post_meta ($ tmpid , 'aae_header_smoother_offsety ' , true )) ? get_post_meta ($ tmpid , 'aae_header_smoother_offsety ' , true ) : '' ;
15661603 $ spLocations = array ();
15671604
15681605 if (! empty ($ specificsDisplay )) {
@@ -1581,7 +1618,9 @@ public function get_post_By_id()
15811618 'tmpTrigger ' => $ popupTrigger ,
15821619 'tmpSelector ' => $ popup_selector ,
15831620 'tmpEffect ' => $ popupEffect ,
1584- 'tmpScrollPostion ' => $ scrollPostion
1621+ 'tmpScrollPostion ' => $ scrollPostion ,
1622+ 'tmpHeaderSmoother ' => $ aae_header_smoother ,
1623+ 'tmpHeaderSmootherOffsetY ' => $ header_smootheroffsety ,
15851624 );
15861625 wp_send_json_success ($ data );
15871626 } else {
@@ -1743,6 +1782,9 @@ public function insert($data)
17431782 // specific page and post template header footer
17441783 if ('header ' === $ data ['tmptype ' ] || 'footer ' === $ data ['tmptype ' ]) {
17451784 update_post_meta ($ new_post_id , self ::CPT_META . '_splocation ' , $ data ['tmpSpLocation ' ]);
1785+ update_post_meta ($ new_post_id , 'aae_header_smoother ' , $ data ['tmpHeaderSmoother ' ]);
1786+ update_post_meta ($ new_post_id , 'aae_header_smoother_offsety ' , $ data ['tmpHeaderSmootherOffsetY ' ]);
1787+
17461788 }
17471789
17481790 if ('archive ' === $ data ['tmptype ' ] && 'specifics_cat ' === $ data ['tmplocation ' ]) {
@@ -1795,6 +1837,8 @@ public function update($data)
17951837 // specific page and post template header footer
17961838 if ('header ' === $ data ['tmptype ' ] || 'footer ' === $ data ['tmptype ' ]) {
17971839 update_post_meta ($ data ['id ' ], self ::CPT_META . '_splocation ' , $ data ['tmpSpLocation ' ]);
1840+ update_post_meta ($ data ['id ' ], 'aae_header_smoother ' , $ data ['tmpHeaderSmoother ' ]);
1841+ update_post_meta ($ data ['id ' ], 'aae_header_smoother_offsety ' , $ data ['tmpHeaderSmootherOffsetY ' ]);
17981842 } else {
17991843 delete_post_meta ($ data ['id ' ], self ::CPT_META . '_splocation ' );
18001844 }
0 commit comments