Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
How to detect wordpress theme using php

i have look for Wordpress theme detector but i have no idea how it works and how to detect wordpress activated theme into theme folder. like https://theseotools.net/wp-theme-detector

please help me how can i did this.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I wrote this code for the purpose of readability. Normally, people would spend more than 10 lines of code fetching the name of an active wordpress template. There might be some minor adaptions needed, but nevertheless, this works. So, first we fetch the source code for the home page. Then we use regex to find style.css, then we use regex to fetch the name (refer to wordpress style sheet conventions), and yay we now have the name of the active theme. You can even get the download URI from here, as well.

<?php
$targetSite = ""; // put your wordpress url here
$src = file_get_contents($targetSite);
preg_match("/\<link rel='stylesheet'.*href='(.*?style\.css.*?)'.*\>/i",$src,$matches);
$styleHref = trim($matches[1]);
$styleSrc = file_get_contents($styleHref);
preg_match("/\Theme Name:(.*?)\n/i",$styleSrc,$name);
echo(trim($name[1]));
?>
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda