title: I need fix some buttons that do not change the content according to the chosen category of buttons
body: <p>I have a problem with this code, I have several buttons with various categories and when you click it it should change what it shows according to the category you have chosen, as I have it now it does not change what it shows, I hope you can help me fellows.</p>
  <p>Here is a link of a video that shows the problem:
  <a href="https://www.loom.com/share/1371ed7d195544269e28197cafd25407" rel="nofollow noreferrer">https://www.loom.com/share/1371ed7d195544269e28197cafd25407</a></p>
  <pre><code>&lt;?php
  
  ?&gt;
  &lt;?php get_header(); ?&gt;
  &lt;?php get_template_part('template_parts/banner-casos-de-exito') ?&gt;
  
  &lt;section class=&quot;section&quot;&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;section__body mt-0&quot;&gt;
              &lt;div class=&quot;grid-history&quot;&gt;
  
                  &lt;div class=&quot;row&quot;&gt;
                      &lt;?php
  
                          $terms = get_terms('historias-de-exitos');
                          $count = count($terms);
  
                          if ( $count &gt; 0 )
                          {
  
                      ?&gt;
  
                              &lt;ul id=&quot;filters-2&quot; class=&quot;clearfix&quot;&gt;
                                  &lt;li&gt;&lt;span class=&quot;filter active&quot; data-filter=&quot;.all&quot;&gt;Todos&lt;/span&gt;&lt;/li&gt;
                                  &lt;?php
                                      foreach ( $terms as $term ) 
                                      {
  
                                          $termname = strtolower($term-&gt;name);  
                                          $termname = str_replace(' ', '-', $termname);  
  
                                          echo '&lt;li&gt;
                                                  &lt;span class=&quot;filter&quot; data-filter=&quot;' . '.' . $termname . '&quot;&gt;
                                                      ' . $term-&gt;name . '
                                                  &lt;/span&gt;
                                                &lt;/li&gt;';
                                      }
  
                                  ?&gt;
                              &lt;/ul&gt;
  
                      &lt;?php
                          
                          }
  
                      ?&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;row&quot;&gt;
  
                      &lt;?php 
                          $loop = new WP_Query(
                                          array(
                                              'post_type' =&gt; 'historias-de-exito', 
                                              'posts_per_page' =&gt; 3,
                                              'post_status' =&gt; 'publish',
                                              'order'   =&gt; 'DESC',
                                              'ignore_sticky_posts' =&gt; true                                            
                                          )
                                      );
                          $count = 0;
                      ?&gt;
  
                      &lt;div id=&quot;portfoliolist&quot;&gt;
  
                          &lt;?php 
                              
                              if ( $loop ) : 
  
                                  while ( $loop-&gt;have_posts()) : $loop-&gt;the_post();
  
                                      $imagen__portada__exito = get_field( 'imagen__portada__exito' );
                                      $icono__casos__exito    = get_field( 'icono__casos__exito' );
  
                              ?&gt;
  
                                      &lt;?php
                                      $terms = get_the_terms( $loop-&gt;ID, 'historias-de-exitos' );
  
                                      if ( $terms &amp;&amp; ! is_wp_error( $terms ) ) : 
                                          $links = array();
  
                                          foreach ( $terms as $term ) 
                                          {
                                              $links[] = $term-&gt;name;
                                          }
                                          $links = str_replace(' ', '-', $links); 
                                          $tax = join( &quot; &quot;, $links ); 
  
                                          $link_category = get_term_link( strtolower($tax), 'historias-de-exitos' );
  
                                      else :  
                                          $tax = '';  
                                      endif;
  
                          ?&gt;
  
                          &lt;div class=&quot;col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12&quot;&gt;
  
                              &lt;div class=&quot;content__portafolio &lt;?php echo strtolower($tax); ?&gt; all&quot; data-cat=&quot;&lt;?php echo strtolower($tax); ?&gt;&quot;&gt;
                                  &lt;img src=&quot;&lt;?php echo $imagen__portada__exito; ?&gt;&quot; alt=&quot;&quot; class=&quot;img-fluid&quot;&gt;
                                  &lt;div class=&quot;content&quot;&gt;
                                      &lt;div class=&quot;row&quot;&gt;
                                          &lt;div class=&quot;col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12&quot;&gt;
                                              &lt;h2&gt;&lt;?php echo get_the_title(); ?&gt;&lt;/h2&gt;
                                              &lt;div class=&quot;sumilla&quot;&gt;
                                                  &lt;?php echo the_excerpt(); ?&gt;
                                              &lt;/div&gt;
                                              &lt;!-- --&gt;
  
                                          &lt;/div&gt;
  
                                      &lt;/div&gt;
                                      &lt;!-- --&gt;
  
                                      &lt;div class=&quot;row&quot;&gt;
                                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12&quot;&gt;
                                              &lt;a href=&quot;&lt;?php echo get_permalink($loop-&gt;ID); ?&gt;&quot; class=&quot;btn__vermas&quot;&gt;saber más&lt;/a&gt;
                                          &lt;/div&gt;
  
                                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12&quot;&gt;
                                              &lt;div class=&quot;logo__reiva&quot;&gt;
                                                  &lt;img src=&quot;&lt;?php echo $icono__casos__exito; ?&gt;&quot; alt=&quot;&quot; class=&quot;img-fluid&quot;&gt;
                                              &lt;/div&gt;
  
                                          &lt;/div&gt;
  
                                      &lt;/div&gt;
                                      &lt;!-- --&gt;
  
                                  &lt;/div&gt;
                                  &lt;!-- --&gt;
  
                              &lt;/div&gt;
                              &lt;!-- --&gt;
  
                          &lt;/div&gt;
                          &lt;!-- --&gt;
  
                          &lt;?php 
  
                                  endwhile; 
                              endif;
                          ?&gt;
  
                      &lt;/div&gt;
                      &lt;!-- --&gt;
  
                      &lt;div id=&quot;boton&quot;&gt;
                          &lt;a href=&quot;javascript:void(0);&quot; id=&quot;loadMore&quot; class=&quot;btn__sabermas&quot; page=&quot;1&quot;&gt;Cargar más&lt;/a&gt;
  
                      &lt;/div&gt;
                      &lt;!-- --&gt;
  
                      
                  &lt;/div&gt;
                  &lt;!-- --&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/section&gt;
  
  &lt;div id=&quot;scrollUp&quot;&gt;
    &lt;img src=&quot;&lt;?php echo get_template_directory_uri(); ?&gt;/assets/img/arrow-scroll.png&quot; alt=&quot;&quot;&gt;
  &lt;/div&gt;
  
  &lt;?php get_footer(); ?&gt;
  
  </code></pre>