Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda