// Eliminar los JSON-LD por defecto add_action('template_redirect', function () { ob_start(function ($html) { return preg_replace_callback( '/]*type=["\']application\/ld\+json["\'][^>]*>(.*?)<\/script>/is', function ($m) { return (strpos($m[1], '"@type":"JobPosting"') !== false) ? '' : $m[0]; }, $html ); }); }, 0); // Insertar JSON-LD personalizados en add_action('wp_head', function () { if (!is_singular('job_listing')) return; global $post; $title = get_the_title($post); $permalink = get_permalink($post); $datePosted = get_post_time('c', true, $post); $validThrough = gmdate('Y-m-d\TH:i:s\Z', strtotime('+30 days', get_post_time('U', true, $post))); $org_name = get_post_meta($post->ID, '_company_name', true) ?: 'Empresa anónima'; $logo_url = get_post_meta($post->ID, '_company_logo', true) ?: 'https://future-jobs.net/wp-content/uploads/2025/07/logotipo-future-jobs.webp'; $address = get_post_meta($post->ID, '_job_address', true) ?: 'Dirección no especificada'; $prov_term = get_the_terms($post->ID, 'job_listing_location'); $province = (!is_wp_error($prov_term) && !empty($prov_term)) ? $prov_term[0]->name : 'Provincia no especificada'; $cats = get_the_terms($post->ID, 'job_listing_category') ?: []; $occupCat = implode(', ', wp_list_pluck($cats, 'name')); $salary = [ '@type' => 'MonetaryAmount', 'currency' => 'EUR', 'value' => [ '@type' => 'QuantitativeValue', 'value' => 'Según convenio', 'unitText' => 'MONTH', ], ]; $jobPosting = [ '@context' => 'https://schema.org', '@type' => 'JobPosting', 'title' => $title, 'description' => wp_strip_all_tags(get_the_content(null, false, $post)), 'datePosted' => $datePosted, 'validThrough' => $validThrough, 'employmentType' => 'Indefinido', 'hiringOrganization' => [ '@type' => 'Organization', 'name' => $org_name, 'logo' => $logo_url ], 'jobLocation' => [ '@type' => 'Place', 'address' => [ '@type' => 'PostalAddress', 'streetAddress' => $address, 'addressLocality' => $address, 'postalCode' => $address, 'addressRegion' => $province, 'addressCountry' => 'ES', ], ], 'identifier' => [ '@type' => 'PropertyValue', 'name' => 'ID de la oferta', 'value' => $post->ID, ], 'baseSalary' => $salary, 'occupationalCategory' => $occupCat, 'workHours' => 'Jornada Completa - Jornada Parcial', 'directApply' => true, 'applicationUrl' => 'https://www.future-jobs.net/postular-al-puesto/', 'skills' => ['Comunicación efectiva', 'Trabajo en equipo', 'Gestión de tiempo', 'Atención al detalle'], 'jobResponsibilities' => ['Atención al cliente', 'Manejo de tareas generales', 'Cumplimiento de procedimientos'], 'jobBenefits' => ['Horarios flexibles', 'Formación continua', 'Descuentos en empresas colaboradoras'], 'applicantLocationRequirements' => [ '@type' => 'Country', 'name' => 'España', ], ]; $breadcrumbs = [ '@context' => 'https://schema.org', '@type' => 'BreadcrumbList', 'itemListElement' => [ ['@type' => 'ListItem', 'position' => 1, 'name' => 'Inicio', 'item' => home_url('/')], ['@type' => 'ListItem', 'position' => 2, 'name' => 'Ofertas de empleo', 'item' => home_url('/ofertas/')], ['@type' => 'ListItem', 'position' => 3, 'name' => $title, 'item' => $permalink], ], ]; echo ''; echo ''; }, 5);