Before you ask please READ THIS

Multiple Genre Filters

edited April 2014 in Beach Please Posts: 5
Hi.
I want to create 2 filters. First one for a genre, and another one for a diferent genre, both in the same page.
Please check print screen to undertand better the description.

If a create different pages, for example (website.com/genre/name1 and website.com/genre/name2 , the filter will show correctly for that page. But I want to create a page with both filters (one for each genre).

How can I do this?
Thanks for ur support help!
example.jpg
454 x 340 - 18K

Comments

  • AirAir
    Posts: 10,970
    Hello

    Firstly I don't see why someone would want such solution?
    citricx said: If a create different pages, for example (website.com/genre/name1 and website.com/genre/name2 , the filter will show correctly for that page
    You really see any filter when you open genre page? You shouldn't.
    citricx said: I want to create 2 filters. First one for a genre, and another one for a diferent genre
    But what is it for? Does your genres have sub-genres? Cause as we designed you have only one level of genres, so dividing it is strange:-)

    Maybe it is only misunderstanding :-)

    With regards.
  • edited April 2014 Posts: 5
    Hi,
    actually I did some changes to the template files few months ago. (so is perfectly normal you have different interpretation about my question).
    But yes. I have 2 sub-genres acting as genre. For this reason I want to create 2 filters in the same page (to show different categories inside each genre). All the original "works" are actually places and I want to show a filter for "city" and a filter for "type".

    I have tried to change some code here, but couldnt get my goal.
    /* If there ARE some posts */
        elseif ($wp_query->have_posts()) :
    	$category = get_queried_object();
                //prepare filter
                $thiscat = get_terms( 'genre', array( 'hide_empty' => true, 'parent' => $category->term_id) );		
    
                if( count( $thiscat ) ):
                    echo '<ul id="genre-filter" >';
    
                    echo '<li class="label">'.__fe( 'FILTER' ).'</li>';
                    echo '<li class="selected" data-filter="__all"><a href="' . a13_current_url() . '">' . __fe( 'Todos' ) . '</a></li>';
                    foreach($thiscat as $term) {
                        echo '<li data-filter="'.$term->slug.'"><a href="'.esc_url(get_term_link($term)).'">' . $term->name . '</a></li>';
                    }
    $category = get_queried_object();
    
                    echo '</ul>';
                endif;
    That code shows me the filter only for one genre and i cant realize what I must do to show another filter with another genre.

    If necessary I can send website URL via private message.
    Thanks for your help :)
    Post edited by Air on
  • AirAir
    Posts: 10,970
    Hello

    Sorry but this too big modification for support forum so I can't help you fully.
    Anyway as you can see filter ul is defined with id so it is first problem, cause it is then targeted in JavaScript by this id.

    You will have to rebuild filter to use class instead, and find all places where its id is currently used, it is in CSS and JS. Then you can clone this element to show different genres in each filter.

    Looks like hell of work and testing.

    Good luck:-)

    With regards.
  • edited April 2014 Posts: 5
    Ok. Your help is going good till now ;)

    How can I get specific category or term inside new filter?

    I have this:
    if( count( $thiscat ) ):
                    echo '<ul class="genre-filter" >';
    
                    echo '<li class="label">'.__fe( 'CATEGORY NAME1' ).'</li>';
                    echo '<li class="selected" data-filter="__all"><a href="' . a13_current_url() . '">' . __fe( 'Todos' ) . '</a></li>';
                    foreach($thiscat as $term) {
                        echo '<li data-filter="'.$term->slug.'"><a href="'.esc_url(get_term_link($term)).'">' . $term->name .( I WANT TO CALL FISRT HERE) '</a></li>';
                    }
    $category = get_queried_object();
    
                    echo '</ul>';
                endif;
            //class with info about resizing items
    		
    		 if( count( $thiscat ) ):
                    echo '<ul id="genre-filter2" class="genre-filter" >';
    
                    echo '<li class="label">'.__fe( 'CATEGORY NAME2' ).'</li>';
                    echo '<li class="selected" data-filter="__all"><a href="' . a13_current_url() . '">' . __fe( 'Todos' ) . '</a></li>';
                    foreach($thiscat as $term) {
                        echo '<li data-filter="'.$term->slug.'"><a href="'.esc_url(get_term_link($term)).'">' . $term->city . (I WANT TO CALL SECOND HERE) '</a></li>';
                    }
    $category = get_queried_object();
    
                    echo '</ul>';
                endif;
    
    I want to call them by category or term name, or by ID
    Post edited by Air on
  • AirAir
    Posts: 10,970
    I think you should read about get_terms function http://codex.wordpress.org/Function_Reference/get_terms and change current code so it will get only genres you are interested in.

    With regards.
  • Posts: 5
    Hi there!
    Changes are going on here but I´m afraid my knowledge isnt enough to get this goal.

    Till this moment, i have 2 filters, and they are working good,
    but,
    when the user select the value of second filter, naturally, the value of first filter is forgotten. So, I have 2 filters but only one filter can work at the same time.

    I need a way to keep the value of first filter in memory and select the value of second filter based on the preview filter results. I know this is not so hard but,

    as I said, maybe my knowledge is not enough to make this working. I apreciate all the kind of help someone can give me. I have an important project in hands and I need to put this on working rather without change from beach please theme to another new theme. If necessary I will provide url to check the current status. I'm also receptive to accept paid help if you know someone that can help me on this.
  • AirAir
    Posts: 10,970
    Hello:-)

    Unfortunately this is beyond support help on this forum, as it is deeper theme customization, which we don't do(free or paid) as we don't have time and man power for that.

    However some freelancer might help you, but I don't have anyone to recommend.

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion