/*!/wp-content/themes/hello-elementor-child/style.css*/// TMO FAQ Schema - Single Combined Output if (!function_exists('tmo_combined_faq_schema')){function tmo_combined_faq_schema(){static $already_output=false;if ($already_output || is_admin()){return}global $post;if (!$post){return}$content=$post->post_content;if (empty($content)){return}$all_faqs=array();// COLLECT from Pattern 6 (Product page format) if (preg_match_all('/<p[^>]*>\s*<(?:strong|b)[^>]*>(.*?\?[^<]*)<\/(?:strong|b)>\s*<br\s*\/?>\s*([^<]+.*?)<\/p>/is',$content,$matches)){for ($i=0;$i < count($matches[1]);$i++){$q=trim(html_entity_decode(strip_tags($matches[1][$i]),ENT_QUOTES | ENT_HTML5,'UTF-8'));$a=trim(html_entity_decode(strip_tags($matches[2][$i]),ENT_QUOTES | ENT_HTML5,'UTF-8'));if (strlen($a)>=40 && strpos($a,'?')===false){$all_faqs[]=array('q'=>$q,'a'=>$a)}}}// COLLECT from Pattern 1 (H2/H3/H4 questions) if (preg_match_all('/<h[234][^>]*>(.*?\?[^<]*)<\/h[234]>(.*?)(?=<h[234]|$)/is',$content,$matches)){for ($i=0;$i < count($matches[1]);$i++){$q=trim(html_entity_decode(strip_tags($matches[1][$i]),ENT_QUOTES | ENT_HTML5,'UTF-8'));$a=trim(html_entity_decode(strip_tags($matches[2][$i]),ENT_QUOTES | ENT_HTML5,'UTF-8'));if (strlen($a)>=40){$all_faqs[]=array('q'=>$q,'a'=>$a)}}}if (count($all_faqs) < 2){return}// Build ONE schema with ALL FAQs $schema=array('@context'=>'https://schema.org','@type'=>'FAQPage','mainEntity'=>array());foreach ($all_faqs as $faq){$schema['mainEntity'][]=array('@type'=>'Question','name'=>$faq['q'],'acceptedAnswer'=>array('@type'=>'Answer','text'=>$faq['a']))}$already_output=true;echo "\n<!-- Combined FAQ Schema -->\n";echo '<script type="application/ld+json">';echo json_encode($schema,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);echo '</script>' . "\n"}add_action('wp_head','tmo_combined_faq_schema',1)}