/*
Theme Name: ExpertHive Child
Theme URI: https://hivepress.io/themes/experthive
Template: experthive
Author: HivePress
Author URI: https://hivepress.io
Description: A multipurpose WordPress theme that allows you to build an on-demand services marketplace.
Tags: left-sidebar,custom-colors,custom-menu,custom-logo,featured-images,footer-widgets,theme-options,threaded-comments,translation-ready
Version: 1.0.6.1768371294
Updated: 2026-01-14 06:14:54

*/
/* Mobile footer center fix */
@media (max-width: 768px) {
    footer * {
        text-align: center !important;
    }

    footer div {
        margin-left: auto !important;
        margin-right: auto !important;
        float: none !important;
    }

    footer ul {
        display: inline-block !important;
        text-align: center !important;
        padding: 0 !important;
    }

    footer li {
        display: inline-block !important;
        float: none !important;
    }
}
function defer_parsing_of_js($url) {
    if (is_admin()) return $url;
    if (strpos($url, '.js') === false) return $url;
    return "$url' defer='defer";
}
add_filter('clean_url', 'defer_parsing_of_js', 11, 1);
add_filter('wp_insert_post_data', function ($data, $postarr) {

    if ($data['post_type'] !== 'listing') return $data;

    if (!empty($postarr['ID'])) return $data;

    $city = '';

    if (!empty($_POST['listing_city'])) {
        $city = sanitize_title($_POST['listing_city']);
    }

    if ($city) {
        $data['post_name'] = sanitize_title($data['post_title'] . '-' . $city);
    }

    return $data;

}, 10, 2);




