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

127
Vistas
Replacing WordPress widget content class

I am trying to change the classes in some of the WordPress widgets. Specifically, I want to add bootstrap classes.

For example, I want to add the "form-control" class to "wp-block-search__input" class

I have tried

function replace_widget($text) {
        $text = str_replace('wp-block-search__inside-wrapper', 'wp-block-search__inside-wrapper input-group', $text);
        $text = str_replace('wp-block-search__input', 'wp-block-search__input form-control', $text);
        $text = str_replace('wp-block-search__button', 'wp-block-search__button btn btn-secondary', $text);
        return $text;
    }
    add_filter('dynamic_sidebar_params', 'replace_widget');

But this and similar attempts do not seem to work.

I have tried a fair few different options instead of "dynamic_sidebar_params" and I am not sure if this is what I am doing wrong.

I am not sure if it is not working because the WordPress blocks are created in JS.

I don't want to do it by adding javascript or jquery to the footer if it can be helped. I would prefer to do it in the backend.

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