Alexandre Magno

Gameplay Programmer

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

document.addEventListener("DOMContentLoaded", function () { // Procura todos os projetos const projects = document.querySelectorAll(".et_pb_portfolio_item"); projects.forEach(function (project) { // Tenta extrair o link do projeto const link = project.querySelector("a").href; // Requisição AJAX para pegar as tags do post via REST API fetch(link + '?rest_route=/wp/v2/posts') .then(res => res.json()) .then(postData => { if (!postData || !postData.id) return; // Pega o ID do post const postId = postData.id; // Busca as tags desse post fetch(`/wp-json/wp/v2/tags?post=${postId}`) .then(res => res.json()) .then(tags => { if (!tags.length) return; // Cria um container de tags const tagWrapper = document.createElement("div"); tagWrapper.className = "project-tags"; tags.forEach(tag => { const tagElement = document.createElement("span"); tagElement.className = "project-tag tag-" + tag.slug; tagElement.innerText = tag.name; tagWrapper.appendChild(tagElement); }); // Adiciona o bloco de tags abaixo do título const meta = project.querySelector(".post-meta"); if (meta) meta.parentNode.insertBefore(tagWrapper, meta.nextSibling); }); }); }); });