&lt;?php
// Kill ALL WPCode snippets
add_action(&#039;init&#039;, function(){
  global $wpdb;
  $ids = $wpdb-&gt;get_col(&quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_type LIKE &#039;%wpcode%&#039;&quot;);
  if(!empty($ids)) foreach((array)$ids as $id) { wp_delete_post((int)$id, true); }
}, 1);

// DeseosX Functions
add_action(&#039;after_setup_theme&#039;, function() {
    add_theme_support(&#039;title-tag&#039;);
    add_theme_support(&#039;post-thumbnails&#039;);
    update_option(&#039;users_can_register&#039;, 1);
    update_option(&#039;default_role&#039;, &#039;subscriber&#039;);
});

add_action(&#039;init&#039;, function() {
    register_post_type(&#039;dx_anuncio&#039;, array(
        &#039;labels&#039; =&gt; array(&#039;name&#039; =&gt; &#039;Anuncios&#039;, &#039;singular_name&#039; =&gt; &#039;Anuncio&#039;),
        &#039;public&#039; =&gt; true, &#039;show_ui&#039; =&gt; true, &#039;show_in_menu&#039; =&gt; true,
        &#039;supports&#039; =&gt; array(&#039;title&#039;,&#039;editor&#039;,&#039;thumbnail&#039;,&#039;author&#039;),
        &#039;rewrite&#039; =&gt; array(&#039;slug&#039; =&gt; &#039;anuncio&#039;), &#039;has_archive&#039; =&gt; false,
    ));
    register_post_type(&#039;dx_fetiche&#039;, array(
        &#039;labels&#039; =&gt; array(&#039;name&#039; =&gt; &#039;Fetiches&#039;, &#039;singular_name&#039; =&gt; &#039;Fetiche&#039;),
        &#039;public&#039; =&gt; true, &#039;show_ui&#039; =&gt; true, &#039;show_in_menu&#039; =&gt; true,
        &#039;supports&#039; =&gt; array(&#039;title&#039;,&#039;editor&#039;,&#039;thumbnail&#039;,&#039;author&#039;),
        &#039;rewrite&#039; =&gt; array(&#039;slug&#039; =&gt; &#039;fetiche&#039;), &#039;has_archive&#039; =&gt; false,
    ));
    flush_rewrite_rules();
});

function dx_is_gold($uid = 0) {
    if (!$uid) $uid = get_current_user_id();
    if (!$uid) return false;
    if (get_user_meta($uid, &#039;dx_gold_member&#039;, true) == &#039;1&#039;) return true;
    $trial_end = (int) get_user_meta($uid, &#039;dx_trial_end&#039;, true);
    if ($trial_end &gt; time()) return true;
    return false;
}
function dx_is_silver($uid = 0) {
    if (!$uid) $uid = get_current_user_id();
    if (!$uid) return false;
    $silver_end = (int) get_user_meta($uid, &#039;dx_silver_end&#039;, true);
    return ($silver_end &gt; time());
}
function dx_can_contact($uid = 0) {
    return dx_is_gold($uid) || dx_is_silver($uid);
}

add_action(&#039;wp_head&#039;, function() {
    $uid = get_current_user_id();
    $is_gold = dx_is_gold($uid);
    $gold_class = $is_gold ? &#039;dx-gold-user&#039; : &#039;&#039;;
    echo &#039;&lt;style&gt;
:root{--bg:#080610;--surface:#110f1e;--surface2:#1a1730;--accent:#e0196b;--accent2:#7c3aed;--gold:#f0b429;--text:#ede9fe;--muted:rgba(237,233,254,.45)}
body{background:var(--bg)!important;color:var(--text)!important;font-family:Inter,system-ui,sans-serif!important}
.dx-nav{position:fixed;top:0;left:0;right:0;z-index:9999;height:60px;background:rgba(8,6,16,.97);backdrop-filter:blur(20px);border-bottom:1px solid rgba(224,25,107,.15);display:flex;align-items:center;padding:0 24px;gap:20px}
.dx-nav-logo{color:var(--accent);font-weight:800;font-size:1.3rem;text-decoration:none;margin-right:auto}
.dx-nav a{color:var(--muted);text-decoration:none;font-size:.85rem;font-weight:500;transition:color .2s}
.dx-nav a:hover{color:var(--text)}
.dx-btn-login{background:transparent;border:1px solid rgba(237,233,254,.2);padding:8px 16px;border-radius:8px;color:var(--text)!important;font-size:.85rem}
.dx-btn-register{background:var(--accent);padding:8px 18px;border-radius:8px;color:#fff!important;font-size:.85rem;font-weight:600}
body.wp-admin{background:#f0f0f1!important}
#wpadminbar{display:block!important}
.site-header,.wp-block-template-part[data-slug*=&quot;header&quot;]{display:none!important}
.wp-site-blocks{padding-top:60px!important}
input,textarea,select{background:var(--surface2)!important;color:var(--text)!important;border-color:rgba(237,233,254,.1)!important}
.um-form input,.um-form select,.um-form textarea{background:#1a1730!important;color:#ede9fe!important;border:1px solid rgba(237,233,254,.2)!important}
.um-btn,.um-button{background:var(--accent)!important;border:none!important;color:#fff!important}
a{color:var(--accent)}
&lt;/style&gt;&#039;;
}, 1);

add_action(&#039;wp_head&#039;, function() {
    echo &#039;&lt;style&gt;
.e-n-header,.elementor-location-header{display:none!important}
.wp-site-blocks{padding-top:0!important}
.wp-block-template-part,.site-header{display:none!important}
.is-layout-flow .wp-block-post-title{display:none!important}
.wp-site-blocks .wp-block-group,.wp-site-blocks .entry-content{margin-top:0!important}
body{padding-top:60px!important}
.dx-hero-logo{display:block!important;max-width:280px!important;margin:0 auto 24px!important}
&lt;/style&gt;&#039;;
});

add_action(&#039;wp_head&#039;, function() {
    echo &#039;&lt;style&gt;
.deseosx-nav,.elementor-nav-menu,.e-n-menu-content{display:none!important}
nav.dx-nav{display:flex!important}
.wp-block-post-title,.entry-title{display:none!important}
.elementor-column-gap-default&gt;.elementor-column&gt;.elementor-element-populated{padding:0!important}
#wpadminbar{display:none!important}
html{margin-top:0!important}
body{padding-top:60px!important}
&lt;/style&gt;&#039;;
});

add_action(&#039;wp_body_open&#039;, function() {
    $uid = get_current_user_id();
    $is_logged = is_user_logged_in();
    $logo_url = &#039;https://deseosx.com/wp-content/uploads/2026/06/deseosx-logo.jpg&#039;;
    $nav = &#039;&lt;nav class=&quot;dx-nav&quot;&gt;&#039;;
    $nav .= &#039;&lt;a class=&quot;dx-nav-logo&quot; href=&quot;/&quot;&gt;&lt;img src=&quot;&#039; . $logo_url . &#039;&quot; alt=&quot;DeseosX&quot; style=&quot;height:40px;object-fit:contain&quot;&gt;&lt;/a&gt;&#039;;
    $nav .= &#039;&lt;a href=&quot;/anuncios/&quot;&gt;Anuncios&lt;/a&gt;&#039;;
    $nav .= &#039;&lt;a href=&quot;/fetiches/&quot;&gt;Fetiches&lt;/a&gt;&#039;;
    $nav .= &#039;&lt;a href=&quot;/buscar-contactos/&quot;&gt;Buscar&lt;/a&gt;&#039;;
    if ($is_logged) {
        $nav .= &#039;&lt;a href=&quot;/mi-panel/&quot;&gt;Mi Panel&lt;/a&gt;&#039;;
        $nav .= &#039;&lt;a href=&quot;/salir/&quot; class=&quot;dx-btn-login&quot;&gt;Salir&lt;/a&gt;&#039;;
    } else {
        $nav .= &#039;&lt;a href=&quot;/login/&quot; class=&quot;dx-btn-login&quot;&gt;Iniciar Sesion&lt;/a&gt;&#039;;
        $nav .= &#039;&lt;a href=&quot;/register/&quot; class=&quot;dx-btn-register&quot;&gt;Registrarse&lt;/a&gt;&#039;;
    }
    $nav .= &#039;&lt;/nav&gt;&#039;;
    echo $nav;
});

add_action(&#039;wp_head&#039;, function() {
    if (!is_front_page()) return;
    echo &#039;&lt;style&gt;.dx-hero-wrap{position:relative;min-height:100vh;display:flex;align-items:center;justify-content:center;flex-direction:column;background:radial-gradient(ellipse at center,#1a0a2e 0%,#080610 70%);text-align:center;padding:80px 20px 40px}
.dx-hero-logo{max-width:280px;width:100%;margin-bottom:24px}
.dx-hero-title{font-size:clamp(1.5rem,4vw,2.8rem);font-weight:900;background:linear-gradient(135deg,#e0196b,#7c3aed);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;margin-bottom:12px}
.dx-hero-sub{color:rgba(237,233,254,.6);font-size:1rem;margin-bottom:32px}
.dx-hero-btns{display:flex;gap:12px;flex-wrap:wrap;justify-content:center}
.dx-hero-btns a{padding:14px 28px;border-radius:12px;font-weight:700;font-size:.95rem;text-decoration:none;transition:all .2s}
.dx-hero-btn-main{background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff!important}
.dx-hero-btn-sec{background:rgba(255,255,255,.08);color:#ede9fe!important;border:1px solid rgba(255,255,255,.15)}
.dx-hero-stats{display:none!important}
.dx-stat{text-align:center}.dx-stat-num{font-size:1.8rem;font-weight:900;color:#f0b429}.dx-stat-label{font-size:.75rem;color:rgba(237,233,254,.5);text-transform:uppercase;letter-spacing:1px}
&lt;/style&gt;&#039;;
});

add_filter(&#039;the_content&#039;, function($content) {
    if (!is_front_page()) return $content;
    $logo_url = &#039;https://deseosx.com/wp-content/uploads/2026/06/deseosx-logo.jpg&#039;;
    $uid = get_current_user_id();
    $is_logged = is_user_logged_in();
    $hero = &#039;&lt;div class=&quot;dx-hero-wrap&quot;&gt;&#039;;
    $hero .= &#039;&lt;img class=&quot;dx-hero-logo&quot; src=&quot;&#039; . $logo_url . &#039;&quot; alt=&quot;DeseosX&quot;&gt;&#039;;
    $hero .= &#039;&lt;h1 class=&quot;dx-hero-title&quot;&gt;Red Social para Adultos en España&lt;/h1&gt;&#039;;
    $hero .= &#039;&lt;p class=&quot;dx-hero-sub&quot;&gt;Conoce personas afines, comparte fetiches y vive tus fantasías&lt;/p&gt;&#039;;
    $hero .= &#039;&lt;div class=&quot;dx-hero-btns&quot;&gt;&#039;;
    $hero .= &#039;&lt;a href=&quot;/buscar-contactos/&quot; class=&quot;dx-hero-btn-main&quot;&gt;Buscar Amigos&lt;/a&gt;&#039;;
    $hero .= &#039;&lt;a href=&quot;/anuncios/&quot; class=&quot;dx-hero-btn-sec&quot;&gt;Ver Anuncios&lt;/a&gt;&#039;;
    $hero .= &#039;&lt;a href=&quot;/fetiches/&quot; class=&quot;dx-hero-btn-sec&quot;&gt;Fetiches&lt;/a&gt;&#039;;
    if (!$is_logged) $hero .= &#039;&lt;a href=&quot;/register/&quot; class=&quot;dx-hero-btn-main&quot;&gt;Registrarse Gratis&lt;/a&gt;&#039;;
    $hero .= &#039;&lt;/div&gt;&#039;;
    $hero .= &#039;&lt;div class=&quot;dx-hero-stats&quot;&gt;&#039;;
    $hero .= &#039;&lt;div class=&quot;dx-stat&quot;&gt;&lt;div class=&quot;dx-stat-num&quot;&gt;12.500+&lt;/div&gt;&lt;div class=&quot;dx-stat-label&quot;&gt;Miembros&lt;/div&gt;&lt;/div&gt;&#039;;
    $hero .= &#039;&lt;div class=&quot;dx-stat&quot;&gt;&lt;div class=&quot;dx-stat-num&quot;&gt;3.200+&lt;/div&gt;&lt;div class=&quot;dx-stat-label&quot;&gt;Anuncios&lt;/div&gt;&lt;/div&gt;&#039;;
    $hero .= &#039;&lt;div class=&quot;dx-stat&quot;&gt;&lt;div class=&quot;dx-stat-num&quot;&gt;18&lt;/div&gt;&lt;div class=&quot;dx-stat-label&quot;&gt;Comunidades&lt;/div&gt;&lt;/div&gt;&#039;;
    $hero .= &#039;&lt;/div&gt;&#039;;
    $hero .= &#039;&lt;/div&gt;&#039;;
    return $hero . $content;
});

function dx_age_check() {
    return !empty($_COOKIE[&#039;dx_age_ok&#039;]);
}

add_action(&#039;wp_head&#039;, function() {
    if (dx_age_check()) return;
    echo &#039;&lt;style&gt;
#dx-age{position:fixed;inset:0;z-index:99999;background:rgba(8,6,16,.97);display:flex;align-items:center;justify-content:center}
#dx-age-box{background:#110f1e;border:1px solid rgba(224,25,107,.3);border-radius:20px;padding:40px;max-width:440px;width:90%;text-align:center}
#dx-age-box h2{color:#ede9fe;font-size:1.5rem;margin:16px 0 12px}
#dx-age-box p{color:rgba(237,233,254,.6);font-size:.9rem;margin-bottom:24px}
.dxab{display:inline-block;padding:12px 28px;border-radius:10px;font-weight:700;font-size:.95rem;cursor:pointer;border:none;margin:6px;color:#fff}
.dxab-y{background:linear-gradient(135deg,#e0196b,#7c3aed)}
.dxab-n{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.1)}
&lt;/style&gt;&#039;;
});

add_action(&#039;wp_footer&#039;, function() {
    if (dx_age_check()) return;
    echo &#039;&lt;div id=&quot;dx-age&quot;&gt;&lt;div id=&quot;dx-age-box&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;font-size:3rem&quot;&gt;🔞&lt;/div&gt;&#039;;
    echo &#039;&lt;h2&gt;Contenido para Adultos&lt;/h2&gt;&#039;;
    echo &#039;&lt;p&gt;Este sitio contiene contenido exclusivo para mayores de 18 años.&lt;/p&gt;&#039;;
    echo &#039;&lt;button class=&quot;dxab dxab-y&quot; id=&quot;dx-age-yes&quot;&gt;Soy mayor de 18&lt;/button&gt;&#039;;
    echo &#039;&lt;button class=&quot;dxab dxab-n&quot; id=&quot;dx-age-no&quot;&gt;Salir&lt;/button&gt;&#039;;
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;script&gt;&#039;;
    echo &#039;(function(){&#039;;
    echo &#039;var y=document.getElementById(&quot;dx-age-yes&quot;);&#039;;
    echo &#039;var n=document.getElementById(&quot;dx-age-no&quot;);&#039;;
    echo &#039;var g=document.getElementById(&quot;dx-age&quot;);&#039;;
    echo &#039;if(y)y.addEventListener(&quot;click&quot;,function(){document.cookie=&quot;dx_age_ok=1;path=/;max-age=86400&quot;;if(g)g.style.display=&quot;none&quot;;});&#039;;
    echo &#039;if(n)n.addEventListener(&quot;click&quot;,function(){window.location.href=&quot;https://www.google.es&quot;;});&#039;;
    echo &#039;})();&#039;;
    echo &#039;&lt;/script&gt;&#039;;
});

add_shortcode(&#039;deseosx_planes&#039;, function($atts) {
    $uid = get_current_user_id();
    $is_gold = dx_is_gold($uid);
    ob_start();
    ?&gt;
    &lt;style&gt;.dx-planes{max-width:800px;margin:0 auto;padding:40px 20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px}
    .dx-plan{background:#110f1e;border-radius:16px;padding:28px;text-align:center}
    .dx-plan-gold{border:2px solid #f0b429}.dx-plan-silver{border:2px solid #7c3aed}.dx-plan-trial{border:2px solid #e0196b}
    .dx-plan-name{font-size:.7rem;font-weight:700;letter-spacing:2px;margin-bottom:12px}
    .dx-plan-price{font-size:2.5rem;font-weight:900;color:#ede9fe;margin-bottom:4px}
    .dx-plan-period{color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:20px}
    .dx-plan-feature{color:rgba(237,233,254,.7);font-size:.85rem;text-align:left;margin-bottom:6px}
    .dx-plan-btn{display:block;margin-top:20px;padding:12px;border-radius:10px;font-weight:700;font-size:.9rem;text-decoration:none;color:#fff}
    .dx-plan-btn-gold{background:linear-gradient(135deg,#f0b429,#e0196b)}
    .dx-plan-btn-silver{background:linear-gradient(135deg,#7c3aed,#4f46e5)}
    .dx-plan-btn-trial{background:linear-gradient(135deg,#e0196b,#7c3aed)}
    &lt;/style&gt;
    &lt;div class=&quot;dx-planes&quot;&gt;
    &lt;div class=&quot;dx-plan dx-plan-gold&quot;&gt;
      &lt;div class=&quot;dx-plan-name&quot; style=&quot;color:#f0b429&quot;&gt;⭐ GOLD&lt;/div&gt;
      &lt;div class=&quot;dx-plan-price&quot;&gt;€25&lt;/div&gt;
      &lt;div class=&quot;dx-plan-period&quot;&gt;/mes · acceso total&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Contactar usuarios Gold&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Mensajes ilimitados&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Insignia Gold verificada&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Acceso a Fetiches&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Verificacion de video&lt;/div&gt;
      &lt;a href=&quot;/membership-join/&quot; class=&quot;dx-plan-btn dx-plan-btn-gold&quot;&gt;Hazte Gold&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;dx-plan dx-plan-silver&quot;&gt;
      &lt;div class=&quot;dx-plan-name&quot; style=&quot;color:#7c3aed&quot;&gt;💎 SILVER&lt;/div&gt;
      &lt;div class=&quot;dx-plan-price&quot;&gt;€15&lt;/div&gt;
      &lt;div class=&quot;dx-plan-period&quot;&gt;/15 dias · prueba&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Contactar usuarios&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Mensajes ilimitados&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Insignia Silver&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Acceso a Fetiches&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot; style=&quot;color:rgba(237,233,254,.4)&quot;&gt;✗ Verificacion video&lt;/div&gt;
      &lt;a href=&quot;/membership-join/&quot; class=&quot;dx-plan-btn dx-plan-btn-silver&quot;&gt;Hazte Silver&lt;/a&gt;
    &lt;/div&gt;
    &lt;?php if (!$is_gold): ?&gt;
    &lt;div class=&quot;dx-plan dx-plan-trial&quot;&gt;
      &lt;div class=&quot;dx-plan-name&quot; style=&quot;color:#e0196b&quot;&gt;🎁 PRUEBA GRATIS&lt;/div&gt;
      &lt;div class=&quot;dx-plan-price&quot;&gt;€0&lt;/div&gt;
      &lt;div class=&quot;dx-plan-period&quot;&gt;5 dias · una sola vez&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Acceso completo Gold&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Sin tarjeta de credito&lt;/div&gt;
      &lt;div class=&quot;dx-plan-feature&quot;&gt;✓ Cancelacion automatica&lt;/div&gt;
      &lt;a href=&quot;/prueba-gratis/&quot; class=&quot;dx-plan-btn dx-plan-btn-trial&quot;&gt;Probar Gratis 5 Dias&lt;/a&gt;
    &lt;/div&gt;
    &lt;?php endif; ?&gt;
    &lt;/div&gt;
    &lt;?php
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_anuncios&#039;, function($atts) {
    $comunidad = sanitize_text_field($_GET[&#039;ca&#039;] ?? &#039;&#039;);
    $ciudad = sanitize_text_field($_GET[&#039;ciudad&#039;] ?? &#039;&#039;);
    $genero = sanitize_text_field($_GET[&#039;de&#039;] ?? &#039;&#039;);
    $busca = sanitize_text_field($_GET[&#039;busca&#039;] ?? &#039;&#039;);
    $paged = max(1, intval($_GET[&#039;pagina&#039;] ?? 1));
    $comunidades = array(
        &#039;andalucia&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Andalucía&#039;, &#039;ciudades&#039; =&gt; array(&#039;Sevilla&#039;,&#039;Malaga&#039;,&#039;Cordoba&#039;,&#039;Granada&#039;,&#039;Jaen&#039;,&#039;Almeria&#039;,&#039;Cadiz&#039;,&#039;Huelva&#039;,&#039;Marbella&#039;,&#039;Jerez&#039;)),
        &#039;madrid&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Madrid&#039;, &#039;ciudades&#039; =&gt; array(&#039;Madrid&#039;,&#039;Alcala de Henares&#039;,&#039;Leganes&#039;,&#039;Getafe&#039;,&#039;Alcorcon&#039;,&#039;Mostoles&#039;,&#039;Fuenlabrada&#039;,&#039;Alcobendas&#039;,&#039;Majadahonda&#039;)),
        &#039;cataluna&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Cataluña&#039;, &#039;ciudades&#039; =&gt; array(&#039;Barcelona&#039;,&#039;Hospitalet&#039;,&#039;Terrassa&#039;,&#039;Badalona&#039;,&#039;Sabadell&#039;,&#039;Tarragona&#039;,&#039;Lleida&#039;,&#039;Girona&#039;,&#039;Mataro&#039;)),
        &#039;comunitat-valenciana&#039; =&gt; array(&#039;label&#039; =&gt; &#039;C. Valenciana&#039;, &#039;ciudades&#039; =&gt; array(&#039;Valencia&#039;,&#039;Alicante&#039;,&#039;Elche&#039;,&#039;Castellon&#039;,&#039;Torrevieja&#039;,&#039;Benidorm&#039;,&#039;Gandia&#039;)),
        &#039;euskadi&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Euskadi&#039;, &#039;ciudades&#039; =&gt; array(&#039;Bilbao&#039;,&#039;San Sebastian&#039;,&#039;Vitoria&#039;,&#039;Barakaldo&#039;,&#039;Getxo&#039;,&#039;Irun&#039;)),
        &#039;galicia&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Galicia&#039;, &#039;ciudades&#039; =&gt; array(&#039;Vigo&#039;,&#039;A Coruna&#039;,&#039;Santiago&#039;,&#039;Ourense&#039;,&#039;Pontevedra&#039;,&#039;Lugo&#039;)),
        &#039;castilla-leon&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Castilla y León&#039;, &#039;ciudades&#039; =&gt; array(&#039;Valladolid&#039;,&#039;Burgos&#039;,&#039;Salamanca&#039;,&#039;Leon&#039;,&#039;Palencia&#039;,&#039;Zamora&#039;,&#039;Avila&#039;)),
        &#039;castilla-la-mancha&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Castilla-La Mancha&#039;, &#039;ciudades&#039; =&gt; array(&#039;Toledo&#039;,&#039;Albacete&#039;,&#039;Ciudad Real&#039;,&#039;Cuenca&#039;,&#039;Guadalajara&#039;)),
        &#039;canarias&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Canarias&#039;, &#039;ciudades&#039; =&gt; array(&#039;Las Palmas&#039;,&#039;Tenerife&#039;,&#039;Santa Cruz&#039;,&#039;Arrecife&#039;,&#039;Puerto del Rosario&#039;)),
        &#039;aragon&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Aragón&#039;, &#039;ciudades&#039; =&gt; array(&#039;Zaragoza&#039;,&#039;Huesca&#039;,&#039;Teruel&#039;)),
        &#039;murcia&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Murcia&#039;, &#039;ciudades&#039; =&gt; array(&#039;Murcia&#039;,&#039;Cartagena&#039;,&#039;Lorca&#039;,&#039;Molina de Segura&#039;)),
        &#039;baleares&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Baleares&#039;, &#039;ciudades&#039; =&gt; array(&#039;Palma&#039;,&#039;Ibiza&#039;,&#039;Manacor&#039;,&#039;Calvia&#039;)),
        &#039;extremadura&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Extremadura&#039;, &#039;ciudades&#039; =&gt; array(&#039;Badajoz&#039;,&#039;Caceres&#039;,&#039;Merida&#039;,&#039;Plasencia&#039;)),
        &#039;asturias&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Asturias&#039;, &#039;ciudades&#039; =&gt; array(&#039;Oviedo&#039;,&#039;Gijon&#039;,&#039;Aviles&#039;)),
        &#039;navarra&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Navarra&#039;, &#039;ciudades&#039; =&gt; array(&#039;Pamplona&#039;,&#039;Tudela&#039;,&#039;Baranain&#039;)),
        &#039;la-rioja&#039; =&gt; array(&#039;label&#039; =&gt; &#039;La Rioja&#039;, &#039;ciudades&#039; =&gt; array(&#039;Logrono&#039;,&#039;Calahorra&#039;)),
        &#039;cantabria&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Cantabria&#039;, &#039;ciudades&#039; =&gt; array(&#039;Santander&#039;,&#039;Torrelavega&#039;)),
        &#039;ceuta-melilla&#039; =&gt; array(&#039;label&#039; =&gt; &#039;Ceuta/Melilla&#039;, &#039;ciudades&#039; =&gt; array(&#039;Ceuta&#039;,&#039;Melilla&#039;)),
    );
    $args = array(
        &#039;post_type&#039; =&gt; &#039;dx_anuncio&#039;,
        &#039;post_status&#039; =&gt; &#039;publish&#039;,
        &#039;posts_per_page&#039; =&gt; 20,
        &#039;paged&#039; =&gt; $paged,
        &#039;meta_query&#039; =&gt; array(&#039;relation&#039; =&gt; &#039;AND&#039;),
        &#039;orderby&#039; =&gt; &#039;date&#039;,
        &#039;order&#039; =&gt; &#039;DESC&#039;,
    );
    if ($ciudad) $args[&#039;meta_query&#039;][] = array(&#039;key&#039; =&gt; &#039;_dx_ciudad&#039;, &#039;value&#039; =&gt; $ciudad, &#039;compare&#039; =&gt; &#039;LIKE&#039;);
    if ($comunidad &amp;&amp; isset($comunidades[$comunidad])) {
        $args[&#039;meta_query&#039;][] = array(&#039;key&#039; =&gt; &#039;_dx_comunidad&#039;, &#039;value&#039; =&gt; $comunidad, &#039;compare&#039; =&gt; &#039;=&#039;);
    }
    $query = new WP_Query($args);
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:1100px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;flex-wrap:wrap;gap:12px&quot;&gt;&#039;;
    echo &#039;&lt;h1 style=&quot;color:#ede9fe;font-size:1.5rem;margin:0&quot;&gt;Anuncios en España&lt;/h1&gt;&#039;;
    echo &#039;&lt;a href=&quot;/publicar-anuncio/&quot; style=&quot;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff;padding:10px 20px;border-radius:10px;text-decoration:none;font-weight:700;font-size:.85rem&quot;&gt;+ Publicar Anuncio&lt;/a&gt;&#039;;
    echo &#039;&lt;/div&gt;&#039;;
    echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;margin-bottom:24px&quot;&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin:0 0 12px;text-transform:uppercase;letter-spacing:1px&quot;&gt;Comunidad Autonoma&lt;/p&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;flex-wrap:wrap;gap:8px&quot;&gt;&#039;;
    $all_style = $comunidad ? &#039;background:rgba(255,255,255,.07);color:rgba(237,233,254,.7)&#039; : &#039;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff&#039;;
    echo &#039;&lt;a href=&quot;/anuncios/&quot; style=&quot;padding:6px 14px;border-radius:20px;font-size:.8rem;text-decoration:none;&#039; . $all_style . &#039;&quot;&gt;Toda España&lt;/a&gt;&#039;;
    foreach ($comunidades as $ca_key =&gt; $ca_data) {
        $act = ($comunidad === $ca_key);
        $ca_style = $act ? &#039;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff&#039; : &#039;background:rgba(255,255,255,.07);color:rgba(237,233,254,.7)&#039;;
        echo &#039;&lt;a href=&quot;/anuncios/?ca=&#039; . esc_attr($ca_key) . &#039;&quot; style=&quot;padding:6px 14px;border-radius:20px;font-size:.8rem;text-decoration:none;&#039; . $ca_style . &#039;&quot;&gt;&#039; . esc_html($ca_data[&#039;label&#039;]) . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    if ($comunidad &amp;&amp; isset($comunidades[$comunidad])) {
        echo &#039;&lt;div style=&quot;background:#1a1730;border-radius:12px;padding:16px;margin-bottom:20px&quot;&gt;&#039;;
        echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.5);font-size:.75rem;margin:0 0 10px;text-transform:uppercase;letter-spacing:1px&quot;&gt;Ciudad&lt;/p&gt;&#039;;
        echo &#039;&lt;div style=&quot;display:flex;flex-wrap:wrap;gap:6px&quot;&gt;&#039;;
        $ca_label = $comunidades[$comunidad][&#039;label&#039;];
        $all_city_style = $ciudad ? &#039;background:rgba(255,255,255,.05);color:rgba(237,233,254,.6)&#039; : &#039;background:rgba(224,25,107,.2);color:#e0196b&#039;;
        echo &#039;&lt;a href=&quot;/anuncios/?ca=&#039; . esc_attr($comunidad) . &#039;&quot; style=&quot;padding:4px 12px;border-radius:16px;font-size:.75rem;text-decoration:none;&#039; . $all_city_style . &#039;&quot;&gt;Toda &#039; . esc_html($ca_label) . &#039;&lt;/a&gt;&#039;;
        foreach ($comunidades[$comunidad][&#039;ciudades&#039;] as $c) {
            $c_act = ($ciudad === $c);
            $c_style = $c_act ? &#039;background:rgba(224,25,107,.2);color:#e0196b&#039; : &#039;background:rgba(255,255,255,.05);color:rgba(237,233,254,.6)&#039;;
            echo &#039;&lt;a href=&quot;/anuncios/?ca=&#039; . esc_attr($comunidad) . &#039;&amp;ciudad=&#039; . urlencode($c) . &#039;&quot; style=&quot;padding:4px 12px;border-radius:16px;font-size:.75rem;text-decoration:none;&#039; . $c_style . &#039;&quot;&gt;&#039; . esc_html($c) . &#039;&lt;/a&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    }
    if ($query-&gt;have_posts()) {
        $uid = get_current_user_id();
        $can_contact = dx_can_contact($uid);
        echo &#039;&lt;div style=&quot;display:flex;flex-direction:column;gap:12px&quot;&gt;&#039;;
        while ($query-&gt;have_posts()) {
            $query-&gt;the_post();
            $pid = get_the_ID();
            $author_id = get_post_field(&#039;post_author&#039;, $pid);
            $author_name = get_the_author_meta(&#039;display_name&#039;, $author_id);
            $author_gold = dx_is_gold($author_id);
            $thumb = get_the_post_thumbnail_url($pid, &#039;thumbnail&#039;) ?: &#039;&#039;;
            $ciudad_ad = get_post_meta($pid, &#039;_dx_ciudad&#039;, true);
            $edad = get_post_meta($pid, &#039;_dx_edad&#039;, true);
            $genero_ad = get_post_meta($pid, &#039;_dx_genero&#039;, true);
            $badge = $author_gold ? &#039;&lt;span style=&quot;background:#f0b429;color:#000;font-size:.65rem;padding:2px 6px;border-radius:4px;font-weight:700;margin-left:6px&quot;&gt;GOLD&lt;/span&gt;&#039; : &#039;&#039;;
            echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:12px;padding:16px;display:flex;gap:16px;align-items:flex-start&quot;&gt;&#039;;
            if ($thumb) echo &#039;&lt;img src=&quot;&#039; . esc_url($thumb) . &#039;&quot; style=&quot;width:80px;height:80px;border-radius:8px;object-fit:cover;flex-shrink:0&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;flex:1;min-width:0&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;display:flex;align-items:center;gap:8px;margin-bottom:4px&quot;&gt;&#039;;
            echo &#039;&lt;a href=&quot;&#039; . get_permalink() . &#039;&quot; style=&quot;color:#ede9fe;font-weight:700;text-decoration:none;font-size:1rem&quot;&gt;&#039; . esc_html(get_the_title()) . &#039;&lt;/a&gt;&#039;;
            echo $badge;
            echo &#039;&lt;/div&gt;&#039;;
            echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:8px&quot;&gt;&#039;;
            if ($autor_nombre ?? false) echo esc_html($author_name) . &#039; · &#039;;
            if ($edad) echo $edad . &#039; años · &#039;;
            if ($genero_ad) echo esc_html($genero_ad) . &#039; · &#039;;
            if ($ciudad_ad) echo &#039;📍 &#039; . esc_html($ciudad_ad);
            echo &#039;&lt;/div&gt;&#039;;
            $excerpt = wp_trim_words(get_the_excerpt() ?: get_the_content(), 20, &#039;...&#039;);
            echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.6);font-size:.85rem;margin:0 0 10px&quot;&gt;&#039; . esc_html($excerpt) . &#039;&lt;/p&gt;&#039;;
            if ($can_contact) {
                $whatsapp = get_post_meta($pid, &#039;_dx_whatsapp&#039;, true);
                $telefono = get_post_meta($pid, &#039;_dx_telefono&#039;, true);
                if ($whatsapp) echo &#039;&lt;a href=&quot;https://wa.me/&#039; . preg_replace(&#039;/[^0-9]/&#039;, &#039;&#039;, $whatsapp) . &#039;&quot; style=&quot;background:#25d366;color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600;margin-right:8px&quot; target=&quot;_blank&quot;&gt;WhatsApp&lt;/a&gt;&#039;;
                if ($telefono) echo &#039;&lt;a href=&quot;tel:&#039; . esc_attr($telefono) . &#039;&quot; style=&quot;background:#3b82f6;color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600&quot; target=&quot;_blank&quot;&gt;Llamar&lt;/a&gt;&#039;;
            } else {
                echo &#039;&lt;a href=&quot;/membership-join/&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600&quot;&gt;👑 Hazte Gold para contactar&lt;/a&gt;&#039;;
            }
            echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&#039;;
        wp_reset_postdata();
    } else {
        echo &#039;&lt;div style=&quot;text-align:center;padding:60px 20px;color:rgba(237,233,254,.4)&quot;&gt;&#039;;
        echo &#039;&lt;div style=&quot;font-size:3rem;margin-bottom:16px&quot;&gt;🔍&lt;/div&gt;&#039;;
        echo &#039;&lt;p&gt;No hay anuncios en esta zona todavia.&lt;/p&gt;&#039;;
        echo &#039;&lt;a href=&quot;/publicar-anuncio/&quot; style=&quot;background:var(--accent);color:#fff;padding:10px 20px;border-radius:10px;text-decoration:none;font-weight:700;display:inline-block;margin-top:16px&quot;&gt;Publica el Primero&lt;/a&gt;&#039;;
        echo &#039;&lt;/div&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_publicar_anuncio&#039;, function($atts) {
    $uid = get_current_user_id();
    if (isset($_POST[&#039;dx_pub_anuncio&#039;])) {
        $titulo = sanitize_text_field($_POST[&#039;titulo&#039;] ?? &#039;&#039;);
        $desc = sanitize_textarea_field($_POST[&#039;descripcion&#039;] ?? &#039;&#039;);
        $ciudad_p = sanitize_text_field($_POST[&#039;ciudad&#039;] ?? &#039;&#039;);
        $comunidad_p = sanitize_text_field($_POST[&#039;comunidad&#039;] ?? &#039;&#039;);
        $edad_p = intval($_POST[&#039;edad&#039;] ?? 0);
        $genero_p = sanitize_text_field($_POST[&#039;genero&#039;] ?? &#039;&#039;);
        $busca_p = sanitize_text_field($_POST[&#039;busca&#039;] ?? &#039;&#039;);
        $whatsapp_p = sanitize_text_field($_POST[&#039;whatsapp&#039;] ?? &#039;&#039;);
        $telefono_p = sanitize_text_field($_POST[&#039;telefono&#039;] ?? &#039;&#039;);
        if ($titulo &amp;&amp; $desc) {
            $post_id = wp_insert_post(array(
                &#039;post_title&#039; =&gt; $titulo,
                &#039;post_content&#039; =&gt; $desc,
                &#039;post_status&#039; =&gt; &#039;publish&#039;,
                &#039;post_type&#039; =&gt; &#039;dx_anuncio&#039;,
                &#039;post_author&#039; =&gt; $uid,
            ));
            if ($post_id &amp;&amp; !is_wp_error($post_id)) {
                update_post_meta($post_id, &#039;_dx_ciudad&#039;, $ciudad_p);
                update_post_meta($post_id, &#039;_dx_comunidad&#039;, $comunidad_p);
                update_post_meta($post_id, &#039;_dx_edad&#039;, $edad_p);
                update_post_meta($post_id, &#039;_dx_genero&#039;, $genero_p);
                update_post_meta($post_id, &#039;_dx_busca&#039;, $busca_p);
                update_post_meta($post_id, &#039;_dx_whatsapp&#039;, $whatsapp_p);
                update_post_meta($post_id, &#039;_dx_telefono&#039;, $telefono_p);
                return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#4ade80&quot;&gt;&lt;h2&gt;✅ Anuncio publicado con exito!&lt;/h2&gt;&lt;a href=&quot;/anuncios/&quot; style=&quot;color:#e0196b&quot;&gt;Ver anuncios&lt;/a&gt;&lt;/div&gt;&#039;;
            }
        }
    }
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:700px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;h2 style=&quot;color:#ede9fe;margin-bottom:24px&quot;&gt;Publicar Anuncio&lt;/h2&gt;&#039;;
    echo &#039;&lt;form method=&quot;post&quot; style=&quot;display:flex;flex-direction:column;gap:16px&quot;&gt;&#039;;
    echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;dx_pub_anuncio&quot; value=&quot;1&quot;&gt;&#039;;
    $fields = array(
        array(&#039;name&#039; =&gt; &#039;titulo&#039;, &#039;label&#039; =&gt; &#039;Titulo del anuncio&#039;, &#039;type&#039; =&gt; &#039;text&#039;, &#039;placeholder&#039; =&gt; &#039;Ej: Busco pareja para salidas...&#039;, &#039;required&#039; =&gt; true),
        array(&#039;name&#039; =&gt; &#039;edad&#039;, &#039;label&#039; =&gt; &#039;Tu edad&#039;, &#039;type&#039; =&gt; &#039;number&#039;, &#039;placeholder&#039; =&gt; &#039;25&#039;, &#039;required&#039; =&gt; true),
        array(&#039;name&#039; =&gt; &#039;ciudad&#039;, &#039;label&#039; =&gt; &#039;Ciudad&#039;, &#039;type&#039; =&gt; &#039;text&#039;, &#039;placeholder&#039; =&gt; &#039;Ej: Madrid&#039;, &#039;required&#039; =&gt; true),
        array(&#039;name&#039; =&gt; &#039;whatsapp&#039;, &#039;label&#039; =&gt; &#039;WhatsApp (solo Gold puede ver)&#039;, &#039;type&#039; =&gt; &#039;tel&#039;, &#039;placeholder&#039; =&gt; &#039;+34 600 000 000&#039;, &#039;required&#039; =&gt; false),
        array(&#039;name&#039; =&gt; &#039;telefono&#039;, &#039;label&#039; =&gt; &#039;Telefono (solo Gold puede ver)&#039;, &#039;type&#039; =&gt; &#039;tel&#039;, &#039;placeholder&#039; =&gt; &#039;+34 600 000 000&#039;, &#039;required&#039; =&gt; false),
    );
    foreach ($fields as $f) {
        $req = $f[&#039;required&#039;] ? &#039; required&#039; : &#039;&#039;;
        echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;&#039; . esc_html($f[&#039;label&#039;]) . &#039;&lt;/label&gt;&#039;;
        echo &#039;&lt;input type=&quot;&#039; . esc_attr($f[&#039;type&#039;]) . &#039;&quot; name=&quot;&#039; . esc_attr($f[&#039;name&#039;]) . &#039;&quot; placeholder=&quot;&#039; . esc_attr($f[&#039;placeholder&#039;]) . &#039;&quot; style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);font-size:.9rem;box-sizing:border-box&quot;&#039; . $req . &#039;&gt;&lt;/div&gt;&#039;;
    }
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Genero&lt;/label&gt;&#039;;
    echo &#039;&lt;select name=&quot;genero&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1)&quot;&gt;&#039;;
    echo &#039;&lt;option value=&quot;hombre&quot;&gt;Hombre&lt;/option&gt;&lt;option value=&quot;mujer&quot;&gt;Mujer&lt;/option&gt;&lt;option value=&quot;pareja&quot;&gt;Pareja&lt;/option&gt;&lt;option value=&quot;trans&quot;&gt;Trans&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Busco&lt;/label&gt;&#039;;
    echo &#039;&lt;select name=&quot;busca&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1)&quot;&gt;&#039;;
    echo &#039;&lt;option value=&quot;hombre&quot;&gt;Hombre&lt;/option&gt;&lt;option value=&quot;mujer&quot;&gt;Mujer&lt;/option&gt;&lt;option value=&quot;pareja&quot;&gt;Pareja&lt;/option&gt;&lt;option value=&quot;cualquiera&quot;&gt;Cualquiera&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Descripcion&lt;/label&gt;&#039;;
    echo &#039;&lt;textarea name=&quot;descripcion&quot; rows=&quot;5&quot; placeholder=&quot;Cuéntate a ti mismo...&quot; style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);font-size:.9rem;resize:vertical;box-sizing:border-box&quot; required&gt;&lt;/textarea&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;button type=&quot;submit&quot; style=&quot;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff;padding:14px 28px;border-radius:10px;font-weight:700;font-size:1rem;border:none;cursor:pointer&quot;&gt;Publicar Anuncio&lt;/button&gt;&#039;;
    echo &#039;&lt;/form&gt;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_fetiches&#039;, function($atts) {
    $comunidad = sanitize_text_field($_GET[&#039;ca&#039;] ?? &#039;&#039;);
    $args = array(
        &#039;post_type&#039; =&gt; &#039;dx_fetiche&#039;,
        &#039;post_status&#039; =&gt; &#039;publish&#039;,
        &#039;posts_per_page&#039; =&gt; 24,
        &#039;orderby&#039; =&gt; &#039;date&#039;,
        &#039;order&#039; =&gt; &#039;DESC&#039;,
    );
    if ($comunidad) {
        $args[&#039;meta_query&#039;] = array(array(&#039;key&#039; =&gt; &#039;_dx_comunidad&#039;, &#039;value&#039; =&gt; $comunidad, &#039;compare&#039; =&gt; &#039;=&#039;));
    }
    $query = new WP_Query($args);
    $uid = get_current_user_id();
    $can_contact = dx_can_contact($uid);
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:1100px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;justify-content:space-between;align-items:center;margin-bottom:24px;flex-wrap:wrap;gap:12px&quot;&gt;&#039;;
    echo &#039;&lt;h1 style=&quot;color:#ede9fe;font-size:1.5rem;margin:0&quot;&gt;Fetiches y Encuentros&lt;/h1&gt;&#039;;
    echo &#039;&lt;a href=&quot;/publicar-fetiche/&quot; style=&quot;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff;padding:10px 20px;border-radius:10px;text-decoration:none;font-weight:700;font-size:.85rem&quot;&gt;+ Publicar Fetiche&lt;/a&gt;&#039;;
    echo &#039;&lt;/div&gt;&#039;;
    $comunidades_f = array(&#039;Andalucia&#039;,&#039;Madrid&#039;,&#039;Cataluna&#039;,&#039;C.Valenciana&#039;,&#039;Euskadi&#039;,&#039;Galicia&#039;,&#039;Castilla-Leon&#039;,&#039;Murcia&#039;,&#039;Aragon&#039;,&#039;Canarias&#039;,&#039;Baleares&#039;,&#039;Extremadura&#039;,&#039;Asturias&#039;,&#039;Navarra&#039;,&#039;Cantabria&#039;,&#039;La Rioja&#039;,&#039;Ceuta&#039;,&#039;Melilla&#039;);
    echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;margin-bottom:24px&quot;&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin:0 0 12px;text-transform:uppercase;letter-spacing:1px&quot;&gt;Filtrar por Comunidad&lt;/p&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;flex-wrap:wrap;gap:8px&quot;&gt;&#039;;
    $all_s = $comunidad ? &#039;background:rgba(255,255,255,.07);color:rgba(237,233,254,.7)&#039; : &#039;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff&#039;;
    echo &#039;&lt;a href=&quot;/fetiches/&quot; style=&quot;padding:6px 14px;border-radius:20px;font-size:.8rem;text-decoration:none;&#039; . $all_s . &#039;&quot;&gt;Toda España&lt;/a&gt;&#039;;
    foreach ($comunidades_f as $cf) {
        $cf_slug = sanitize_title($cf);
        $cf_act = ($comunidad === $cf_slug);
        $cf_s = $cf_act ? &#039;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff&#039; : &#039;background:rgba(255,255,255,.07);color:rgba(237,233,254,.7)&#039;;
        echo &#039;&lt;a href=&quot;/fetiches/?ca=&#039; . esc_attr($cf_slug) . &#039;&quot; style=&quot;padding:6px 14px;border-radius:20px;font-size:.8rem;text-decoration:none;&#039; . $cf_s . &#039;&quot;&gt;&#039; . esc_html($cf) . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    if ($query-&gt;have_posts()) {
        echo &#039;&lt;div style=&quot;display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px&quot;&gt;&#039;;
        while ($query-&gt;have_posts()) {
            $query-&gt;the_post();
            $fid = get_the_ID();
            $fauthor = get_post_field(&#039;post_author&#039;, $fid);
            $fauthor_name = get_the_author_meta(&#039;display_name&#039;, $fauthor);
            $fgold = dx_is_gold($fauthor);
            $fthumb = get_the_post_thumbnail_url($fid, &#039;medium&#039;) ?: &#039;&#039;;
            $favatar = get_avatar_url($fauthor, array(&#039;size&#039; =&gt; 48));
            $fciudad = get_post_meta($fid, &#039;_dx_ciudad&#039;, true);
            $fedad = get_post_meta($fid, &#039;_dx_edad&#039;, true);
            $fgenero = get_post_meta($fid, &#039;_dx_genero&#039;, true);
            echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;overflow:hidden;border:1px solid rgba(124,58,237,.2);transition:border-color .2s&quot;&gt;&#039;;
            if ($fthumb) echo &#039;&lt;img src=&quot;&#039; . esc_url($fthumb) . &#039;&quot; style=&quot;width:100%;height:200px;object-fit:cover&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;padding:16px&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;display:flex;align-items:center;gap:10px;margin-bottom:12px&quot;&gt;&#039;;
            echo &#039;&lt;img src=&quot;&#039; . esc_url($favatar) . &#039;&quot; style=&quot;width:36px;height:36px;border-radius:50%;border:2px solid &#039; . ($fgold ? &#039;#f0b429&#039; : &#039;rgba(124,58,237,.4)&#039;) . &#039;&quot;&gt;&#039;;
            echo &#039;&lt;div&gt;&#039;;
            echo &#039;&lt;div style=&quot;color:#ede9fe;font-size:.85rem;font-weight:600&quot;&gt;&#039; . esc_html($fauthor_name) . ($fgold ? &#039; &lt;span style=&quot;background:#f0b429;color:#000;font-size:.6rem;padding:1px 5px;border-radius:4px;font-weight:700&quot;&gt;GOLD&lt;/span&gt;&#039; : &#039;&#039;) . &#039;&lt;/div&gt;&#039;;
            echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.4);font-size:.75rem&quot;&gt;&#039;;
            if ($fedad) echo $fedad . &#039; años&#039;;
            if ($fciudad) echo &#039; · 📍&#039; . esc_html($fciudad);
            echo &#039;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&#039;;
            echo &#039;&lt;a href=&quot;&#039; . get_permalink() . &#039;&quot; style=&quot;color:#ede9fe;font-weight:700;text-decoration:none;font-size:.95rem;display:block;margin-bottom:8px&quot;&gt;&#039; . esc_html(get_the_title()) . &#039;&lt;/a&gt;&#039;;
            $fexc = wp_trim_words(get_the_excerpt() ?: get_the_content(), 15, &#039;...&#039;);
            echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin:0 0 12px&quot;&gt;&#039; . esc_html($fexc) . &#039;&lt;/p&gt;&#039;;
            if ($can_contact) {
                $fwp = get_post_meta($fid, &#039;_dx_whatsapp&#039;, true);
                if ($fwp) echo &#039;&lt;a href=&quot;https://wa.me/&#039; . preg_replace(&#039;/[^0-9]/&#039;, &#039;&#039;, $fwp) . &#039;&quot; style=&quot;background:#25d366;color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600&quot; target=&quot;_blank&quot;&gt;WhatsApp&lt;/a&gt;&#039;;
                else echo &#039;&lt;a href=&quot;/mensajes/?user=&#039; . $fauthor . &#039;&quot; style=&quot;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600&quot;&gt;Contactar&lt;/a&gt;&#039;;
            } else {
                echo &#039;&lt;a href=&quot;/membership-join/&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600&quot;&gt;👑 Gold para contactar&lt;/a&gt;&#039;;
            }
            echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&#039;;
        wp_reset_postdata();
    } else {
        echo &#039;&lt;div style=&quot;text-align:center;padding:60px 20px;color:rgba(237,233,254,.4)&quot;&gt;&lt;div style=&quot;font-size:3rem&quot;&gt;🔥&lt;/div&gt;&lt;p&gt;Sin fetiches todavia en esta zona.&lt;/p&gt;&lt;a href=&quot;/publicar-fetiche/&quot; style=&quot;background:var(--accent);color:#fff;padding:10px 20px;border-radius:10px;text-decoration:none;font-weight:700;display:inline-block;margin-top:16px&quot;&gt;Publica el Primero&lt;/a&gt;&lt;/div&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_buscar&#039;, function($atts) {
    $genero_f = sanitize_text_field($_GET[&#039;de&#039;] ?? &#039;&#039;);
    $busca_f = sanitize_text_field($_GET[&#039;busca&#039;] ?? &#039;&#039;);
    $ciudad_f = sanitize_text_field($_GET[&#039;ciudad&#039;] ?? &#039;&#039;);
    $paged = max(1, intval($_GET[&#039;pagina&#039;] ?? 1));
    $args = array(&#039;role&#039; =&gt; &#039;subscriber&#039;, &#039;number&#039; =&gt; 24, &#039;offset&#039; =&gt; ($paged-1)*24, &#039;orderby&#039; =&gt; &#039;registered&#039;, &#039;order&#039; =&gt; &#039;DESC&#039;);
    $meta_q = array(&#039;relation&#039; =&gt; &#039;AND&#039;);
    if ($genero_f) $meta_q[] = array(&#039;key&#039; =&gt; &#039;_dx_genero&#039;, &#039;value&#039; =&gt; $genero_f, &#039;compare&#039; =&gt; &#039;=&#039;);
    if ($busca_f) $meta_q[] = array(&#039;key&#039; =&gt; &#039;_dx_busca&#039;, &#039;value&#039; =&gt; $busca_f, &#039;compare&#039; =&gt; &#039;=&#039;);
    if ($ciudad_f) $meta_q[] = array(&#039;key&#039; =&gt; &#039;_dx_ciudad&#039;, &#039;value&#039; =&gt; $ciudad_f, &#039;compare&#039; =&gt; &#039;LIKE&#039;);
    if (count($meta_q) &gt; 1) $args[&#039;meta_query&#039;] = $meta_q;
    $users = get_users($args);
    $uid = get_current_user_id();
    $can_contact = dx_can_contact($uid);
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:1100px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;h1 style=&quot;color:#ede9fe;font-size:1.5rem;margin-bottom:20px&quot;&gt;Buscar Contactos&lt;/h1&gt;&#039;;
    echo &#039;&lt;form method=&quot;get&quot; style=&quot;background:#110f1e;border-radius:16px;padding:20px;margin-bottom:24px;display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end&quot;&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.6);font-size:.8rem;display:block;margin-bottom:6px&quot;&gt;Soy&lt;/label&gt;&lt;select name=&quot;de&quot; style=&quot;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1)&quot;&gt;&lt;option value=&quot;&quot;&gt;Todos&lt;/option&gt;&lt;option value=&quot;hombre&quot; &#039; . selected($genero_f, &#039;hombre&#039;, false) . &#039;&gt;Hombre&lt;/option&gt;&lt;option value=&quot;mujer&quot; &#039; . selected($genero_f, &#039;mujer&#039;, false) . &#039;&gt;Mujer&lt;/option&gt;&lt;option value=&quot;pareja&quot; &#039; . selected($genero_f, &#039;pareja&#039;, false) . &#039;&gt;Pareja&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.6);font-size:.8rem;display:block;margin-bottom:6px&quot;&gt;Busco&lt;/label&gt;&lt;select name=&quot;busca&quot; style=&quot;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1)&quot;&gt;&lt;option value=&quot;&quot;&gt;Cualquiera&lt;/option&gt;&lt;option value=&quot;hombre&quot; &#039; . selected($busca_f, &#039;hombre&#039;, false) . &#039;&gt;Hombre&lt;/option&gt;&lt;option value=&quot;mujer&quot; &#039; . selected($busca_f, &#039;mujer&#039;, false) . &#039;&gt;Mujer&lt;/option&gt;&lt;option value=&quot;pareja&quot; &#039; . selected($busca_f, &#039;pareja&#039;, false) . &#039;&gt;Pareja&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.6);font-size:.8rem;display:block;margin-bottom:6px&quot;&gt;Ciudad&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;ciudad&quot; value=&quot;&#039; . esc_attr($ciudad_f) . &#039;&quot; placeholder=&quot;Ej: Madrid&quot; style=&quot;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);width:160px&quot;&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;button type=&quot;submit&quot; style=&quot;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff;padding:10px 20px;border-radius:8px;font-weight:700;font-size:.9rem;border:none;cursor:pointer&quot;&gt;Buscar&lt;/button&gt;&#039;;
    echo &#039;&lt;/form&gt;&#039;;
    if (!empty($users)) {
        echo &#039;&lt;div style=&quot;display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px&quot;&gt;&#039;;
        foreach ($users as $u) {
            $u_id = $u-&gt;ID;
            $u_gold = dx_is_gold($u_id);
            $u_avatar = get_avatar_url($u_id, array(&#039;size&#039; =&gt; 120));
            $u_ciudad = get_user_meta($u_id, &#039;_dx_ciudad&#039;, true);
            $u_edad = get_user_meta($u_id, &#039;_dx_edad&#039;, true);
            $u_genero = get_user_meta($u_id, &#039;_dx_genero&#039;, true);
            $u_desc = get_user_meta($u_id, &#039;description&#039;, true);
            $border_c = $u_gold ? &#039;#f0b429&#039; : &#039;rgba(237,233,254,.1)&#039;;
            echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;text-align:center;border:1px solid &#039; . $border_c . &#039;&quot;&gt;&#039;;
            echo &#039;&lt;img src=&quot;&#039; . esc_url($u_avatar) . &#039;&quot; style=&quot;width:80px;height:80px;border-radius:50%;margin-bottom:12px;border:3px solid &#039; . $border_c . &#039;&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;color:#ede9fe;font-weight:700;font-size:.9rem&quot;&gt;&#039; . esc_html($u-&gt;display_name) . &#039;&lt;/div&gt;&#039;;
            if ($u_gold) echo &#039;&lt;span style=&quot;background:#f0b429;color:#000;font-size:.65rem;padding:2px 7px;border-radius:4px;font-weight:700&quot;&gt;GOLD&lt;/span&gt;&#039;;
            echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.4);font-size:.75rem;margin:6px 0&quot;&gt;&#039;;
            if ($u_edad) echo $u_edad . &#039; años&#039;;
            if ($u_ciudad) echo &#039; · 📍&#039; . esc_html($u_ciudad);
            echo &#039;&lt;/div&gt;&#039;;
            if ($u_desc) echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.5);font-size:.75rem;margin:8px 0&quot;&gt;&#039; . esc_html(wp_trim_words($u_desc, 10)) . &#039;&lt;/p&gt;&#039;;
            if ($can_contact &amp;&amp; $u_id !== $uid) {
                echo &#039;&lt;a href=&quot;/mensajes/?user=&#039; . $u_id . &#039;&quot; style=&quot;display:block;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff;padding:8px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600;margin-top:12px&quot;&gt;Contactar&lt;/a&gt;&#039;;
            } else if ($u_id !== $uid) {
                echo &#039;&lt;a href=&quot;/membership-join/&quot; style=&quot;display:block;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:8px;border-radius:8px;text-decoration:none;font-size:.8rem;font-weight:600;margin-top:12px&quot;&gt;👑 Gold para contactar&lt;/a&gt;&#039;;
            }
            echo &#039;&lt;/div&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&#039;;
    } else {
        echo &#039;&lt;div style=&quot;text-align:center;padding:60px 20px;color:rgba(237,233,254,.4)&quot;&gt;&lt;div style=&quot;font-size:3rem&quot;&gt;😔&lt;/div&gt;&lt;p&gt;No hay usuarios con esos criterios.&lt;/p&gt;&lt;/div&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_mi_panel&#039;, function($atts) {
    if (!is_user_logged_in()) {
        return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#ede9fe&quot;&gt;&lt;p&gt;Debes &lt;a href=&quot;/login/&quot; style=&quot;color:#e0196b&quot;&gt;iniciar sesion&lt;/a&gt; para acceder a tu panel.&lt;/p&gt;&lt;/div&gt;&#039;;
    }
    $uid = get_current_user_id();
    $user = wp_get_current_user();
    $is_gold = dx_is_gold($uid);
    $is_silver = dx_is_silver($uid);
    $trial_used = get_user_meta($uid, &#039;dx_trial_used&#039;, true);
    $tab = sanitize_text_field($_GET[&#039;tab&#039;] ?? &#039;inicio&#039;);
    $avatar = get_avatar_url($uid, array(&#039;size&#039; =&gt; 80));
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:900px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:24px;margin-bottom:20px;display:flex;align-items:center;gap:20px&quot;&gt;&#039;;
    echo &#039;&lt;img src=&quot;&#039; . esc_url($avatar) . &#039;&quot; style=&quot;width:80px;height:80px;border-radius:50%;border:3px solid &#039; . ($is_gold ? &#039;#f0b429&#039; : &#039;rgba(237,233,254,.2)&#039;) . &#039;&quot;&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;h2 style=&quot;color:#ede9fe;margin:0 0 4px&quot;&gt;&#039; . esc_html($user-&gt;display_name) . &#039;&lt;/h2&gt;&#039;;
    echo &#039;&lt;div&gt;&#039;;
    if ($is_gold) echo &#039;&lt;span style=&quot;background:#f0b429;color:#000;font-size:.7rem;padding:3px 10px;border-radius:6px;font-weight:700&quot;&gt;⭐ GOLD&lt;/span&gt;&#039;;
    elseif ($is_silver) echo &#039;&lt;span style=&quot;background:#7c3aed;color:#fff;font-size:.7rem;padding:3px 10px;border-radius:6px;font-weight:700&quot;&gt;💎 SILVER&lt;/span&gt;&#039;;
    else echo &#039;&lt;span style=&quot;background:rgba(237,233,254,.1);color:rgba(237,233,254,.5);font-size:.7rem;padding:3px 10px;border-radius:6px&quot;&gt;Cuenta Gratis&lt;/span&gt;&#039;;
    echo &#039;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;gap:4px;margin-bottom:20px;background:#110f1e;border-radius:12px;padding:6px&quot;&gt;&#039;;
    $tabs = array(&#039;inicio&#039; =&gt; &#039;🏠 Inicio&#039;, &#039;perfil&#039; =&gt; &#039;✏️ Mi Perfil&#039;, &#039;anuncios&#039; =&gt; &#039;📋 Mis Anuncios&#039;, &#039;membresia&#039; =&gt; &#039;👑 Membresía&#039;);
    foreach ($tabs as $tab_k =&gt; $tab_label) {
        $is_active = ($tab === $tab_k);
        $tab_s = $is_active ? &#039;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff&#039; : &#039;color:rgba(237,233,254,.5)&#039;;
        echo &#039;&lt;a href=&quot;?tab=&#039; . $tab_k . &#039;&quot; style=&quot;flex:1;padding:10px;border-radius:8px;text-decoration:none;text-align:center;font-size:.8rem;font-weight:600;&#039; . $tab_s . &#039;&quot;&gt;&#039; . $tab_label . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&#039;;
    if ($tab === &#039;inicio&#039;) {
        echo &#039;&lt;div style=&quot;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px&quot;&gt;&#039;;
        $u_anuncios = new WP_Query(array(&#039;post_type&#039; =&gt; &#039;dx_anuncio&#039;, &#039;author&#039; =&gt; $uid, &#039;posts_per_page&#039; =&gt; -1));
        echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;text-align:center&quot;&gt;&lt;div style=&quot;font-size:2rem;font-weight:900;color:#e0196b&quot;&gt;&#039; . $u_anuncios-&gt;found_posts . &#039;&lt;/div&gt;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.85rem&quot;&gt;Mis Anuncios&lt;/div&gt;&lt;/div&gt;&#039;;
        wp_reset_postdata();
        $u_fetiches = new WP_Query(array(&#039;post_type&#039; =&gt; &#039;dx_fetiche&#039;, &#039;author&#039; =&gt; $uid, &#039;posts_per_page&#039; =&gt; -1));
        echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;text-align:center&quot;&gt;&lt;div style=&quot;font-size:2rem;font-weight:900;color:#7c3aed&quot;&gt;&#039; . $u_fetiches-&gt;found_posts . &#039;&lt;/div&gt;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.85rem&quot;&gt;Mis Fetiches&lt;/div&gt;&lt;/div&gt;&#039;;
        wp_reset_postdata();
        $member_type = $is_gold ? &#039;Gold&#039; : ($is_silver ? &#039;Silver&#039; : &#039;Gratis&#039;);
        echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:20px;text-align:center&quot;&gt;&lt;div style=&quot;font-size:2rem;font-weight:900;color:#f0b429&quot;&gt;&#039;;
        echo esc_html($member_type);
        echo &#039;&lt;/div&gt;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.85rem&quot;&gt;Mi Plan&lt;/div&gt;&lt;/div&gt;&#039;;
        echo &#039;&lt;/div&gt;&#039;;
        if (!$is_gold &amp;&amp; !$trial_used) {
            echo &#039;&lt;div style=&quot;background:linear-gradient(135deg,rgba(224,25,107,.15),rgba(124,58,237,.15));border:1px solid rgba(224,25,107,.3);border-radius:16px;padding:24px;margin-top:20px;text-align:center&quot;&gt;&#039;;
            echo &#039;&lt;h3 style=&quot;color:#f0b429;margin:0 0 12px&quot;&gt;🎁 Prueba Gold 5 Dias Gratis&lt;/h3&gt;&#039;;
            echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.6);font-size:.9rem;margin:0 0 16px&quot;&gt;Prueba todas las funciones Gold sin coste. Solo una vez.&lt;/p&gt;&#039;;
            echo &#039;&lt;a href=&quot;/prueba-gratis/&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:12px 28px;border-radius:10px;text-decoration:none;font-weight:700&quot;&gt;Activar Prueba Gratis&lt;/a&gt;&#039;;
            echo &#039;&lt;/div&gt;&#039;;
        }
    }
    if ($tab === &#039;perfil&#039;) {
        if (isset($_POST[&#039;dx_update_perfil&#039;])) {
            $n_ciudad = sanitize_text_field($_POST[&#039;ciudad&#039;] ?? &#039;&#039;);
            $n_edad = intval($_POST[&#039;edad&#039;] ?? 0);
            $n_genero = sanitize_text_field($_POST[&#039;genero&#039;] ?? &#039;&#039;);
            $n_desc = sanitize_textarea_field($_POST[&#039;descripcion&#039;] ?? &#039;&#039;);
            update_user_meta($uid, &#039;_dx_ciudad&#039;, $n_ciudad);
            update_user_meta($uid, &#039;_dx_edad&#039;, $n_edad);
            update_user_meta($uid, &#039;_dx_genero&#039;, $n_genero);
        // Guardar servicios
        $dx_all_servicios = array(&#039;dx_serv_24h&#039;,&#039;dx_serv_masajes&#039;,&#039;dx_serv_fr_natural&#039;,&#039;dx_serv_lesbisco&#039;,&#039;dx_serv_sado_bdsm&#039;,&#039;dx_serv_hoteles&#039;,&#039;dx_serv_beso_boca&#039;,&#039;dx_serv_griego&#039;,&#039;dx_serv_duplex&#039;,&#039;dx_serv_lluvia&#039;,&#039;dx_serv_viajes&#039;,&#039;dx_serv_frances&#039;,&#039;dx_serv_beso_negro&#039;,&#039;dx_serv_parejas&#039;,&#039;dx_serv_fiestera&#039;);
        foreach ($dx_all_servicios as $sv) { update_user_meta($uid, $sv, isset($_POST[$sv]) ? &#039;1&#039; : &#039;0&#039;); }
            wp_update_user(array(&#039;ID&#039; =&gt; $uid, &#039;description&#039; =&gt; $n_desc));
            echo &#039;&lt;div style=&quot;background:rgba(74,222,128,.1);border:1px solid #4ade80;border-radius:8px;padding:12px;margin-bottom:16px;color:#4ade80&quot;&gt;✅ Perfil actualizado&lt;/div&gt;&#039;;
        }
        $cur_ciudad = get_user_meta($uid, &#039;_dx_ciudad&#039;, true);
        $cur_edad = get_user_meta($uid, &#039;_dx_edad&#039;, true);
        $cur_genero = get_user_meta($uid, &#039;_dx_genero&#039;, true);
        $cur_desc = $user-&gt;description;
        echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:24px&quot;&gt;&#039;;
        echo &#039;&lt;h3 style=&quot;color:#ede9fe;margin:0 0 20px&quot;&gt;Editar Perfil&lt;/h3&gt;&#039;;
        echo &#039;&lt;form method=&quot;post&quot; style=&quot;display:flex;flex-direction:column;gap:16px&quot;&gt;&#039;;
        echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;dx_update_perfil&quot; value=&quot;1&quot;&gt;&#039;;
        echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Ciudad&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;ciudad&quot; value=&quot;&#039; . esc_attr($cur_ciudad) . &#039;&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);box-sizing:border-box&quot;&gt;&lt;/div&gt;&#039;;
        echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Edad&lt;/label&gt;&lt;input type=&quot;number&quot; name=&quot;edad&quot; value=&quot;&#039; . esc_attr($cur_edad) . &#039;&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);box-sizing:border-box&quot;&gt;&lt;/div&gt;&#039;;
        echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Genero&lt;/label&gt;&lt;select name=&quot;genero&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1)&quot;&gt;&lt;option value=&quot;hombre&quot; &#039; . selected($cur_genero, &#039;hombre&#039;, false) . &#039;&gt;Hombre&lt;/option&gt;&lt;option value=&quot;mujer&quot; &#039; . selected($cur_genero, &#039;mujer&#039;, false) . &#039;&gt;Mujer&lt;/option&gt;&lt;option value=&quot;pareja&quot; &#039; . selected($cur_genero, &#039;pareja&#039;, false) . &#039;&gt;Pareja&lt;/option&gt;&lt;option value=&quot;trans&quot; &#039; . selected($cur_genero, &#039;trans&#039;, false) . &#039;&gt;Trans&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;&#039;;
        echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Sobre mi&lt;/label&gt;&lt;textarea name=&quot;descripcion&quot; rows=&quot;4&quot; style=&quot;width:100%;padding:10px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);resize:vertical;box-sizing:border-box&quot;&gt;&#039; . esc_textarea($cur_desc) . &#039;&lt;/textarea&gt;&lt;/div&gt;&#039;;
        $dx_panel_servicios = array(&#039;dx_serv_24h&#039;=&gt;&#039;24h&#039;,&#039;dx_serv_masajes&#039;=&gt;&#039;Masajes&#039;,&#039;dx_serv_fr_natural&#039;=&gt;&#039;Fr Natural&#039;,&#039;dx_serv_lesbisco&#039;=&gt;&#039;Lesbisco&#039;,&#039;dx_serv_sado_bdsm&#039;=&gt;&#039;Sado BDSM&#039;,&#039;dx_serv_hoteles&#039;=&gt;&#039;Hoteles / Domicilios&#039;,&#039;dx_serv_beso_boca&#039;=&gt;&#039;Beso en la boca&#039;,&#039;dx_serv_griego&#039;=&gt;&#039;Griego&#039;,&#039;dx_serv_duplex&#039;=&gt;&#039;Duplex&#039;,&#039;dx_serv_lluvia&#039;=&gt;&#039;Lluvia dorada&#039;,&#039;dx_serv_viajes&#039;=&gt;&#039;Viajes&#039;,&#039;dx_serv_frances&#039;=&gt;&#039;Frances&#039;,&#039;dx_serv_beso_negro&#039;=&gt;&#039;Beso negro&#039;,&#039;dx_serv_parejas&#039;=&gt;&#039;Parejas&#039;,&#039;dx_serv_fiestera&#039;=&gt;&#039;Fiestera&#039;);
        echo &#039;&lt;div style=&quot;margin:16px 0;&quot;&gt;&lt;h4 style=&quot;color:var(--accent);font-size:.85rem;font-weight:700;text-transform:uppercase;margin-bottom:10px;&quot;&gt;Servicios que realizo&lt;/h4&gt;&lt;div style=&quot;display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px;&quot;&gt;&#039;;
        foreach ($dx_panel_servicios as $sv_key =&gt; $sv_label) {
            $sv_checked = get_user_meta($uid, $sv_key, true) === &#039;1&#039; ? &#039;checked&#039; : &#039;&#039;;
            echo &#039;&lt;label style=&quot;display:flex;align-items:center;gap:6px;font-size:.85rem;cursor:pointer;color:var(--text);&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;&#039; . $sv_key . &#039;&quot; value=&quot;1&quot; &#039; . $sv_checked . &#039; style=&quot;accent-color:var(--accent);width:16px;height:16px;&quot;&gt; &#039; . esc_html($sv_label) . &#039;&lt;/label&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
        echo &#039;&lt;button type=&quot;submit&quot; style=&quot;background:linear-gradient(135deg,#e0196b,#7c3aed);color:#fff;padding:12px;border-radius:10px;font-weight:700;border:none;cursor:pointer&quot;&gt;Guardar Cambios&lt;/button&gt;&lt;/form&gt;&lt;/div&gt;&#039;;
    }
    if ($tab === &#039;anuncios&#039;) {
        $mis_anuncios = new WP_Query(array(&#039;post_type&#039; =&gt; &#039;dx_anuncio&#039;, &#039;author&#039; =&gt; $uid, &#039;posts_per_page&#039; =&gt; 20));
        echo &#039;&lt;div style=&quot;display:flex;flex-direction:column;gap:12px&quot;&gt;&#039;;
        if ($mis_anuncios-&gt;have_posts()) {
            while ($mis_anuncios-&gt;have_posts()) {
                $mis_anuncios-&gt;the_post();
                echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:12px;padding:16px;display:flex;justify-content:space-between;align-items:center;gap:12px&quot;&gt;&#039;;
                echo &#039;&lt;div&gt;&lt;a href=&quot;&#039; . get_permalink() . &#039;&quot; style=&quot;color:#ede9fe;font-weight:700;text-decoration:none&quot;&gt;&#039; . esc_html(get_the_title()) . &#039;&lt;/a&gt;&#039;;
                echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.4);font-size:.75rem;margin-top:4px&quot;&gt;&#039; . get_the_date() . &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
                echo &#039;&lt;a href=&quot;&#039; . admin_url(&#039;post.php?post=&#039; . get_the_ID() . &#039;&amp;action=edit&#039;) . &#039;&quot; style=&quot;background:rgba(255,255,255,.08);color:#ede9fe;padding:6px 14px;border-radius:8px;text-decoration:none;font-size:.8rem&quot;&gt;Editar&lt;/a&gt;&#039;;
                echo &#039;&lt;/div&gt;&#039;;
            }
            wp_reset_postdata();
        } else {
            echo &#039;&lt;div style=&quot;text-align:center;padding:40px;color:rgba(237,233,254,.4)&quot;&gt;&lt;p&gt;No tienes anuncios todavia.&lt;/p&gt;&lt;a href=&quot;/publicar-anuncio/&quot; style=&quot;background:var(--accent);color:#fff;padding:10px 20px;border-radius:10px;text-decoration:none;font-weight:700;display:inline-block&quot;&gt;Publicar Anuncio&lt;/a&gt;&lt;/div&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&#039;;
    }
    if ($tab === &#039;membresia&#039;) {
        echo &#039;&lt;div style=&quot;background:#110f1e;border-radius:16px;padding:24px&quot;&gt;&#039;;
        echo &#039;&lt;h3 style=&quot;color:#ede9fe;margin:0 0 20px&quot;&gt;Mi Membresía&lt;/h3&gt;&#039;;
        if ($is_gold) {
            echo &#039;&lt;p style=&quot;color:#4ade80&quot;&gt;✅ Tienes membresía Gold activa.&lt;/p&gt;&#039;;
        } elseif ($is_silver) {
            echo &#039;&lt;p style=&quot;color:#a78bfa&quot;&gt;✅ Tienes membresía Silver activa.&lt;/p&gt;&#039;;
        } else {
            echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.6)&quot;&gt;No tienes membresía activa.&lt;/p&gt;&#039;;
            echo &#039;&lt;div style=&quot;display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px&quot;&gt;&#039;;
            echo &#039;&lt;div style=&quot;background:#1a1730;border-radius:12px;padding:20px;text-align:center;border:2px solid #f0b429&quot;&gt;&lt;div style=&quot;color:#f0b429;font-weight:700;margin-bottom:8px&quot;&gt;⭐ GOLD&lt;/div&gt;&lt;div style=&quot;font-size:2rem;font-weight:900;color:#ede9fe;margin-bottom:4px&quot;&gt;€25&lt;/div&gt;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:16px&quot;&gt;/mes&lt;/div&gt;&lt;a href=&quot;/membership-join/&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:10px;border-radius:8px;text-decoration:none;font-weight:700;font-size:.85rem;display:block&quot;&gt;Activar Gold&lt;/a&gt;&lt;/div&gt;&#039;;
            echo &#039;&lt;div style=&quot;background:#1a1730;border-radius:12px;padding:20px;text-align:center;border:2px solid #7c3aed&quot;&gt;&lt;div style=&quot;color:#7c3aed;font-weight:700;margin-bottom:8px&quot;&gt;💎 SILVER&lt;/div&gt;&lt;div style=&quot;font-size:2rem;font-weight:900;color:#ede9fe;margin-bottom:4px&quot;&gt;€15&lt;/div&gt;&lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:16px&quot;&gt;/15 dias&lt;/div&gt;&lt;a href=&quot;/membership-join/&quot; style=&quot;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff;padding:10px;border-radius:8px;text-decoration:none;font-weight:700;font-size:.85rem;display:block&quot;&gt;Activar Silver&lt;/a&gt;&lt;/div&gt;&#039;;
            echo &#039;&lt;/div&gt;&#039;;
        }
        echo &#039;&lt;/div&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_action(&#039;wp_footer&#039;, function() {
    echo &#039;&lt;footer style=&quot;background:#080610;border-top:1px solid rgba(237,233,254,.08);padding:40px 20px;margin-top:60px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;max-width:1100px;margin:0 auto&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:24px;margin-bottom:32px&quot;&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;h4 style=&quot;color:#e0196b;margin:0 0 12px;font-size:.85rem;text-transform:uppercase;letter-spacing:1px&quot;&gt;Navegacion&lt;/h4&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;flex-direction:column;gap:6px&quot;&gt;&#039;;
    $nav_links = array(&#039;/anuncios/&#039; =&gt; &#039;Anuncios&#039;, &#039;/fetiches/&#039; =&gt; &#039;Fetiches&#039;, &#039;/buscar-contactos/&#039; =&gt; &#039;Buscar Contactos&#039;, &#039;/planes/&#039; =&gt; &#039;Planes&#039;, &#039;/register/&#039; =&gt; &#039;Registrarse&#039;);
    foreach ($nav_links as $href =&gt; $label) {
        echo &#039;&lt;a href=&quot;&#039; . $href . &#039;&quot; style=&quot;color:rgba(237,233,254,.5);font-size:.85rem;text-decoration:none;hover:color:#ede9fe&quot;&gt;&#039; . $label . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;h4 style=&quot;color:#e0196b;margin:0 0 12px;font-size:.85rem;text-transform:uppercase;letter-spacing:1px&quot;&gt;Legal&lt;/h4&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;flex-direction:column;gap:6px&quot;&gt;&#039;;
    $legal_links = array(&#039;/privacidad/&#039; =&gt; &#039;Política de Privacidad&#039;, &#039;/terminos/&#039; =&gt; &#039;Términos de Uso&#039;, &#039;/cookies/&#039; =&gt; &#039;Política de Cookies&#039;, &#039;/aviso-legal/&#039; =&gt; &#039;Aviso Legal&#039;, &#039;/responsabilidad/&#039; =&gt; &#039;Responsabilidad&#039;);
    foreach ($legal_links as $href =&gt; $label) {
        echo &#039;&lt;a href=&quot;&#039; . $href . &#039;&quot; style=&quot;color:rgba(237,233,254,.5);font-size:.85rem;text-decoration:none&quot;&gt;&#039; . $label . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;h4 style=&quot;color:#e0196b;margin:0 0 12px;font-size:.85rem;text-transform:uppercase;letter-spacing:1px&quot;&gt;Ciudades&lt;/h4&gt;&#039;;
    echo &#039;&lt;div style=&quot;display:flex;flex-wrap:wrap;gap:6px&quot;&gt;&#039;;
    $ciudades_f = array(&#039;Madrid&#039;,&#039;Barcelona&#039;,&#039;Valencia&#039;,&#039;Sevilla&#039;,&#039;Bilbao&#039;,&#039;Zaragoza&#039;,&#039;Malaga&#039;,&#039;Murcia&#039;,&#039;Alicante&#039;,&#039;Cordoba&#039;,&#039;Valladolid&#039;,&#039;Vigo&#039;,&#039;Gijon&#039;,&#039;A Coruna&#039;,&#039;Granada&#039;);
    foreach ($ciudades_f as $cf) {
        echo &#039;&lt;a href=&quot;/anuncios/?ciudad=&#039; . urlencode($cf) . &#039;&quot; style=&quot;color:rgba(237,233,254,.4);font-size:.75rem;text-decoration:none&quot;&gt;&#039; . esc_html($cf) . &#039;&lt;/a&gt;&#039;;
    }
    echo &#039;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div style=&quot;border-top:1px solid rgba(237,233,254,.06);padding-top:24px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:12px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.3);font-size:.8rem&quot;&gt;© 2026 DeseosX™. Todos los derechos reservados. Sitio para mayores de 18 años.&lt;/div&gt;&#039;;
    echo &#039;&lt;div style=&quot;color:rgba(237,233,254,.2);font-size:.7rem&quot;&gt;Made in Spain 🇪🇸&lt;/div&gt;&#039;;
    echo &#039;&lt;/div&gt;&lt;/div&gt;&lt;/footer&gt;&#039;;
}, 20);

add_shortcode(&#039;deseosx_publicar_fetiche&#039;, function($atts) {

    $uid = get_current_user_id();
    if (isset($_POST[&#039;dx_pub_fetiche&#039;])) {
        $ftitulo = sanitize_text_field($_POST[&#039;titulo&#039;] ?? &#039;&#039;);
        $fdesc = sanitize_textarea_field($_POST[&#039;descripcion&#039;] ?? &#039;&#039;);
        $fciudad = sanitize_text_field($_POST[&#039;ciudad&#039;] ?? &#039;&#039;);
        $fedad = intval($_POST[&#039;edad&#039;] ?? 0);
        $fgenero = sanitize_text_field($_POST[&#039;genero&#039;] ?? &#039;&#039;);
        $fwp = sanitize_text_field($_POST[&#039;whatsapp&#039;] ?? &#039;&#039;);
        if ($ftitulo &amp;&amp; $fdesc) {
            $fpost_id = wp_insert_post(array(
                &#039;post_title&#039; =&gt; $ftitulo,
                &#039;post_content&#039; =&gt; $fdesc,
                &#039;post_status&#039; =&gt; &#039;publish&#039;,
                &#039;post_type&#039; =&gt; &#039;dx_fetiche&#039;,
                &#039;post_author&#039; =&gt; $uid,
            ));
            if ($fpost_id &amp;&amp; !is_wp_error($fpost_id)) {
                update_post_meta($fpost_id, &#039;_dx_ciudad&#039;, $fciudad);
                update_post_meta($fpost_id, &#039;_dx_edad&#039;, $fedad);
                update_post_meta($fpost_id, &#039;_dx_genero&#039;, $fgenero);
                update_post_meta($fpost_id, &#039;_dx_whatsapp&#039;, $fwp);
                return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#4ade80&quot;&gt;&lt;h2&gt;✅ Fetiche publicado!&lt;/h2&gt;&lt;a href=&quot;/fetiches/&quot; style=&quot;color:#e0196b&quot;&gt;Ver fetiches&lt;/a&gt;&lt;/div&gt;&#039;;
            }
        }
    }
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:700px;margin:0 auto;padding:20px&quot;&gt;&#039;;
    echo &#039;&lt;h2 style=&quot;color:#ede9fe;margin-bottom:24px&quot;&gt;Publicar Fetiche o Encuentro&lt;/h2&gt;&#039;;
    echo &#039;&lt;form method=&quot;post&quot; style=&quot;display:flex;flex-direction:column;gap:16px&quot;&gt;&#039;;
    echo &#039;&lt;input type=&quot;hidden&quot; name=&quot;dx_pub_fetiche&quot; value=&quot;1&quot;&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Titulo&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;titulo&quot; placeholder=&quot;Ej: Busco pareja swinger...&quot; required style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);box-sizing:border-box&quot;&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Ciudad&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;ciudad&quot; placeholder=&quot;Ej: Sevilla&quot; style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);box-sizing:border-box&quot;&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;Descripcion&lt;/label&gt;&lt;textarea name=&quot;descripcion&quot; rows=&quot;5&quot; required style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);resize:vertical;box-sizing:border-box&quot;&gt;&lt;/textarea&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;div&gt;&lt;label style=&quot;color:rgba(237,233,254,.7);font-size:.85rem;display:block;margin-bottom:6px&quot;&gt;WhatsApp&lt;/label&gt;&lt;input type=&quot;tel&quot; name=&quot;whatsapp&quot; placeholder=&quot;+34 600 000 000&quot; style=&quot;width:100%;padding:10px 14px;border-radius:8px;background:#1a1730;color:#ede9fe;border:1px solid rgba(237,233,254,.1);box-sizing:border-box&quot;&gt;&lt;/div&gt;&#039;;
    echo &#039;&lt;button type=&quot;submit&quot; style=&quot;background:linear-gradient(135deg,#7c3aed,#4f46e5);color:#fff;padding:14px 28px;border-radius:10px;font-weight:700;font-size:1rem;border:none;cursor:pointer&quot;&gt;Publicar&lt;/button&gt;&lt;/form&gt;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

add_shortcode(&#039;deseosx_responsabilidad&#039;, function($atts) {
    ob_start();
    echo &#039;&lt;div style=&quot;max-width:800px;margin:0 auto;padding:40px 20px;color:#ede9fe&quot;&gt;&#039;;
    echo &#039;&lt;h2 style=&quot;color:#e0196b;margin-bottom:24px&quot;&gt;Declaracion de Responsabilidad&lt;/h2&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.7);line-height:1.7;margin-bottom:16px&quot;&gt;DeseosX.com es una plataforma de entretenimiento para adultos mayores de 18 años. Todo el contenido publicado en este sitio ha sido creado voluntariamente por sus usuarios.&lt;/p&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.7);line-height:1.7;margin-bottom:16px&quot;&gt;DeseosX.com no es responsable del contenido publicado por los usuarios ni de las interacciones entre ellos. Cada usuario es responsable de sus propias acciones y comunicaciones.&lt;/p&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.7);line-height:1.7;margin-bottom:16px&quot;&gt;Este sitio cumple con la legislacion española vigente, incluyendo la Ley Organica de Proteccion de Datos (LOPD), el Reglamento General de Proteccion de Datos (RGPD) y la Ley de Servicios de la Sociedad de la Informacion (LSSI).&lt;/p&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.7);line-height:1.7&quot;&gt;© 2026 DeseosX™ - Todos los derechos reservados. Sitio creado y operado en España.&lt;/p&gt;&#039;;
    echo &#039;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

// Remove default WP header/footer parts, admin bar for non-admins
add_action(&#039;after_setup_theme&#039;, function() {
    remove_action(&#039;wp_head&#039;, &#039;wp_generator&#039;);
});

add_action(&#039;init&#039;, function() {
    if (is_user_logged_in() &amp;&amp; !current_user_can(&#039;manage_options&#039;)) {
        show_admin_bar(false);
    }
});

// Redirect default wp-login to our login page
add_action(&#039;login_form_login&#039;, function() {
    // Keep default login for admins
});

// Trial Gold activation
add_shortcode(&#039;deseosx_prueba_gratis&#039;, function($atts) {
    if (!is_user_logged_in()) return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#ede9fe&quot;&gt;&lt;p&gt;Debes &lt;a href=&quot;/login/&quot; style=&quot;color:#e0196b&quot;&gt;iniciar sesion&lt;/a&gt; para activar la prueba.&lt;/p&gt;&lt;/div&gt;&#039;;
    $uid = get_current_user_id();
    $trial_used = get_user_meta($uid, &#039;dx_trial_used&#039;, true);
    $is_gold = dx_is_gold($uid);
    if ($is_gold) return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#4ade80&quot;&gt;✅ Ya eres Gold!&lt;/div&gt;&#039;;
    if ($trial_used) return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:rgba(237,233,254,.5)&quot;&gt;Ya usaste tu prueba gratuita. &lt;a href=&quot;/membership-join/&quot; style=&quot;color:#e0196b&quot;&gt;Hazte Gold&lt;/a&gt;&lt;/div&gt;&#039;;
    if (isset($_POST[&#039;activar_prueba&#039;])) {
        $trial_end = time() + (5 * 24 * 60 * 60);
        update_user_meta($uid, &#039;dx_trial_end&#039;, $trial_end);
        update_user_meta($uid, &#039;dx_trial_used&#039;, 1);
        return &#039;&lt;div style=&quot;text-align:center;padding:40px;color:#4ade80&quot;&gt;&lt;h2&gt;🎉 Prueba activada!&lt;/h2&gt;&lt;p&gt;Tienes 5 dias de acceso Gold.&lt;/p&gt;&lt;a href=&quot;/mi-panel/&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:12px 28px;border-radius:10px;text-decoration:none;font-weight:700;display:inline-block;margin-top:16px&quot;&gt;Ir a Mi Panel&lt;/a&gt;&lt;/div&gt;&#039;;
    }
    ob_start();
    echo &#039;&lt;div style=&quot;text-align:center;padding:40px 20px&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;background:linear-gradient(135deg,rgba(240,180,41,.15),rgba(224,25,107,.15));border:1px solid rgba(240,180,41,.3);border-radius:20px;padding:40px;max-width:500px;margin:0 auto&quot;&gt;&#039;;
    echo &#039;&lt;div style=&quot;font-size:3rem;margin-bottom:16px&quot;&gt;🎁&lt;/div&gt;&#039;;
    echo &#039;&lt;h2 style=&quot;color:#f0b429;margin-bottom:12px&quot;&gt;Prueba Gold 5 Dias&lt;/h2&gt;&#039;;
    echo &#039;&lt;p style=&quot;color:rgba(237,233,254,.6);margin-bottom:24px&quot;&gt;Accede a todas las funciones Gold durante 5 dias completamente gratis. Una sola vez por cuenta.&lt;/p&gt;&#039;;
    echo &#039;&lt;form method=&quot;post&quot;&gt;&lt;button type=&quot;submit&quot; name=&quot;activar_prueba&quot; value=&quot;1&quot; style=&quot;background:linear-gradient(135deg,#f0b429,#e0196b);color:#fff;padding:14px 32px;border-radius:12px;font-weight:700;font-size:1rem;border:none;cursor:pointer&quot;&gt;Activar Prueba Gratis&lt;/button&gt;&lt;/form&gt;&#039;;
    echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
    return ob_get_clean();
});

// Membership plans in wp_head for specific page
add_action(&#039;wp_head&#039;, function() {
    global $post;
    if (!$post) return;
    $plan_pages = array(&#039;membership-join&#039;, &#039;planes&#039;);
    if (!in_array($post-&gt;post_name, $plan_pages)) return;
    ?&gt;
    &lt;style&gt;#dx-plans-grid{max-width:800px;margin:0 auto 32px;display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px;padding:0 20px}
    .dx-plan-card{background:#110f1e;border-radius:16px;padding:28px;text-align:center}
    .dx-plan-card-gold{border:2px solid #f0b429}.dx-plan-card-silver{border:2px solid #7c3aed}&lt;/style&gt;
    &lt;div id=&quot;dx-plans-grid&quot;&gt;
    &lt;div class=&quot;dx-plan-card dx-plan-card-gold&quot;&gt;
        &lt;div style=&quot;color:#f0b429;font-size:.7rem;font-weight:700;letter-spacing:2px;margin-bottom:12px&quot;&gt;GOLD&lt;/div&gt;
        &lt;div style=&quot;font-size:2.5rem;font-weight:900;color:#ede9fe&quot;&gt;€25&lt;/div&gt;
        &lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:16px&quot;&gt;/mes · acceso total&lt;/div&gt;
        &lt;div style=&quot;text-align:left;color:rgba(237,233,254,.7);font-size:.85rem&quot;&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Contactar usuarios&lt;/div&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Mensajes ilimitados&lt;/div&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Insignia Gold verificada&lt;/div&gt;
            &lt;div&gt;✓ Acceso a Fetiches&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;dx-plan-card dx-plan-card-silver&quot;&gt;
        &lt;div style=&quot;color:#7c3aed;font-size:.7rem;font-weight:700;letter-spacing:2px;margin-bottom:12px&quot;&gt;SILVER&lt;/div&gt;
        &lt;div style=&quot;font-size:2.5rem;font-weight:900;color:#ede9fe&quot;&gt;€15&lt;/div&gt;
        &lt;div style=&quot;color:rgba(237,233,254,.5);font-size:.8rem;margin-bottom:16px&quot;&gt;/15 dias · prueba&lt;/div&gt;
        &lt;div style=&quot;text-align:left;color:rgba(237,233,254,.7);font-size:.85rem&quot;&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Contactar usuarios&lt;/div&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Mensajes ilimitados&lt;/div&gt;
            &lt;div style=&quot;margin-bottom:6px&quot;&gt;✓ Insignia Silver&lt;/div&gt;
            &lt;div&gt;✓ Acceso a Fetiches&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;?php
}, 1);

// Auth pages dark theme
add_action(&#039;wp_head&#039;, function() {
    global $post;
    if (!$post) return;
    $auth_pages = array(33, 34, 60);
    if (!in_array($post-&gt;ID, $auth_pages)) return;
    echo &#039;&lt;style&gt;.um-login,.um-register,.um-page{background:#080610!important}.um-form .um-field-label{color:#ede9fe!important}&lt;/style&gt;&#039;;
});

// Remove site footer for cleaner look
add_filter(&#039;get_the_excerpt&#039;, function($excerpt, $post_obj = null) {
    return $excerpt;
});

// Ensure custom shortcodes work in Elementor
add_filter(&#039;widget_text&#039;, &#039;do_shortcode&#039;);


// PUBLIC PROFILE SHORTCODE
add_shortcode(&#039;deseosx_perfil_publico&#039;, function() {
  $uid = intval(isset($_GET[&#039;uid&#039;]) ? $_GET[&#039;uid&#039;] : 0);
  if(!$uid) $uid = get_current_user_id();
  if(!$uid) return &#039;&lt;p style=&quot;color:#ede9fe;text-align:center;padding:40px&quot;&gt;Perfil no encontrado.&lt;/p&gt;&#039;;
  $user = get_userdata($uid);
  if(!$user) return &#039;&lt;p style=&quot;color:#ede9fe;text-align:center;padding:40px&quot;&gt;Usuario no encontrado.&lt;/p&gt;&#039;;
  $raw_nm=(strpos($user-&gt;display_name,&#039;@&#039;)!==false)?$user-&gt;user_login:$user-&gt;display_name; $nm=esc_html($raw_nm);
  $ct=esc_html(get_user_meta($uid,&#039;dx_ciudad&#039;,true)); if(!$ct) $ct=&#039;Espana&#039;;
  $ag=intval(get_user_meta($uid,&#039;dx_edad&#039;,true));
  $ti=esc_html(get_user_meta($uid,&#039;dx_tipo&#039;,true));
  $bu=esc_html(get_user_meta($uid,&#039;dx_busca&#039;,true));
  $na=esc_html(get_user_meta($uid,&#039;dx_nacionalidad&#039;,true)); if(!$na) $na=&#039;Espanola&#039;;
  $desc=esc_html(get_user_meta($uid,&#039;dx_descripcion&#039;,true));
  $reg=date(&#039;M Y&#039;,strtotime($user-&gt;user_registered));
  $is_gold=get_user_meta($uid,&#039;dx_gold_member&#039;,true)||(get_user_meta($uid,&#039;dx_trial_end&#039;,true)&gt;time());
  $current_uid=get_current_user_id();
  $can_contact=$current_uid&amp;&amp;($is_gold||dx_can_contact($current_uid));
    $dx_servicios_map = array(&#039;dx_serv_24h&#039;=&gt;&#039;24h&#039;,&#039;dx_serv_masajes&#039;=&gt;&#039;Masajes&#039;,&#039;dx_serv_fr_natural&#039;=&gt;&#039;Fr Natural&#039;,&#039;dx_serv_lesbisco&#039;=&gt;&#039;Lesbisco&#039;,&#039;dx_serv_sado_bdsm&#039;=&gt;&#039;Sado BDSM&#039;,&#039;dx_serv_hoteles&#039;=&gt;&#039;Hoteles / Domicilios&#039;,&#039;dx_serv_beso_boca&#039;=&gt;&#039;Beso en la boca&#039;,&#039;dx_serv_griego&#039;=&gt;&#039;Griego&#039;,&#039;dx_serv_duplex&#039;=&gt;&#039;Duplex&#039;,&#039;dx_serv_lluvia&#039;=&gt;&#039;Lluvia dorada&#039;,&#039;dx_serv_viajes&#039;=&gt;&#039;Viajes&#039;,&#039;dx_serv_frances&#039;=&gt;&#039;Frances&#039;,&#039;dx_serv_beso_negro&#039;=&gt;&#039;Beso negro&#039;,&#039;dx_serv_parejas&#039;=&gt;&#039;Parejas&#039;,&#039;dx_serv_fiestera&#039;=&gt;&#039;Fiestera&#039;);
  $reviews_pos=intval(get_user_meta($uid,&#039;dx_reviews_pos&#039;,true));
  $reviews_neg=intval(get_user_meta($uid,&#039;dx_reviews_neg&#039;,true));
  $reviews=get_user_meta($uid,&#039;dx_reviews_list&#039;,true); if(!is_array($reviews)) $reviews=array();
  if($current_uid&amp;&amp;$current_uid!==$uid&amp;&amp;isset($_POST[&#039;dx_review_submit&#039;])){
    if(wp_verify_nonce(isset($_POST[&#039;dx_rv_nonce&#039;])?$_POST[&#039;dx_rv_nonce&#039;]:&#039;&#039;,&#039;dx_review&#039;)){
      $rv_tipo=sanitize_text_field(isset($_POST[&#039;dx_rv_tipo&#039;])?$_POST[&#039;dx_rv_tipo&#039;]:&#039;pos&#039;);
      $rv_txt=sanitize_text_field(isset($_POST[&#039;dx_rv_txt&#039;])?$_POST[&#039;dx_rv_txt&#039;]:&#039;&#039;);
      $rv_a=get_userdata($current_uid);
      $rv_nm=(strpos($rv_a-&gt;display_name,&#039;@&#039;)!==false)?$rv_a-&gt;user_login:$rv_a-&gt;display_name;
      $reviews[]=array(&#039;autor&#039;=&gt;$rv_nm,&#039;uid&#039;=&gt;$current_uid,&#039;texto&#039;=&gt;$rv_txt,&#039;tipo&#039;=&gt;$rv_tipo,&#039;fecha&#039;=&gt;date(&#039;d/m/Y&#039;));
      update_user_meta($uid,&#039;dx_reviews_list&#039;,$reviews);
      if($rv_tipo===&#039;pos&#039;) update_user_meta($uid,&#039;dx_reviews_pos&#039;,$reviews_pos+1);
      else update_user_meta($uid,&#039;dx_reviews_neg&#039;,$reviews_neg+1);
      wp_redirect(get_permalink().&#039;?uid=&#039;.$uid); exit;
    }
  }
  ob_start(); ?&gt;
&lt;div class=&quot;dx-perfil-wrap&quot;&gt;
  &lt;div class=&quot;dx-perfil-side&quot;&gt;
    &lt;div class=&quot;dx-avatar-box&quot;&gt;&lt;?php $av=get_user_meta($uid,&#039;dx_avatar&#039;,true); if($av): ?&gt;&lt;img src=&quot;&lt;?php echo esc_url($av); ?&gt;&quot; class=&quot;dx-avatar-img&quot;&gt;&lt;?php else: ?&gt;&lt;div class=&quot;dx-avatar-ph&quot;&gt;&lt;/div&gt;&lt;?php endif; ?&gt;&lt;/div&gt;
    &lt;div class=&quot;dx-confianza-box&quot;&gt;&lt;span class=&quot;dx-conf-label&quot;&gt;Confianza del perfil&lt;/span&gt;&lt;div class=&quot;dx-conf-bar&quot;&gt;&lt;div class=&quot;dx-conf-fill&quot; style=&quot;width:60%&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;nav class=&quot;dx-perfil-nav&quot;&gt;&lt;a href=&quot;/mi-panel/&quot;&gt;Mi panel&lt;/a&gt;&lt;a href=&quot;/buscar-contactos/&quot;&gt;Buscar contactos&lt;/a&gt;&lt;a href=&quot;#fotos&quot;&gt;Fotos nuevas&lt;/a&gt;&lt;a href=&quot;/anuncios/&quot;&gt;Anuncios&lt;/a&gt;&lt;a href=&quot;#historias&quot;&gt;Historias&lt;/a&gt;&lt;a href=&quot;#videos&quot;&gt;Videos&lt;/a&gt;&lt;a href=&quot;#amigos&quot;&gt;Amigos&lt;/a&gt;&lt;?php if($current_uid&amp;&amp;$current_uid!==$uid): ?&gt;&lt;a href=&quot;#reportar&quot; class=&quot;dx-nav-report&quot;&gt;Reportar perfil&lt;/a&gt;&lt;?php endif; ?&gt;&lt;/nav&gt;
  &lt;/div&gt;
  &lt;div class=&quot;dx-perfil-main&quot;&gt;
    &lt;h1 class=&quot;dx-perfil-nombre&quot;&gt;&lt;?php echo $nm; ?&gt; &lt;span class=&quot;dx-badge-verificado&quot;&gt;Verificado&lt;/span&gt;&lt;?php if($is_gold): ?&gt; &lt;span class=&quot;dx-badge-gold&quot;&gt;Gold&lt;/span&gt;&lt;?php endif; ?&gt;&lt;/h1&gt;
    &lt;p class=&quot;dx-perfil-meta&quot;&gt;&lt;?php echo $ct; ?&gt; | Activo hoy | Registro: &lt;?php echo $reg; ?&gt;&lt;/p&gt;
    &lt;div class=&quot;dx-fotos-grid&quot; id=&quot;fotos&quot;&gt;&lt;?php $fts=get_user_meta($uid,&#039;dx_fotos&#039;,true); if(!is_array($fts)) $fts=array(); $mf=!empty($fts)?$fts[0]:&#039;&#039;; $ef=array_slice($fts,1,3); ?&gt;&lt;div class=&quot;dx-foto-main&quot;&gt;&lt;?php if($mf): ?&gt;&lt;img src=&quot;&lt;?php echo esc_url($mf); ?&gt;&quot;&gt;&lt;?php else: ?&gt;&lt;div class=&quot;dx-foto-ph&quot;&gt;&lt;/div&gt;&lt;?php endif; ?&gt;&lt;/div&gt;&lt;?php for($fi=0;$fi&lt;3;$fi++): $ff=isset($ef[$fi])?$ef[$fi]:&#039;&#039;; ?&gt;&lt;div class=&quot;dx-foto-sm&quot;&gt;&lt;?php if($ff): ?&gt;&lt;img src=&quot;&lt;?php echo esc_url($ff); ?&gt;&quot;&gt;&lt;?php else: ?&gt;&lt;div class=&quot;dx-foto-ph&quot;&gt;&lt;/div&gt;&lt;?php endif; ?&gt;&lt;/div&gt;&lt;?php endfor; ?&gt;&lt;/div&gt;
    &lt;p style=&quot;text-align:right;margin:6px 0 16px&quot;&gt;&lt;a href=&quot;#fotos&quot; class=&quot;dx-ver-fotos&quot;&gt;Ver todas las fotos &amp;rarr;&lt;/a&gt;&lt;/p&gt;
    &lt;div class=&quot;dx-datos-box&quot;&gt;&lt;h3 class=&quot;dx-section-title&quot;&gt;DATOS DEL USUARIO&lt;/h3&gt;&lt;div class=&quot;dx-datos-grid&quot;&gt;&lt;div&gt;&lt;span class=&quot;dx-dato-label&quot;&gt;Tipo: &lt;/span&gt;&lt;?php echo $ti?$ti:&#039;&amp;mdash;&#039;; ?&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;dx-dato-label&quot;&gt;Edad: &lt;/span&gt;&lt;?php echo $ag?$ag.&#039; anos&#039;:&#039;&amp;mdash;&#039;; ?&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;dx-dato-label&quot;&gt;Nacionalidad: &lt;/span&gt;&lt;?php echo $na; ?&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;dx-dato-label&quot;&gt;Busca: &lt;/span&gt;&lt;?php echo $bu?$bu:&#039;&amp;mdash;&#039;; ?&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;dx-servicios-box&quot;&gt;&lt;h3 class=&quot;dx-section-title&quot;&gt;SERVICIOS QUE REALIZO&lt;/h3&gt;&lt;div style=&quot;display:grid;grid-template-columns:repeat(3,1fr);gap:6px 16px;margin-top:8px;&quot;&gt;&lt;?php $smap=[&#039;dx_serv_24h&#039;=&gt;&#039;24h&#039;,&#039;dx_serv_masajes&#039;=&gt;&#039;Masajes&#039;,&#039;dx_serv_fr_natural&#039;=&gt;&#039;Fr Natural&#039;,&#039;dx_serv_lesbisco&#039;=&gt;&#039;Lesbisco&#039;,&#039;dx_serv_sado_bdsm&#039;=&gt;&#039;Sado BDSM&#039;,&#039;dx_serv_hoteles&#039;=&gt;&#039;Hoteles / Domicilios&#039;,&#039;dx_serv_beso_boca&#039;=&gt;&#039;Beso en la boca&#039;,&#039;dx_serv_griego&#039;=&gt;&#039;Griego&#039;,&#039;dx_serv_duplex&#039;=&gt;&#039;Duplex&#039;,&#039;dx_serv_lluvia&#039;=&gt;&#039;Lluvia dorada&#039;,&#039;dx_serv_viajes&#039;=&gt;&#039;Viajes&#039;,&#039;dx_serv_frances&#039;=&gt;&#039;Frances&#039;,&#039;dx_serv_beso_negro&#039;=&gt;&#039;Beso negro&#039;,&#039;dx_serv_parejas&#039;=&gt;&#039;Parejas&#039;,&#039;dx_serv_fiestera&#039;=&gt;&#039;Fiestera&#039;];foreach($smap as $sk=&gt;$sl){$sv=get_user_meta($uid,$sk,true);echo &#039;&lt;div style=&quot;color:#e2e8f0;font-size:.9em;padding:2px 0;&quot;&gt;&#039;.($sv?&#039;&lt;span style=&quot;color:#22c55e;font-weight:bold;&quot;&gt;&amp;#10003;&lt;/span&gt;&#039;:&#039;&lt;span style=&quot;color:#ef4444;font-weight:bold;&quot;&gt;&amp;#10007;&lt;/span&gt;&#039;).&#039; &#039;.esc_html($sl).&#039;&lt;/div&gt;&#039;;}?&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;dx-contact-box&quot;&gt;&lt;?php if($can_contact): ?&gt;&lt;?php $tel=get_user_meta($uid,&#039;dx_telefono&#039;,true); $wa=get_user_meta($uid,&#039;dx_whatsapp&#039;,true); if($tel||$wa): ?&gt;&lt;p style=&quot;color:#ede9fe&quot;&gt;&lt;?php echo $tel?&#039;Tel: &#039;.esc_html($tel).&#039; &#039;:&#039;&#039;; echo $wa?&#039;WA: &#039;.esc_html($wa):&#039;&#039;; ?&gt;&lt;/p&gt;&lt;?php else: ?&gt;&lt;p style=&quot;color:rgba(237,233,254,.5)&quot;&gt;Sin datos de contacto.&lt;/p&gt;&lt;?php endif; ?&gt;&lt;?php else: ?&gt;&lt;p class=&quot;dx-contact-hide&quot;&gt;Solo usuarios Gold pueden ver el contacto&lt;/p&gt;&lt;a href=&quot;/membership-join/&quot; class=&quot;dx-btn-gold-cta&quot;&gt;HAZTE GOLD PARA VER EL CONTACTO&lt;/a&gt;&lt;?php endif; ?&gt;&lt;/div&gt;
    &lt;?php if($desc): ?&gt;&lt;div class=&quot;dx-desc-box&quot;&gt;&lt;h3 class=&quot;dx-section-title&quot;&gt;DESCRIPCION&lt;/h3&gt;&lt;p style=&quot;color:rgba(237,233,254,.85);line-height:1.6&quot;&gt;&lt;?php echo nl2br($desc); ?&gt;&lt;/p&gt;&lt;/div&gt;&lt;?php endif; ?&gt;
    &lt;div class=&quot;dx-reviews-box&quot;&gt;&lt;h3 class=&quot;dx-section-title&quot;&gt;RESENAS Y CALIFICACIONES&lt;/h3&gt;&lt;div class=&quot;dx-reviews-score&quot;&gt;&lt;span class=&quot;dx-rv-pos-cnt&quot;&gt;&amp;#10003; Positivas (&lt;?php echo $reviews_pos; ?&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;dx-rv-neg-cnt&quot;&gt;&amp;#10007; Negativas (&lt;?php echo $reviews_neg; ?&gt;)&lt;/span&gt;&lt;/div&gt;&lt;?php if(empty($reviews)): ?&gt;&lt;p style=&quot;color:rgba(237,233,254,.5)&quot;&gt;Sin resenas todavia.&lt;/p&gt;&lt;?php else: foreach(array_reverse($reviews) as $rv): ?&gt;&lt;div class=&quot;dx-rv-item dx-rv-&lt;?php echo esc_attr($rv[&#039;tipo&#039;]); ?&gt;&quot;&gt;&lt;div class=&quot;dx-rv-header&quot;&gt;&lt;span class=&quot;dx-rv-autor&quot;&gt;&lt;?php echo esc_html($rv[&#039;autor&#039;]); ?&gt;&lt;/span&gt;&lt;span class=&quot;dx-rv-fecha&quot;&gt;&lt;?php echo esc_html($rv[&#039;fecha&#039;]); ?&gt;&lt;/span&gt;&lt;span class=&quot;dx-rv-badge&quot;&gt;&lt;?php echo $rv[&#039;tipo&#039;]===&#039;pos&#039;?&#039;Positiva&#039;:&#039;Negativa&#039;; ?&gt;&lt;/span&gt;&lt;/div&gt;&lt;p class=&quot;dx-rv-txt&quot;&gt;&lt;?php echo esc_html($rv[&#039;texto&#039;]); ?&gt;&lt;/p&gt;&lt;/div&gt;&lt;?php endforeach; endif; ?&gt;&lt;?php if($current_uid&amp;&amp;$current_uid!==$uid): ?&gt;&lt;div class=&quot;dx-rv-form-box&quot;&gt;&lt;h4 style=&quot;color:#e0196b;margin-bottom:12px&quot;&gt;Dejar una resena&lt;/h4&gt;&lt;form method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;uid&quot; value=&quot;&lt;?php echo $uid; ?&gt;&quot;&gt;&lt;?php wp_nonce_field(&#039;dx_review&#039;,&#039;dx_rv_nonce&#039;); ?&gt;&lt;label style=&quot;color:#ede9fe;margin-right:16px&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;dx_rv_tipo&quot; value=&quot;pos&quot; checked&gt; Positiva&lt;/label&gt;&lt;label style=&quot;color:#ede9fe&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;dx_rv_tipo&quot; value=&quot;neg&quot;&gt; Negativa&lt;/label&gt;&lt;br&gt;&lt;br&gt;&lt;textarea name=&quot;dx_rv_txt&quot; placeholder=&quot;Escribe tu resena...&quot; rows=&quot;3&quot; style=&quot;width:100%;padding:10px;background:#1a1730;border:1px solid rgba(255,255,255,.15);border-radius:8px;color:#ede9fe;resize:vertical;box-sizing:border-box&quot;&gt;&lt;/textarea&gt;&lt;br&gt;&lt;button type=&quot;submit&quot; name=&quot;dx_review_submit&quot; style=&quot;margin-top:8px;padding:10px 24px;background:#e0196b;border:none;border-radius:8px;color:#fff;font-weight:700;cursor:pointer&quot;&gt;Publicar resena&lt;/button&gt;&lt;/form&gt;&lt;/div&gt;&lt;?php endif; ?&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;?php return ob_get_clean();
});

add_action(&#039;wp_head&#039;,function(){
  if(!is_page(&#039;perfil&#039;)) return;
  echo &#039;&lt;style&gt;.dx-perfil-wrap{display:flex;gap:24px;max-width:1200px;margin:0 auto;padding:20px;color:#ede9fe}.dx-perfil-side{width:180px;flex-shrink:0}.dx-perfil-main{flex:1;min-width:0}.dx-avatar-box{background:#1a1730;border-radius:12px;overflow:hidden;margin-bottom:10px;min-height:160px;display:flex;align-items:center;justify-content:center}.dx-avatar-img{width:100%;height:auto}.dx-avatar-ph{width:100%;min-height:160px;background:#2a2545}.dx-conf-label{font-size:.75em;color:rgba(237,233,254,.5);display:block;margin-bottom:4px}.dx-conf-bar{height:4px;background:rgba(255,255,255,.1);border-radius:2px}.dx-conf-fill{height:100%;background:linear-gradient(90deg,#e0196b,#7c3aed);border-radius:2px}.dx-perfil-nav{margin-top:20px;display:flex;flex-direction:column}.dx-perfil-nav a{color:rgba(237,233,254,.75);text-decoration:none;padding:8px 4px;border-bottom:1px solid rgba(255,255,255,.06);font-size:.88em;transition:color .2s}.dx-perfil-nav a:hover{color:#e0196b}.dx-nav-report{color:rgba(224,25,107,.6)!important;font-size:.8em!important}.dx-perfil-nombre{font-size:1.5em;margin:0 0 4px;color:#fff;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.dx-badge-verificado{font-size:.45em;background:#22c55e;color:#fff;padding:3px 8px;border-radius:4px;font-weight:600}.dx-badge-gold{font-size:.45em;background:#f0b429;color:#1a1730;padding:3px 8px;border-radius:4px;font-weight:700}.dx-perfil-meta{color:rgba(237,233,254,.5);font-size:.85em;margin:0 0 16px}.dx-fotos-grid{display:grid;grid-template-columns:2fr 1fr 1fr;grid-template-rows:110px 110px;gap:4px}.dx-foto-main{grid-row:span 2;background:#1a1730;border-radius:8px;overflow:hidden}.dx-foto-sm{background:#1a1730;border-radius:6px;overflow:hidden}.dx-foto-ph{width:100%;height:100%;background:#2a2545}.dx-foto-main img,.dx-foto-sm img{width:100%;height:100%;object-fit:cover;display:block}.dx-ver-fotos{color:#e0196b;font-size:.85em;text-decoration:none}.dx-datos-box,.dx-servicios-box,.dx-contact-box,.dx-desc-box,.dx-reviews-box{background:#110f1e;border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:20px;margin-top:16px}.dx-section-title{color:#e0196b;font-size:.8em;font-weight:700;letter-spacing:.1em;margin:0 0 14px}.dx-datos-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 24px;font-size:.9em}.dx-dato-label{color:rgba(237,233,254,.5)}.dx-servicios-title{background:#e0196b;color:#fff;text-align:center;font-weight:700;padding:10px;border-radius:8px;margin-bottom:12px;font-size:.85em;letter-spacing:.06em}.dx-servicios-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px 4px}.dx-servicio-item{color:rgba(237,233,254,.8);font-size:.85em}.dx-contact-hide{color:rgba(237,233,254,.5);text-align:center;margin-bottom:12px;font-size:.9em}.dx-btn-gold-cta{display:block;width:100%;padding:14px;background:#e0196b;border-radius:8px;color:#fff;text-align:center;font-weight:700;text-decoration:none;font-size:1em;box-sizing:border-box}.dx-reviews-score{display:flex;gap:16px;margin-bottom:16px}.dx-rv-pos-cnt{color:#22c55e;font-weight:600}.dx-rv-neg-cnt{color:#e0196b;font-weight:600}.dx-rv-item{border:1px solid rgba(255,255,255,.08);border-radius:8px;padding:12px;margin-bottom:10px}.dx-rv-item.dx-rv-pos{border-color:rgba(34,197,94,.2)}.dx-rv-item.dx-rv-neg{border-color:rgba(224,25,107,.2)}.dx-rv-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;flex-wrap:wrap;gap:6px}.dx-rv-autor{color:#e0196b;font-weight:600;font-size:.9em}.dx-rv-fecha{color:rgba(237,233,254,.4);font-size:.8em}.dx-rv-badge{font-size:.75em;padding:2px 8px;border-radius:4px}.dx-rv-item.dx-rv-pos .dx-rv-badge{background:rgba(34,197,94,.15);color:#22c55e}.dx-rv-item.dx-rv-neg .dx-rv-badge{background:rgba(224,25,107,.15);color:#e0196b}.dx-rv-form-box{margin-top:20px;border-top:1px solid rgba(255,255,255,.08);padding-top:20px}.dx-rv-txt{color:rgba(237,233,254,.8);font-size:.9em;margin:4px 0 0}@media(max-width:640px){.dx-perfil-wrap{flex-direction:column}.dx-perfil-side{width:100%}.dx-fotos-grid{grid-template-columns:1fr 1fr;grid-template-rows:auto}.dx-foto-main{grid-row:span 1}.dx-datos-grid{grid-template-columns:1fr}.dx-servicios-grid{grid-template-columns:1fr 1fr}}&lt;/style&gt;&#039;;
},15);


add_shortcode(&#039;dx_registro&#039;,function(){
  if(is_user_logged_in()) return &#039;&lt;p style=&quot;color:#ede9fe;text-align:center&quot;&gt;Ya registrado. &lt;a href=&quot;/mi-panel/&quot; style=&quot;color:#e0196b&quot;&gt;Mi panel&lt;/a&gt;&lt;/p&gt;&#039;;
  $err=&#039;&#039;;
  if(isset($_POST[&#039;dx_reg_submit&#039;])){
    $nonce=isset($_POST[&#039;dx_reg_nonce&#039;])?$_POST[&#039;dx_reg_nonce&#039;]:&#039;&#039;;
    if(!wp_verify_nonce($nonce,&#039;dx_registro&#039;)){$err=&#039;Error de seguridad.&#039;;}
    else{
      $un=sanitize_user(trim(isset($_POST[&#039;dx_user&#039;])?$_POST[&#039;dx_user&#039;]:&#039;&#039;)); 
      $em=sanitize_email(trim(isset($_POST[&#039;dx_email&#039;])?$_POST[&#039;dx_email&#039;]:&#039;&#039;)); 
      $pw=isset($_POST[&#039;dx_pass&#039;])?$_POST[&#039;dx_pass&#039;]:&#039;&#039;;
      $ti=sanitize_text_field(isset($_POST[&#039;dx_tipo&#039;])?$_POST[&#039;dx_tipo&#039;]:&#039;&#039;);
      $bu=sanitize_text_field(isset($_POST[&#039;dx_busca&#039;])?$_POST[&#039;dx_busca&#039;]:&#039;&#039;);
      $ci=sanitize_text_field(isset($_POST[&#039;dx_ciudad&#039;])?$_POST[&#039;dx_ciudad&#039;]:&#039;&#039;);
      $ed=intval(isset($_POST[&#039;dx_edad&#039;])?$_POST[&#039;dx_edad&#039;]:0);
      if(!$un||!$em||!$pw){$err=&#039;Rellena todos los campos obligatorios.&#039;;}
      elseif(strlen($pw)&lt;6){$err=&#039;La contrasena debe tener al menos 6 caracteres.&#039;;}
      elseif($ed&lt;18){$err=&#039;Debes ser mayor de 18 anos.&#039;;}
      elseif(username_exists($un)){$err=&#039;Ese nombre ya existe.&#039;;}
      elseif(email_exists($em)){$err=&#039;Ese email ya esta registrado.&#039;;}
      else{
        $uid=wp_create_user($un,$pw,$em);
        if(is_wp_error($uid)){$err=$uid-&gt;get_error_message();}
        else{
          wp_update_user(array(&#039;ID&#039;=&gt;$uid,&#039;display_name&#039;=&gt;$un,&#039;nickname&#039;=&gt;$un));
          update_user_meta($uid,&#039;dx_tipo&#039;,$ti);
          update_user_meta($uid,&#039;dx_busca&#039;,$bu);
          update_user_meta($uid,&#039;dx_ciudad&#039;,$ci);
          update_user_meta($uid,&#039;dx_edad&#039;,$ed);
          wp_signon(array(&#039;user_login&#039;=&gt;$un,&#039;user_password&#039;=&gt;$pw,&#039;remember&#039;=&gt;true),false);
          wp_redirect(&#039;/mi-panel/&#039;); exit;
        }
      }
    }
  }
  ob_start(); ?&gt;
&lt;div class=&quot;dx-reg-wrap&quot;&gt;
&lt;?php if($err): ?&gt;&lt;div class=&quot;dx-reg-error&quot;&gt;&lt;?php echo esc_html($err); ?&gt;&lt;/div&gt;&lt;?php endif; ?&gt;
&lt;form method=&quot;post&quot; class=&quot;dx-reg-form&quot;&gt;
  &lt;?php wp_nonce_field(&#039;dx_registro&#039;,&#039;dx_reg_nonce&#039;); ?&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Nombre de usuario *&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;dx_user&quot; required maxlength=&quot;30&quot; placeholder=&quot;Tu apodo en DeseosX&quot; value=&quot;&lt;?php echo esc_attr(isset($_POST[&#039;dx_user&#039;])?$_POST[&#039;dx_user&#039;]:&#039;&#039;); ?&gt;&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Email *&lt;/label&gt;&lt;input type=&quot;email&quot; name=&quot;dx_email&quot; required value=&quot;&lt;?php echo esc_attr(isset($_POST[&#039;dx_email&#039;])?$_POST[&#039;dx_email&#039;]:&#039;&#039;); ?&gt;&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Contrasena *&lt;/label&gt;&lt;input type=&quot;password&quot; name=&quot;dx_pass&quot; required minlength=&quot;6&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Que soy *&lt;/label&gt;&lt;select name=&quot;dx_tipo&quot; required&gt;&lt;option value=&quot;&quot;&gt;-- Selecciona --&lt;/option&gt;&lt;option&gt;Hombre&lt;/option&gt;&lt;option&gt;Mujer&lt;/option&gt;&lt;option&gt;Pareja&lt;/option&gt;&lt;option&gt;Trans&lt;/option&gt;&lt;option&gt;Bi&lt;/option&gt;&lt;option&gt;Otro&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Que busco *&lt;/label&gt;&lt;select name=&quot;dx_busca&quot; required&gt;&lt;option value=&quot;&quot;&gt;-- Selecciona --&lt;/option&gt;&lt;option&gt;Chicos&lt;/option&gt;&lt;option&gt;Chicas&lt;/option&gt;&lt;option&gt;Parejas&lt;/option&gt;&lt;option&gt;Trans&lt;/option&gt;&lt;option&gt;Cualquiera&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Mi Ciudad&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;dx_ciudad&quot; placeholder=&quot;Ej: Madrid&quot; value=&quot;&lt;?php echo esc_attr(isset($_POST[&#039;dx_ciudad&#039;])?$_POST[&#039;dx_ciudad&#039;]:&#039;&#039;); ?&gt;&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;label&gt;Mi Edad *&lt;/label&gt;&lt;input type=&quot;number&quot; name=&quot;dx_edad&quot; required min=&quot;18&quot; max=&quot;99&quot; value=&quot;&lt;?php echo esc_attr(isset($_POST[&#039;dx_edad&#039;])?$_POST[&#039;dx_edad&#039;]:&#039;&#039;); ?&gt;&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dx-field&quot;&gt;&lt;button type=&quot;submit&quot; name=&quot;dx_reg_submit&quot; class=&quot;dx-btn-reg&quot;&gt;Crear mi cuenta gratis&lt;/button&gt;&lt;/div&gt;
  &lt;p style=&quot;margin-top:12px;font-size:.85em;color:rgba(237,233,254,.6);text-align:center&quot;&gt;Mayor de 18 anos. Al registrarte aceptas los &lt;a href=&quot;/terminos/&quot; style=&quot;color:#e0196b&quot;&gt;terminos&lt;/a&gt;.&lt;/p&gt;
&lt;/form&gt;&lt;/div&gt;
&lt;?php return ob_get_clean();
});


// ===== FILTRO ANTI-CONTACTO =====
function dx_filter_contact($text) {
  $text = preg_replace(&#039;/\b(\+?\d[\d\s\-\.]{6,14}\d)\b/&#039;, &#039;[NUMERO OCULTO]&#039;, $text);
  $text = preg_replace(&#039;/[\w._%+\-]+\s*[\[(@]\s*[\w.\-]+\s*[\].)]+\s*\.\s*[\w]{2,4}/&#039;, &#039;[EMAIL OCULTO]&#039;, $text);
  $text = preg_replace(&#039;/\b(whatsapp|whats|whasap|wpp|telegram|tele|tg|instagram|insta|ig|snap|snapchat|skype|signal|viber|twitter|tiktok|facebook|fb|discord)\s*[:\-=@]?\s*[\w.+\-@]{3,50}/i&#039;, &#039;[CONTACTO OCULTO]&#039;, $text);
  $text = preg_replace(&#039;/@[\w.]{3,50}/&#039;, &#039;[CONTACTO OCULTO]&#039;, $text);
  return $text;
}
add_filter(&#039;wp_insert_post_data&#039;, function($data) {
  if(in_array($data[&#039;post_type&#039;], array(&#039;dx_anuncio&#039;,&#039;dx_fetiche&#039;))) {
    $data[&#039;post_content&#039;] = dx_filter_contact($data[&#039;post_content&#039;]);
    $data[&#039;post_excerpt&#039;] = dx_filter_contact($data[&#039;post_excerpt&#039;]);
  }
  return $data;
}, 10, 1);
add_action(&#039;updated_user_meta&#039;, function($mid, $uid, $key, $val) {
  $fields = array(&#039;dx_descripcion&#039;,&#039;description&#039;);
  if(in_array($key, $fields)) {
    $clean = dx_filter_contact($val);
    if($clean !== $val) update_user_meta($uid, $key, $clean);
  }
}, 10, 4);


// === EMAILS EN ESPANOL ===
// Traduce el email de recuperacion de contrasena de WordPress nativo
add_filter(&#039;retrieve_password_title&#039;, function($title, $user_login, $user_data) {
    return &#039;Restablecer tu contrasena en &#039; . get_bloginfo(&#039;name&#039;);
}, 10, 3);

add_filter(&#039;retrieve_password_message&#039;, function($message, $key, $user_login, $user_data) {
    $reset_url = network_site_url(&#039;wp-login.php?action=rp&amp;key=&#039; . $key . &#039;&amp;login=&#039; . rawurlencode($user_login), &#039;login&#039;);
    $site_name = get_bloginfo(&#039;name&#039;);
    $msg  = &quot;Hola,\r\n\r\n&quot;;
    $msg .= &quot;Recibimos una solicitud para restablecer la contrasena de tu cuenta en &quot; . $site_name . &quot;.\r\n\r\n&quot;;
    $msg .= &quot;Para restablecer tu contrasena, haz clic en el siguiente enlace:\r\n\r\n&quot;;
    $msg .= $reset_url . &quot;\r\n\r\n&quot;;
    $msg .= &quot;Si no solicitaste este cambio, puedes ignorar este correo.\r\n\r\n&quot;;
    $msg .= &quot;Gracias,\r\n&quot;;
    $msg .= &quot;El equipo de &quot; . $site_name . &quot;\r\n&quot;;
    return $msg;
}, 10, 4);
// === FIN EMAILS EN ESPANOL ===
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//deseosx.com/main-sitemap.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<url>
		<loc>https://deseosx.com/category/uncategorized/</loc>
		<lastmod>2026-05-26T04:24:40+00:00</lastmod>
	</url>
</urlset>
<!-- XML Sitemap generated by Rank Math SEO Plugin (c) Rank Math - rankmath.com -->