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

139
Visualizações
Add <script> in wordpress post

I use the elementor plugin for the table of content, But I have a code to minimize the table of content on the desktop. I want to disable the table of content everywhere my site that I use it.

My code is:

<script> 
jQuery(document).ready(function($) { 
var delay = 100; setTimeout(function() { 
$('.elementor-widget-table-of-contents').addClass('elementor-toc--collapsed');
 $('.elementor-toc__body').css('display', 'none'); }, delay); 
}); 
</script>

How can I add this code correctly on my website?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You can use the plugin Code Snippets to add your snippet to all the pages of your website. It supports PHP snippets, but you can just echo your script:

<?php
echo "<script> 
      jQuery(document).ready(function($) { 
          var delay = 100; setTimeout(function() { 
              $('.elementor-widget-table-of-contents').addClass('elementor-toc--collapsed');
              $('.elementor-toc__body').css('display', 'none'); }, 
          delay); 
   }); 
   </script>"
;
?>
about 4 years ago · Juan Pablo Isaza Relatório

0

Your client-side solution (jQuery/Javascript + CSS) is not a good idea to remove TOC because your source code will be dirty and didn't change.

You must solve this problem with logical solutions like changing Plugin's Settings or using PHP/Wordpress functions.

Here is a better solution:

https://wordpress.org/support/topic/hide-or-remove-table-of-content/

Good Luck

about 4 years ago · Juan Pablo Isaza 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