{"id":525,"date":"2026-11-08T17:05:40","date_gmt":"2026-11-08T16:05:40","guid":{"rendered":"https:\/\/danielmatemoreno.com\/?page_id=525"},"modified":"2026-11-08T17:15:02","modified_gmt":"2026-11-08T16:15:02","slug":"buscar-fotografias-2","status":"publish","type":"page","link":"https:\/\/danielmatemoreno.com\/index.php\/buscar-fotografias-2\/","title":{"rendered":"Buscar fotograf\u00edas"},"content":{"rendered":"\n\n<div id=\"dm-resultados\">\n    <h2 id=\"dm-resultados-titulo\">Buscar fotograf\u00edas<\/h2>\n    <div id=\"dm-resultados-grid\"><\/div>\n    <p id=\"dm-resultados-mensaje\">Introduce una palabra en la lupa para encontrar fotograf\u00edas.<\/p>\n<\/div>\n\n<style>\n#dm-resultados {\n    width: 100%;\n    color: #fff;\n    padding: 20px 0;\n}\n#dm-resultados h2 {\n    font-size: 22px;\n    font-weight: 400;\n    margin: 0 0 28px;\n}\n#dm-resultados-grid {\n    columns: 3;\n    column-gap: 14px;\n}\n#dm-resultados-grid a {\n    display: block;\n    break-inside: avoid;\n    margin-bottom: 14px;\n    overflow: hidden;\n    background: #171717;\n}\n#dm-resultados-grid img {\n    display: block;\n    width: 100%;\n    height: auto;\n}\n#dm-resultados-grid a:hover img {\n    opacity: .82;\n}\n#dm-resultados-mensaje {\n    color: #aaa;\n    font-size: 14px;\n}\n@media (max-width: 700px) {\n    #dm-resultados-grid { columns: 2; column-gap: 9px; }\n    #dm-resultados-grid a { margin-bottom: 9px; }\n}\n<\/style>\n\n<script>\n(function () {\n    const contenedor = document.getElementById('dm-resultados');\n    if (!contenedor || contenedor.dataset.iniciado) return;\n    contenedor.dataset.iniciado = 'si';\n\n    const titulo = document.getElementById('dm-resultados-titulo');\n    const grid = document.getElementById('dm-resultados-grid');\n    const mensaje = document.getElementById('dm-resultados-mensaje');\n\n    const termino = (new URLSearchParams(window.location.search).get('foto') || '').trim();\n\n    if (!termino) return;\n\n    titulo.textContent = 'Resultados de la b\u00fasqueda \u00ab' + termino + '\u00bb';\n    mensaje.textContent = 'Buscando fotograf\u00edas...';\n\n    fetch('\/wp-json\/dm\/v1\/search-photos?q=' + encodeURIComponent(termino))\n        .then(function (respuesta) {\n            if (!respuesta.ok) throw new Error('Error al consultar las fotograf\u00edas');\n            return respuesta.json();\n        })\n        .then(function (fotos) {\n            if (!Array.isArray(fotos) || fotos.length === 0) {\n                mensaje.textContent = 'No se han encontrado fotograf\u00edas.';\n                return;\n            }\n\n            fotos.forEach(function (foto) {\n                const enlace = document.createElement('a');\n                enlace.href = '#dm-photo-' + foto.id;\n                enlace.setAttribute('aria-label', foto.title || 'Abrir fotograf\u00eda');\n\n                const imagen = document.createElement('img');\n                imagen.src = foto.url || foto.full;\n                imagen.alt = foto.alt || foto.title || '';\n                imagen.loading = 'lazy';\n\n                enlace.appendChild(imagen);\n                grid.appendChild(enlace);\n            });\n\n            mensaje.textContent = fotos.length + ' fotograf\u00edas encontradas.';\n        })\n        .catch(function (error) {\n            console.error(error);\n            mensaje.textContent = 'No se han podido cargar las fotograf\u00edas.';\n        });\n})();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Buscar fotograf\u00edas Introduce una palabra en la lupa para encontrar fotograf\u00edas.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-525","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/pages\/525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/comments?post=525"}],"version-history":[{"count":3,"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/pages\/525\/revisions"}],"predecessor-version":[{"id":528,"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/pages\/525\/revisions\/528"}],"wp:attachment":[{"href":"https:\/\/danielmatemoreno.com\/index.php\/wp-json\/wp\/v2\/media?parent=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}