Change the filter on click wordpress

Asked

Viewed 11 times

0

next, I’m 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 selector on the site, through it I want to filter the content that will appear in the loop.

<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>

By clicking on these Ids the filters should be different, the filter for recent works naturally so I call the posts of my custom post_type (through Wp_query changing the post_type)but I’m not getting to filter the popular ones and I’m also not getting to make you have this change in the filters I’ve already put in the code. Below is the idea that I tried to make work, but besides not having filtered the page, Reload, the ideal would be not to re-load.

Trying:

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

Thanks for your help.

1 answer

0

I didn’t do exactly what I wanted, but I created a new page with another filter and used a link to each selector... It was the solution I found

Browser other questions tagged

You are not signed in. Login or sign up in order to post.