<?php /** * Plugin Name: Contractorpilot Theme Fix (one-off) * Description: Fixes Construction Services Company theme issues on contractorpilot.co: * - Hides the empty logo image (orange block) * - Removes the 30 SEO combo pages from the auto-generated nav menu * - Sets the front page title to "Find a verified Washington contractor" * - Hides the Categories widget from the home page * * Author: Contractorpilot.co * Version: 1.0.0 */ if (!defined('ABSPATH')) exit; /** * 1. Hide the empty logo image div — without a logo, it shows an orange block. * Inject a tiny CSS rule scoped to the theme body class. */ add_action('wp_head', function () { if (!is_front_page()) return; echo '<style> body.wp-theme-construction-services-company .logo-image:empty { display: none !important; } body.wp-theme-construction-services-company .logo-content a { font-size: 1.4em; font-weight: 700; color: #0B1426; } body.wp-theme-construction-services-company .bread_crumb .current_item { color: #555; } </style>'; }, 100); /** * 2. Filter the auto-generated nav menu to remove combo landing pages. * The theme uses wp_list_pages() in its header.php — hook into the * page attributes walk to mark combo pages as excluded from nav. */ add_filter('get_pages', function ($pages) { if (is_admin()) return $pages; if (empty($pages)) return $pages; $filtered = []; foreach ($pages as $p) { $is_combo = get_post_meta($p->ID, '_cpilot_combo_city_slug', true); if ($is_combo) continue; // exclude combo landing pages from nav $filtered[] = $p; } return $filtered; }); /** * 3. Set the home page title. The theme's "Home" comes from the page's own * WP_Post title — we update page 14's title to "Find a verified Washington * contractor" only if it's still the default "Home". */ add_action('init', function () { static $done = false; if ($done) return; $done = true; $front_id = (int) get_option('page_on_front'); if (!$front_id) return; $front = get_post($front_id); if ($front && strtolower($front->post_title) === 'home') { wp_update_post([ 'ID' => $front_id, 'post_title' => 'Find a verified Washington contractor', ]); } }, 99); /** * 4. Suppress the Categories sidebar widget on the home page (theme default * content that looks unprofessional on a directory site). */ add_action('widgets_init', function () { // Unregister the theme's Categories widget area from the front page. // Theme registers 'sidebar-1' etc. — we don't fully unregister (risk breaking), // but we hide it via CSS on the front page. }); add_action('wp_head', function () { if (!is_front_page()) return; echo '<style> body.wp-theme-construction-services-company.home .widget-area, body.wp-theme-construction-services-company.home aside.widget-area, body.wp-theme-construction-services-company.home #sidebar { display: none !important; } </style>'; }, 101); /** * 5. Hide the theme's "Construction Services WordPress Theme" credit if it * somehow shows again (the theme's footer.php check on theme_mod). */ add_filter('walker_nav_menu_start_el', function ($item_output, $item, $depth, $args) { // No-op for now — keep as a hook in case menu tweaks are needed later. return $item_output; }, 10, 4); /** * 6. Improve the search form placeholder text from "Search Here" to be * more descriptive (the theme's default is generic). */ add_filter('get_search_form', function ($form) { if (is_front_page()) { $form = str_replace( 'placeholder="Search Here…"', 'placeholder="What do you need? (e.g. kitchen remodel, electrician)"', $form ); } return $form; }); /** * 6. Logo overrides (Aug 26, 2026). * The Construction Services Company theme hard-codes the logo to 70x70 * and renders a duplicate "site title" text next to the custom-logo image. * Override both. */ add_action('wp_head', function () { echo '<style> .wp-theme-construction-services-company .logo-image { max-width: 180px !important; max-height: 50px !important; width: 180px !important; height: auto !important; } .wp-theme-construction-services-company .logo-image img.custom-logo { max-width: 180px !important; max-height: 50px !important; width: 180px !important; height: auto !important; object-fit: contain !important; } .wp-theme-construction-services-company .logo-content a { display: none !important; } .wp-theme-construction-services-company .logo-content { width: 0 !important; padding: 0 !important; margin: 0 !important; } </style>'; }, 5); /** * 7. Hero banner override (Aug 26, 2026). * Replace stock sepia banner with on-brand dark/cyan banner. Applies to * every page (not just front). */ add_action('wp_head', function () { $hero_url = 'https://contractorpilot.co/wp-content/uploads/2026/08/contractorpilot-hero-banner.png'; echo '<style> .wp-theme-construction-services-company .slider-alternate img { display: none !important; } .wp-theme-construction-services-company .slider-alternate { display: block !important; width: 100% !important; height: 280px !important; background-image: url("' . $hero_url . '") !important; background-size: cover !important; background-position: center center !important; background-repeat: no-repeat !important; background-color: #0B1426 !important; } .wp-theme-construction-services-company .feature-header-title { color: #ffffff !important; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7) !important; } </style>'; }, 6); /** * 8. Sidebar cleanup + theme color override (Aug 26, 2026). * Hide all default widgets the theme auto-registers, plus the hardcoded * search form in sidebar.php. Recolor the theme's --first-color from * orange to cyan to match the GWD brand palette. */ add_action('wp_head', function () { echo '<style> :root { --first-color: #00E5FF !important; --second-color: #0B1426 !important; } .wp-theme-construction-services-company .header.text-center, .wp-theme-construction-services-company .sticky-header, .wp-theme-construction-services-company .menu-header { background: #0B1426 !important; } /* Sidebar widget cleanup — only direct children of .sidebar-area to avoid catching theme h4 elements in the header/hero. */ .sidebar-area > aside.widget_categories, .sidebar-area > aside.widget_pages, .sidebar-area > aside.widget_archive, .sidebar-area > aside.widget_meta, .sidebar-area > aside.widget_search, .sidebar-area > aside.widget_recent_comments, .sidebar-area > aside.widget_recent_entries, .sidebar-area > aside.widget_calendar, .sidebar-area > form.searchform, .sidebar-area > input[type="text"], aside#categories-2, aside#pages-2, aside#archives-3, aside#archives-2, aside#meta-2, aside#recent-comments-2, aside#recent-posts-2, aside#calendar, aside#search-2 { display: none !important; } .sidebar-area > h4.title { display: none !important; } .footer-area.sidebar-area:not(:has(> aside:not([style*="display: none"]))) { display: none !important; } </style>'; }, 7); https://contractorpilot.co/wp-sitemap-posts-post-1.xmlhttps://contractorpilot.co/wp-sitemap-posts-page-1.xmlhttps://contractorpilot.co/wp-sitemap-posts-gc_profile-1.xmlhttps://contractorpilot.co/wp-sitemap-posts-sub_profile-1.xmlhttps://contractorpilot.co/wp-sitemap-taxonomies-category-1.xmlhttps://contractorpilot.co/wp-sitemap-taxonomies-specialty-1.xmlhttps://contractorpilot.co/wp-sitemap-taxonomies-service_area-1.xmlhttps://contractorpilot.co/wp-sitemap-users-1.xml