Change the filter on click wordpress

0

Next, I'm a beginner with wordpress and php, so I'm having problems with my first theme built from scratch, I have a div that will serve as a selector on the site, through it I want to filter the content that will appear in the loop. p>

<div class="select">
        <div class="select-cima" id="recentes">
            <span>Mais Recentes</span>
            <div class="barra-recentes">
                <div class="seta"><img src="" alt="seta-cima"></div>
            </div>
        </div>
        <div class="select-baixo populares sumir" id="populares">
            <span>Mais Populares</span>
        </div>
    </div>

When clicking on these IDs the filters must be different, the recent filter works naturally so I call the posts of my custom post_type (through WP_Query changing the post_type), but I am not able to filter the popular ones and I am also not getting make sure you have this change in the filters I've already put in the code. Here is the idea that I tried to make it work, but besides not filtering the page, did reload, ideally would not do the reload.

Attempt:

<a href="?meta_key=wpb_post_views_count&orderby=meta_value_num&order=DESC"><span>Mais Populares</span></a>

Thanks in advance for the help.

    
asked by anonymous 02.10.2018 / 15:14

1 answer

0

I did not do exactly what I wanted, but I created a new page with another filter and used a link for each selector ... It was the solution I found

    
09.10.2018 / 18:54