]*class=["\'][^"\']*(?:whb-navigation|wd-header-nav|main-nav)[^"\']*["\'][^>]*)>/i', '
', $html, 1);\n }\n }\n\n // --- F. Fix Heading Order Skipping (A11y) ---\n // 1. Woodmart title containers on hero slider: convert h4/h3 to h2 (direct child under h1)\n $html = preg_replace_callback('/
]*class=["\'][^"\']*woodmart-title-container[^"\']*["\'][^>]*)>(.*?)<\/h[34]>/is', function($m) {\n return '' . $m[2] . '
';\n }, $html);\n\n // 2. Info box & banner titles: convert h4 to h3 (direct children under h2)\n $html = preg_replace_callback('/]*class=["\'][^"\']*(?:info-box-title|banner-title)[^"\']*["\'][^>]*)>(.*?)<\/h4>/is', function($m) {\n return '' . $m[2] . '
';\n }, $html);\n\n // --- G. Optimize LCP Hero Image (Performance) ---\n $html = preg_replace_callback('/
]*1\.-Surface-laptop\.jpg[^>]*)>/i', function($m) {\n $tag = $m[1];\n $tag = preg_replace('/\s*loading=["\'][^"\']*["\']/', '', $tag);\n $tag = preg_replace('/\s*decoding=["\'][^"\']*["\']/', '', $tag);\n $tag = preg_replace('/\s*fetchpriority=["\'][^"\']*["\']/', '', $tag);\n $tag .= ' loading="eager" decoding="sync" fetchpriority="high"';\n return '
';\n }, $html);\n\n // --- H. Guarantee an Accessible H1 Heading on Every Page ---\n if (!preg_match('/]*>/i', $html)) {\n $h1_text = $this->get_page_h1();\n $h1_tag = '' . esc_html($h1_text) . '
';\n // Insert right after or or \n if (preg_match('/(
]*>|]*class=["\'][^"\']*main-page-wrapper[^"\']*["\'][^>]*>|]*>)/i', $html, $matches)) {\n $target = $matches[0];\n $html = str_replace($target, $target . "\n" . $h1_tag, $html);\n }\n }\n\n return $html;\n }\n\n private function get_page_h1() {\n if (is_front_page() || is_home()) {\n return "Zoha Tech BD – Smart Tech, Simply Delivered";\n } elseif (function_exists('is_shop') && is_shop()) {\n return "Shop Authentic Gadgets & Electronics";\n } elseif (function_exists('is_product_category') && is_product_category()) {\n $term = get_queried_object();\n return $term ? $term->name : "Products";\n } elseif (is_singular()) {\n return get_the_title();\n }\n return "Zoha Tech BD";\n }\n\n /**\n * 9. Robots.txt Filter\n */\n public function filter_robots_txt($output, $public) {\n if ('0' === $public) {\n return $output;\n }\n\n $sitemap_url = home_url('/wp-sitemap.xml');\n $custom_rules = "User-agent: *\n";\n $custom_rules .= "Disallow: /wp-admin/\n";\n $custom_rules .= "Allow: /wp-admin/admin-ajax.php\n";\n $custom_rules .= "Disallow: /wp-content/uploads/wc-logs/\n";\n $custom_rules .= "Disallow: /wp-content/uploads/woocommerce_transient_files/\n";\n $custom_rules .= "Disallow: /wp-content/uploads/woocommerce_uploads/\n";\n $custom_rules .= "Disallow: /*?add-to-cart=\n";\n $custom_rules .= "Disallow: /*?*add-to-cart=\n";\n $custom_rules .= "Disallow: /cart/\n";\n $custom_rules .= "Disallow: /checkout/\n";\n $custom_rules .= "Disallow: /my-account/\n\n";\n $custom_rules .= "Sitemap: " . esc_url($sitemap_url) . "\n";\n\n return $custom_rules;\n }\n}\n\n// Initialize on plugins_loaded\nadd_action('plugins_loaded', ['Zoha_Master_SEO', 'get_instance'], 5);\n
Blog – zohatechbd.com
Skip to navigation
Skip to main content