var Cli_Data = {"nn_cookie_ids":["_gat_UA-*","_gid","_ga","_ga_*","_fbp","_gcl_au","rc::c","rc::a","cookielawinfo-checkbox-advertisement","CookieLawInfoConsent","WMF-Uniq"],"cookielist":[],"non_necessary_cookies":{"necessary":["rc::c","rc::a","CookieLawInfoConsent"],"analytics":["_gat_UA-*","_gid","_ga","_ga_*"],"advertisement":["_fbp","_gcl_au"],"others":["WMF-Uniq"]},"ccpaEnabled":"","ccpaRegionBased":"","ccpaBarEnabled":"","strictlyEnabled":["necessary","obligatoire"],"ccpaType":"gdpr","js_blocking":"1","custom_integration":"","triggerDomRefresh":"","secure_cookies":""};
var cli_cookiebar_settings = {"animate_speed_hide":"500","animate_speed_show":"500","background":"#FFF","border":"#b1a6a6c2","border_on":"","button_1_button_colour":"#61a229","button_1_button_hover":"#4e8221","button_1_link_colour":"#fff","button_1_as_button":"1","button_1_new_win":"","button_2_button_colour":"#333","button_2_button_hover":"#292929","button_2_link_colour":"#444","button_2_as_button":"","button_2_hidebar":"","button_3_button_colour":"#3566bb","button_3_button_hover":"#2a5296","button_3_link_colour":"#fff","button_3_as_button":"1","button_3_new_win":"","button_4_button_colour":"#000","button_4_button_hover":"#000000","button_4_link_colour":"#333333","button_4_as_button":"","button_7_button_colour":"#61a229","button_7_button_hover":"#4e8221","button_7_link_colour":"#fff","button_7_as_button":"1","button_7_new_win":"","font_family":"inherit","header_fix":"","notify_animate_hide":"1","notify_animate_show":"","notify_div_id":"#cookie-law-info-bar","notify_position_horizontal":"right","notify_position_vertical":"bottom","scroll_close":"","scroll_close_reload":"","accept_close_reload":"","reject_close_reload":"","showagain_tab":"","showagain_background":"#fff","showagain_border":"#000","showagain_div_id":"#cookie-law-info-again","showagain_x_position":"100px","text":"#333333","show_once_yn":"","show_once":"10000","logging_on":"","as_popup":"","popup_overlay":"1","bar_heading_text":"","cookie_bar_as":"banner","popup_showagain_position":"bottom-right","widget_position":"left"};
var log_object = {"ajax_url":"https://rachaelkatiecosmetics.co.uk/wp-admin/admin-ajax.php"};
//# sourceURL=cookie-law-info-js-extra
var wc_single_product_params = {"i18n_required_rating_text":"Please select a rating","i18n_rating_options":["1 of 5 stars","2 of 5 stars","3 of 5 stars","4 of 5 stars","5 of 5 stars"],"i18n_product_gallery_trigger_text":"View full-screen image gallery","review_rating_required":"yes","flexslider":{"rtl":false,"animation":"slide","smoothHeight":true,"directionNav":false,"controlNav":"thumbnails","slideshow":false,"animationSpeed":500,"animationLoop":false,"allowOneSlide":false,"touch":false},"zoom_enabled":"1","zoom_options":[],"photoswipe_enabled":"1","photoswipe_options":{"shareEl":false,"closeOnScroll":false,"history":false,"hideAnimationDuration":0,"showAnimationDuration":0},"flexslider_enabled":"1"};
//# sourceURL=wc-single-product-js-extra
Laser hair removal is a non-invasive cosmetic procedure that uses a concentrated beam of light (laser) to remove unwanted hair from various areas of the body. Unlike shaving or waxing, which provide temporary results, laser hair removal offers longer-lasting effects.
Common treatment areas include the face, underarms, bikini area, back, and legs. The procedure works by targeting the pigment (melanin) in hair follicles, converting light energy into heat and damaging the follicles to inhibit hair growth.
For optimal results, multiple sessions are often necessary, especially since hair follicles cycle through different growth stages. It’s essential to consult with a healthcare provider to determine if laser hair removal is suitable for you. If you’re tired of shaving, tweezing, or waxing, laser hair removal might be the solution you’re looking for.
How does laser hair removal work?
Laser hair removal uses a concentrated beam of light (laser) to remove unwanted hair. During the treatment, the laser emits light that is absorbed by the pigment (melanin) in the hair follicles. This absorbed energy converts to heat, damaging the tube-shaped sacs within the skin (hair follicles) responsible for hair growth.
While laser hair removal significantly reduces hair growth, true permanence varies. Most patients experience permanent hair loss after an average of three to seven sessions. However, occasional touch-ups may be needed.
Can hair be permanently removed by laser?
Laser hair removal is a medical procedure that uses a concentrated beam of light (laser) to remove unwanted hair. During the treatment, the laser emits light that is absorbed by the pigment (melanin) in the hair follicles.
The absorbed energy converts to heat, damaging the tube-shaped sacs within the skin (hair follicles) responsible for hair growth. While laser hair removal significantly reduces hair growth, true permanence varies. Here’s what you need to know:
Permanent reduction: Most individuals experience permanent hair loss after several laser hair removal sessions. The laser targets the pigment in individual hairs, converting light energy into heat. This heat destroys the hair follicle, preventing further hair growth. However, it can be challenging to destroy every single hair follicle, so some people may see limited regrowth. Over time, treated hair often grows back lighter and less noticeable than before.
Maintenance: While laser hair removal provides long-lasting results, it usually doesn’t result in complete permanent removal. Some hair in the targeted area may eventually regrow due to damaged but not fully destroyed follicles. Occasional touch-up sessions may be needed to maintain the desired level of hair reduction. Remember that individual responses may vary based on factors like hair color, skin type, and hormonal influences.
How do I prepare for laser hair removal?
Laser hair removal is a popular method for achieving long-lasting hair reduction. To ensure the best results and minimize potential side effects, follow these guidelines before your treatment:
Clean your skin before the treatment: Arrive at the clinic with a clean treatment area (e.g., legs, underarms, bikini area). Lotions, dirt, and impurities on the skin can reduce the laser’s effectiveness. Clean skin allows the laser to directly target the hair follicle.
Stop waxing or plucking: Methods like waxing and plucking uproot the hair from the root. If you wax or pluck before a laser session, the laser won’t effectively target the hair pigment because the hair has been removed. Refrain from hair removal procedures that uproot the hair for at least six weeks before your laser treatment.
Shave the treatment area: Unlike waxing and plucking, shaving is necessary one or two days before laser hair removal. Shaving doesn’t uproot the hair, allowing the laser to effectively target the hair pigment. It also gets rid of hair on the skin’s surface, reducing the risk of burns during treatment.
Avoid sun exposure: Tanning increases the chance of laser burns. Traditional lasers require a clear color contrast between the skin and hair to successfully target the hair pigment. Darker skin can lead the laser to mistakenly target melanin in the skin instead of the hair. Avoid sun exposure, tanning beds, and self-tanning lotions for several weeks before your laser treatment. Remember, proper preparation enhances the effectiveness and safety of your laser hair removal experience.
How painful Is laser hair removal?
Laser hair removal is a popular cosmetic procedure for achieving long-lasting hair reduction. While individual experiences can vary, most people find the procedure to be relatively well-tolerated.
During the treatment, you’ll likely feel a mild discomfort, often described as similar to a rubber band snap against the skin. The laser emits pulses of light that target the hair follicles, and this sensation occurs as the energy is absorbed by the hair shaft. Pain perception varies from person to person. Factors such as skin sensitivity, the treatment area, and your pain threshold play a role. Some individuals hardly notice any discomfort, while others may find it slightly more intense.
To enhance comfort, topical numbing creams can be applied before the procedure. These creams contain local anaesthetics that help minimise any pain. Discuss this option with your provider if you’re concerned about discomfort. Many laser systems incorporate built-in cooling mechanisms to soothe the skin during treatment. These cooling devices help reduce heat-related discomfort and protect the surrounding skin.
After the session, you may experience mild redness or swelling, which typically subsides within a few hours. Applying a cool compress or aloe vera gel can provide relief. Keep in mind that laser hair removal is usually done in a series of sessions (typically 6 to 8 sessions), spaced several weeks apart. Over time, the discomfort tends to decrease as the hair becomes finer and lighter.
Can I wax between laser sessions?
When undergoing laser hair removal, it’s crucial to avoid waxing the treated area during your course. Waxing removes hair from the root, which interferes with the laser’s precise targeting of the hair follicle. Instead, opt for alternative methods like shaving if you need to remove hair between treatments.
How soon will I see results?
Laser hair removal permanently reduces hair growth. While it doesn’t entirely remove all hair, it makes any remaining hair finer and less noticeable. Typically, patients experience about 70% hair reduction after completing a series of treatments (usually six to eight sessions). With each treatment, actively growing hair follicles are destroyed, leading to gradual weakening and thinning of regrown hair.
Although immediate results may not be dramatic, the long-term benefits of smooth, hair-free skin make laser hair removal well worth it. Maintenance sessions may be needed annually to target any stray hairs and maintain results.
What happens if you stop early?
Laser hair removal is a process that selectively targets hair follicles at different growth stages. If you stop early, you risk incomplete hair reduction because the procedure requires multiple sessions to address hairs in various growth phases.
Consistency is crucial: completing the full course of treatments ensures optimal results and long-term hair reduction. Remember, patience and adherence to the treatment plan yield the best outcomes.
Areas not ideal for laser removal
When considering laser hair removal, it’s essential to be aware of areas where the procedure is not ideal:
Eyelids: The delicate skin around the eyes, including the eyelids, is not recommended for laser treatment due to safety concerns. The proximity to the eyes and the risk of eye damage make this area unsuitable.
Tattooed areas: If you have tattoos on the skin, avoid treating those areas with laser hair removal. The laser energy can disrupt the ink and potentially cause adverse effects or alter the appearance of your tattoos.
Remember, adherence to the treatment plan and being mindful of these specific areas ensures the best outcomes in laser hair removal.
So is it right for you?
Laser hair removal presents a promising option for those seeking lasting relief from unwanted hair. While not entirely devoid of discomfort, advancements in technology have made the process increasingly tolerable. Understanding the procedure's limitations, such as the need for maintenance sessions and potential variations in results, is crucial for realistic expectations.
Preparation plays a pivotal role in ensuring the procedure's effectiveness and safety, from adhering to pre-treatment guidelines to recognising areas unsuitable for treatment. By consulting with a qualified professional and committing to a comprehensive treatment plan, individuals can embark on a journey towards smoother, more confident living.
Laser hair removal offers a transformative experience, providing a lasting solution that frees individuals from the constant hassle of shaving or the discomfort of waxing.
It's available at our clinic and you can find more info including pricing here or book your appointment here.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-advertisement
1 year
Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category.
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
CookieLawInfoConsent
1 year
CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie.
rc::a
never
This cookie is set by the Google recaptcha service to identify bots to protect the website against malicious spam attacks.
rc::c
session
This cookie is set by the Google recaptcha service to identify bots to protect the website against malicious spam attacks.
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Cookie
Duration
Description
_ga
1 year 1 month 4 days
Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.
_ga_*
1 year 1 month 4 days
Google Analytics sets this cookie to store and count page views.
_gat_UA-*
1 minute
Google Analytics sets this cookie for user behaviour tracking.n
_gid
1 day
Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Cookie
Duration
Description
_fbp
3 months
Facebook sets this cookie to store and track interactions.
_gcl_au
3 months
Google Tag Manager sets this cookie to experiment advertisement efficiency of websites using their services.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
Cookie
Duration
Description
WMF-Uniq
1 year
Description is currently not available.
(function($) {
$(document).ready(function(){
var maxLength = 120;
$(".show-read-more").each(function(){
var myStr = $(this).text();
if($.trim(myStr).length > maxLength){
var newStr = myStr.substring(0, maxLength);
var removedStr = myStr.substring(maxLength, $.trim(myStr).length);
$(this).empty().html(newStr);
$(this).append('...');
$(this).append(' <a href="javascript:void(0);" class="read-more"> read more</a>');
$(this).append('<span class="more-text">' + removedStr + '</span>');
}
});
$(".read-more").click(function(){
$(this).siblings(".more-text").contents().unwrap();
$(this).remove();
});
});
//$(".page-id-39 .booking-link").attr("href", '#courses').attr('target','_self'); // Set herf value
$(".page-id-39 .booking-link").css("display", 'none');
})(jQuery);
(function($) {$(document).ready(function(){var wi = $(window).width();
if (wi <= 500) {
$('.course-content').each((i, el) => {
let $p = $(el).find('p');
$('.course-img-cont',el).insertAfter($p.eq(0)); // or use the eq here too
$('.course-img-cont').addClass('course-img-cont-mob');
});
} else {
$('.course-content').each((i, el) => {
let $p = $(el).find('p');
$('.course-img-cont',el).insertBefore($('.course-text',el)); // or use the eq here too
$('.course-img-cont').removeClass('course-img-cont-mob');
});
}
$(window).resize(function() {
//as window resizes
var wi = $(window).width();
if (wi <= 500) {
// Inserts image halfway down section
$('.course-content').each((i, el) => {
let $p = $(el).find('p');
$('.course-img-cont',el).insertAfter($p.eq(0)); // or use the eq here too
$('.course-img-cont').addClass('course-img-cont-mob');
});
} else {
// Inserts image back at the top
$('.course-content').each((i, el) => {
let $p = $(el).find('p');
$('.course-img-cont',el).insertBefore($('.course-text',el)); // or use the eq here too
$('.course-img-cont').removeClass('course-img-cont-mob');
});
}
});
});})( jQuery );
// JavaScript: Load video after the main page is ready
window.addEventListener('load', function() {
const lazyVideo = document.querySelector('.lazy-video');
const sources = lazyVideo.querySelectorAll('source');
// Set data-src to src for each source, then tell the video to load
sources.forEach(source => {
source.src = source.dataset.src;
});
lazyVideo.load();
// Optional: Add a class to fade in video after it starts playing
lazyVideo.addEventListener('loadeddata', () => {
document.querySelector('.hero-poster').style.opacity = 0;
});
});
(function($) {
$(document).ready(function(){
$('.more-info').click(function() {
$(this).closest('.treatment').find('.scg-more-info').slideToggle('fast');
let $this = $(this);
let current = $this.text();
let alternate = $this.data('alternate'); // e.g., data-alternate="Show less"
$this.text(alternate).data('alternate', current);});
});
})(jQuery);
(function($) {
$(document).ready(function(){var $header = $('header'); // Replace with your actual header selector
function toggleHeaderOnScroll() {
$header.toggleClass('scrolled', $(window).scrollTop() > 100);
}
if ($('#hero').length === 0) {
// No hero element → always add the class
$header.addClass('scrolled');
} else {
// Hero exists → toggle class on scroll
// Listen to scroll events
$(window).on('scroll', toggleHeaderOnScroll);
// Set initial state (in case page loads already scrolled)
toggleHeaderOnScroll();//toggle class on scroll with perfomrmance consideration
let ticking = false;
$(window).on('scroll', function() {
if (!ticking) {
window.requestAnimationFrame(function() {
$('header').toggleClass('scrolled', $(window).scrollTop() > 100);
ticking = false;
});
ticking = true;
}
});
}
//checks scroll on load
$(window).on('load', function() {
$(window).trigger('scroll');
});
//hero text fade out on scroll
$(window).on('scroll', function() {
if ($(this).scrollTop() > 50) {
$('.hero-cont').stop().fadeTo(800, 0); // fade to transparent
} else {
$('.hero-cont').stop().fadeTo(800, 1); // fade back to opaque
}
});
function isSticky($el) {
var stickyTop = parseInt($el.css('top')); // e.g., 0
var rect = $el[0].getBoundingClientRect();
return rect.top <= stickyTop;
}$(window).on('scroll', function() {
if (isSticky($('#serv-menu'))) {
console.log('Element is currently sticky');
$('#serv-menu').addClass('sticky');
// do something
} else {
console.log('Element is not sticky');
$('#serv-menu').removeClass('sticky');
}
});
});
})(jQuery);
(function($) {
$(document).ready(function(){
// Accordion functionality
$('.more').on('click', function() {
// Toggle active class on the question
$(this).toggleClass('active');// Toggle the answer with sliding effect
$(this).prev('.serv-more').slideToggle('fast');
let $this = $(this);
let current = $this.text();
let alternate = $this.data('alternate'); // e.g., data-alternate="Show less"
$this.text(alternate).data('alternate', current);// Update ARIA attribute for accessibility
// var expanded = $(this).attr('aria-expanded') === 'true' ? false : true;
// $(this).attr('aria-expanded', expanded);
});// Optional: allow keyboard activation (Enter or Space)
$('.more').on('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
$(this).trigger('click');
}
});
// turn ul into w cols
$(document).ready(function() {
$('#sct-serv-list ul, #sct-serv-list ol').each(function() {
var $list = $(this);
var liCount = $list.children('li').length;
if (liCount > 5) {
$list.addClass('multi-column');
}
});
});});
})(jQuery);
(function($) {var minWidth = 1000;// Helper function to check if we are on the excluded post
function isExcludedPost() {
return $('body').hasClass('postid-1351');
}$(document).ready(function() {
// Do nothing if this is the excluded post
if (isExcludedPost()) {
return;
}var wi = $(window).width();if (wi <= minWidth) {
$('.blurb-cont').each((i, el) => {
let $p = $(el).find('p');
let mid = Math.floor($p.length / 2);
$('.blurb-img', el).insertBefore($p.eq(mid));
});
} else {
$('.blurb-cont').each((i, el) => {
let $p = $(el).find('p');
let mid = Math.floor($p.length / 2);
$('.blurb-img', el).insertAfter($('.text-cont', el));
});
}$(window).resize(function() {
// Skip resize logic if excluded post
if (isExcludedPost()) {
return;
}var wi = $(window).width();if (wi <= minWidth) {
$('.blurb-cont').each((i, el) => {
let $p = $(el).find('p');
let mid = Math.floor($p.length / 2);
$('.blurb-img', el).insertBefore($p.eq(mid));
});
} else {
$('.blurb-cont').each((i, el) => {
let $p = $(el).find('p');
let mid = Math.floor($p.length / 2);
$('.blurb-img', el).insertAfter($('.text-cont', el));
});
}
});
});})(jQuery);
jQuery(document).ready(function($) {
// JavaScript for AJAX Search with Post Type Filters
// Search triggers on: button click, Enter key, OR filter changes'use strict';
// Initialize variables
let currentPage = 1;
let searchQuery = $('#ajax-search-input').val().trim();
let selectedPostTypes = [];
let isLoading = false;
let filterChangeTimer = null;
let isInitialLoad = true;
// Get initial post types from checkboxes
function getSelectedPostTypes() {
selectedPostTypes = [];
$('input[name="post_types[]"]:checked').each(function() {
selectedPostTypes.push($(this).val());
});
// If none checked, default to both
if (selectedPostTypes.length === 0) {
selectedPostTypes = ['post', 'service'];
$('input[name="post_types[]"]').prop('checked', true);
}
return selectedPostTypes;
}
// Initialize post types
getSelectedPostTypes();
// Handle checkbox changes with debounce
$('input[name="post_types[]"]').on('change', function() {
clearTimeout(filterChangeTimer);
// If unchecking would leave no boxes checked, prevent it
if ($('input[name="post_types[]"]:checked').length === 0) {
$(this).prop('checked', true);
return;
}
selectedPostTypes = getSelectedPostTypes();
// Only trigger search if we have a search term
if (searchQuery && searchQuery.length > 0) {
filterChangeTimer = setTimeout(function() {
currentPage = 1;
performSearch(searchQuery, currentPage, selectedPostTypes);
updateBrowserURL(searchQuery, currentPage, selectedPostTypes);
}, 300); // 300ms debounce
} else {
// If no search term but we have URL parameters, update URL without search
updateBrowserURL('', 1, selectedPostTypes);
}
});
// Handle form submission (button click)
$('#ajax-search-form').on('submit', function(e) {
e.preventDefault();
triggerSearch();
});
// Handle Enter key press in search input
$('#ajax-search-input').on('keypress', function(e) {
if (e.which === 13) { // Enter key
e.preventDefault();
triggerSearch();
}
});
// Search trigger function
function triggerSearch() {
searchQuery = $('#ajax-search-input').val().trim();
currentPage = 1;
if (searchQuery.length > 0) {
performSearch(searchQuery, currentPage, selectedPostTypes);
updateBrowserURL(searchQuery, currentPage, selectedPostTypes);
} else {
showSearchIntro();
updateBrowserURL('', 1, selectedPostTypes);
}
}
// Handle AJAX pagination clicks
$(document).on('click', '.ajax-page-link', function(e) {
e.preventDefault();
if (isLoading) return;
currentPage = $(this).data('page');
performSearch(searchQuery, currentPage, selectedPostTypes);
updateBrowserURL(searchQuery, currentPage, selectedPostTypes);
$('html, body').animate({
scrollTop: $('#search-results').offset().top - 100
}, 500);
});
// Handle browser back/forward buttons
if (window.history && window.history.pushState) {
window.addEventListener('popstate', function(event) {
if (event.state && event.state.search) {
searchQuery = event.state.search;
currentPage = event.state.page || 1;
selectedPostTypes = event.state.post_types || ['post', 'service'];
$('#ajax-search-input').val(searchQuery);
// Update checkboxes
$('input[name="post_types[]"]').each(function() {
$(this).prop('checked', selectedPostTypes.includes($(this).val()));
});
performSearch(searchQuery, currentPage, selectedPostTypes);
} else if (!event.state || !event.state.search) {
showSearchIntro();
}
});
}
// Perform AJAX search
function performSearch(query, page, postTypes) {
if (isLoading) return;
isLoading = true;
$('.search-loader').css('opacity', '1');
$('#search-submit-btn').prop('disabled', true);
// Add visual feedback for active search
$('.filter-checkbox').addClass('searching');
$.ajax({
url: ajax_search_params.ajax_url,
type: 'POST',
data: {
action: 'ajax_search',
nonce: ajax_search_params.nonce,
query: query,
page: page,
posts_per_page: 10,
post_types: postTypes
},
success: function(response) {
if (response.success) {
$('#search-results').html(response.data.results);
if (response.data.pagination) {
$('#search-pagination').html(response.data.pagination).show();
} else {
$('#search-pagination').hide();
}
// Update active filters display
updateActiveFiltersDisplay();
} else {
$('#search-results').html('<div class="no-results"><p>' + response.data + '</p></div>');
$('#search-pagination').hide();
}
},
error: function(xhr, status, error) {
$('#search-results').html('<div class="error"><p>An error occurred. Please try again.</p></div>');
$('#search-pagination').hide();
console.error('Search error:', error);
},
complete: function() {
isLoading = false;
$('.search-loader').css('opacity', '0');
$('#search-submit-btn').prop('disabled', false);
$('.filter-checkbox').removeClass('searching');
// If this was initial load from URL parameters, mark as done
if (isInitialLoad) {
isInitialLoad = false;
}
}
});
}
// Update active filters display
function updateActiveFiltersDisplay() {
let activeFilters = [];
// Define filter labels
const filterLabels = {
'post': 'Articles',
'service': 'Treatments'
};
// Get active filters based on checkboxes
$('input[name="post_types[]"]:checked').each(function() {
const type = $(this).val();
if (filterLabels[type]) {
activeFilters.push(filterLabels[type]);
}
});
// Update or create active filters display
let activeFiltersElement = $('.active-filters');
if (activeFiltersElement.length === 0) {
activeFiltersElement = $('<div class="active-filters"></div>');
$('.results-header').append(activeFiltersElement);
}
if (activeFilters.length > 0) {
activeFiltersElement.html('<span class="filter-badge">' + activeFilters.join(', ') + '</span>');
} else {
activeFiltersElement.empty();
}
}
// Update browser URL without reloading
function updateBrowserURL(query, page, postTypes) {
if (!window.history || !window.history.pushState) return;
let newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
let params = [];
if (query) {
params.push('s=' + encodeURIComponent(query));
}
if (page > 1) {
params.push('paged=' + page);
}
// Only add post_types parameter if not showing all types
// But we need to track what's actually selected
if (postTypes && postTypes.length > 0) {
if (postTypes.length === 1) {
// Only one type selected
params.push('post_types[]=' + encodeURIComponent(postTypes[0]));
} else if (postTypes.length === 2) {
// Both selected - we could still include it for clarity, or omit
// Let's include it so URL reflects actual selection
postTypes.forEach(function(type) {
params.push('post_types[]=' + encodeURIComponent(type));
});
}
}
if (params.length > 0) {
newURL += '?' + params.join('&');
}
window.history.pushState({
search: query,
page: page,
post_types: postTypes
}, '', newURL);
// Update page title
if (query) {
let baseTitle = document.title.split('|')[0] || 'Search Results';
document.title = baseTitle.trim() + ' for: ' + query;
} else {
document.title = 'Search' + (document.title.includes('|') ? ' | ' + document.title.split('|').slice(1).join('|') : '');
}
}
// Show search intro message
function showSearchIntro() {
$('#search-results').html(
'<div class="search-intro">' +
'<p>Search through our articles and treatments. Use the filters above to refine your search.</p>' +
'<p>You can search by keyword, treatment name, or article content.</p>' +
'</div>'
);
$('#search-pagination').hide();
}
// Add visual indicator when checkbox triggers search
function setupFilterCheckboxStyles() {
const style = document.createElement('style');
style.textContent = `
.filter-checkbox.searching .checkmark {
border-color: #0073aa;
background-color: rgba(0, 115, 170, 0.1);
}
.filter-checkbox.searching input:checked ~ .checkmark {
background-color: #0073aa;
}
`;
document.head.appendChild(style);
}
// Initialize
$(window).on('load', function() {
// Setup visual styles
setupFilterCheckboxStyles();
// Trigger AJAX search if we have initial search term on page load
if (searchQuery && searchQuery.length > 0) {
setTimeout(function() {
performSearch(searchQuery, currentPage, selectedPostTypes);
}, 100);
}
// Add visual feedback for checkboxes
$('input[name="post_types[]"]').on('mousedown', function() {
$(this).closest('.filter-checkbox').addClass('clicking');
}).on('mouseup mouseleave', function() {
$(this).closest('.filter-checkbox').removeClass('clicking');
});
});})(jQuery);
var ajax_search_params = {
ajax_url: 'https://rachaelkatiecosmetics.co.uk/wp-admin/admin-ajax.php',
nonce: '0b568a8001'
};
var sbiajaxurl = "https://rachaelkatiecosmetics.co.uk/wp-admin/admin-ajax.php";