Support

Account

Home Forums Front-end Issues filter category

Unread

filter category

  • Hello friends I have a question, I don’t know how to do the following

    I have a custom message type called “portafolio_casas” and I have a taxonomy called “categorias” where they have sub categories. For example:

    Taxonomy: categorias
    slug
    casas
    – condominios
    – viviendas
    – hoteles-resort

    Create a gallery with ACF field group where I throw the following code

    <?php if ( have_rows( ‘galerias’ ) ) : ?>
    <?php while ( have_rows( ‘galerias’ ) ) : the_row(); ?>
    <?php $foto_01 = get_sub_field( ‘foto_01’ ); ?>
    <?php if ( $foto_01 ) { ?>
    ” alt=”<?php echo $foto_01[‘alt’]; ?>” />
    <?php } ?>
    <?php endwhile; ?>
    <?php endif; ?>

    So what I want to do on my page is to be able to add a filter for the galleries.
    How can I do that?

    Here is my code ——>

    <!–GALERIA–>
    <!– Grid row –>
    <div class=”row”>

    <div class=”col-md-12 d-flex justify-content-start mb-5 filtro-galeria”>

    <button type=”button” class=”btn btn-outline-black waves-effect filter” data-rel=”all”>Todo</button>
    <button type=”button” class=”btn btn-outline-black waves-effect filter” data-rel=”1″>casas</button>
    <button type=”button” class=”btn btn-outline-black waves-effect filter” data-rel=”2″>condominios</button>
    <button type=”button” class=”btn btn-outline-black waves-effect filter” data-rel=”2″>viviendas</button>
    <button type=”button” class=”btn btn-outline-black waves-effect filter” data-rel=”2″>hoteles-resort</button>

    </div>

    </div>
    <!– Grid row –>

    <!– Grid row –>
    <div class=”gallery” id=”gallery”>

    <?php $loop = new wp_Query(array(
    ‘post_type’ => ‘portafolio_casas’,
    ‘orderby’ => ‘ID’,
    ‘order’ => ‘ASC’,
    )); ?>
    <?php while ($loop->have_posts()): $loop->the_post(); ?>

    <!– Grid column –>
    <div class=”mb-3 pics animation all”>

    <?php if ( have_rows( ‘galerias’ ) ) : ?>
    <?php while ( have_rows( ‘galerias’ ) ) : the_row(); ?>
    <?php $foto_01 = get_sub_field( ‘foto_01’ ); ?>
    <?php if ( $foto_01 ) { ?>

    ” alt=”<?php echo $foto_01[‘alt’]; ?>” />

    <?php } ?>
    <?php endwhile; ?>
    <?php endif; ?>

    </div>
    <!– Grid column –>

    <?php endwhile;?>
    </div>
    <!– Grid row –>
    <!–GALERIA–>

    Please help

Viewing 1 post (of 1 total)

The topic ‘filter category’ is closed to new replies.