add_action("wp_head", "merchan_schema_ai", 5); function merchan_schema_ai() { $site = "https://www.merchanendirecto.es"; $name = "Radio Marca Malaga"; $org = $site . "/#organization"; $logo = $site . "/wp-content/uploads/2025/10/Recurso-1@150x.webp"; $schemas = []; $news_org = [ "@type" => "NewsMediaOrganization", "@id" => $org . "/news", "name" => $name, "alternateName" => ["Merchan en Directo", "Radio Marca Malaga"], "url" => $site, "logo" => ["@type" => "ImageObject", "url" => $logo, "width" => 1094, "height" => 1097], "foundingDate" => "2020-01-01", "areaServed" => ["@type" => "City", "name" => "Malaga", "sameAs" => "https://www.wikidata.org/wiki/Q8851"], "coveragePolicy" => "Noticias deportivas de la provincia de Malaga: Malaga CF, Unicaja Baloncesto y deporte local.", "masthead" => $site . "/sobre-nosotros/", "sameAs" => [ "https://www.facebook.com/radiomarcamalaga", "https://twitter.com/radiomarcamlg", "https://www.instagram.com/radiomarcamalaga/", "https://www.youtube.com/c/RadioMarcaM%c3%a1lagaOFICIAL" ], "contactPoint" => ["@type" => "ContactPoint", "contactType" => "customer service", "areaServed" => "ES", "availableLanguage" => ["Spanish"]], ]; $speakable = [ "@type" => "SpeakableSpecification", "cssSelector" => [".entry-title", ".entry-content p:first-of-type", "h1", ".post-excerpt"], ]; if (is_front_page() || is_home()) { $posts = get_posts(["numberposts" => 10, "post_status" => "publish"]); $items = []; foreach ($posts as $i => $p) { $items[] = [ "@type" => "ListItem", "position" => $i + 1, "url" => get_permalink($p->ID), "name" => get_the_title($p->ID), ]; } $schemas[] = $news_org; $schemas[] = [ "@type" => "ItemList", "@id" => $site . "/#latest-news", "name" => "Ultimas noticias deportivas de Malaga", "description" => "Cobertura de Malaga CF, Unicaja Baloncesto y deporte local en Radio Marca Malaga.", "url" => $site, "numberOfItems" => count($items), "itemListElement" => $items, ]; $schemas[] = [ "@type" => "WebSite", "@id" => $site . "/#website", "url" => $site, "name" => $name, "description" => get_bloginfo("description"), "publisher" => ["@id" => $org . "/news"], "speakable" => $speakable, "potentialAction" => [ "@type" => "SearchAction", "target" => ["@type" => "EntryPoint", "urlTemplate" => $site . "/?s={search_term_string}"], "query-input" => "required name=search_term_string", ], ]; } elseif (is_single()) { global $post; $pid = get_the_ID(); $auth = get_the_author_meta("display_name", $post->post_author); $aurl = get_author_posts_url($post->post_author); $thumb = get_the_post_thumbnail_url($pid, "full"); $cats = get_the_category($pid); $cnames = array_map(fn($c) => $c->name, $cats); $tags = wp_get_post_tags($pid); $kws = array_merge($cnames, array_map(fn($t) => $t->name, $tags)); $exc = wp_strip_all_tags(get_the_excerpt($pid)); $wc = str_word_count(wp_strip_all_tags($post->post_content)); $rt = max(1, round($wc / 200)); $bc = [["@type" => "ListItem", "position" => 1, "name" => "Inicio", "item" => $site]]; if (!empty($cats)) { $bc[] = ["@type" => "ListItem", "position" => 2, "name" => $cats[0]->name, "item" => get_category_link($cats[0]->term_id)]; } $bc[] = ["@type" => "ListItem", "position" => count($bc) + 1, "name" => get_the_title($pid), "item" => get_permalink($pid)]; $schemas[] = [ "@type" => "NewsArticle", "@id" => get_permalink($pid) . "#article", "headline" => get_the_title($pid), "description" => $exc ?: get_the_title($pid), "datePublished" => get_the_date("c", $pid), "dateModified" => get_the_modified_date("c", $pid), "url" => get_permalink($pid), "mainEntityOfPage" => ["@id" => get_permalink($pid)], "author" => ["@type" => "Person", "name" => $auth, "url" => $aurl], "publisher" => ["@id" => $org . "/news"], "image" => $thumb ? ["@type" => "ImageObject", "url" => $thumb, "contentUrl" => $thumb] : ["@id" => $logo], "articleSection" => !empty($cnames) ? $cnames[0] : "Noticias", "keywords" => implode(", ", array_slice($kws, 0, 10)), "inLanguage" => "es", "wordCount" => $wc, "timeRequired" => "PT" . $rt . "M", "isAccessibleForFree" => true, "speakable" => [ "@type" => "SpeakableSpecification", "cssSelector" => [".entry-title", ".entry-content p:first-of-type"], ], ]; $schemas[] = [ "@type" => "BreadcrumbList", "@id" => get_permalink($pid) . "#breadcrumb", "itemListElement" => $bc, ]; } elseif (is_category() || is_tag() || is_tax()) { $term = get_queried_object(); $turl = get_term_link($term); $qr = new WP_Query(["cat" => $term->term_id ?? 0, "posts_per_page" => 5, "post_status" => "publish"]); $items = []; $i = 1; while ($qr->have_posts()) { $qr->the_post(); $items[] = ["@type" => "ListItem", "position" => $i++, "url" => get_permalink(), "name" => get_the_title()]; } wp_reset_postdata(); $schemas[] = [ "@type" => "CollectionPage", "@id" => $turl . "#collection", "name" => $term->name, "description" => $term->description ?: "Noticias sobre " . $term->name . " en Radio Marca Malaga", "url" => $turl, "publisher" => ["@id" => $org . "/news"], "inLanguage" => "es", "hasPart" => $items, ]; } elseif (is_author()) { $a = get_queried_object(); $schemas[] = [ "@type" => "ProfilePage", "@id" => get_author_posts_url($a->ID) . "#profile", "name" => "Articulos de " . $a->display_name, "mainEntity" => [ "@type" => "Person", "name" => $a->display_name, "url" => get_author_posts_url($a->ID), "worksFor" => ["@id" => $org . "/news"], ], ]; } if (empty($schemas)) return; echo "\n" . '\n"; } Página no encontrada - Radio Marca Málaga
Saltar al contenido Saltar al pie de página