• Resolved micwp123

    (@micwp123)


    Hi,

    I like your plugin very much, but I have one question.
    I use Isotop filter with categories as taxonomy. The filters are ordered ascending, but I want them descending like this: All – 2016 – 2015 – 2014.
    How can I do that?

    mic

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Brecht

    (@brechtvds)

    Hi Mic,

    To change the order you have to use some custom code at the moment. You’d have to add something like this to your theme’s functions.php file:

    function wpupg_change_terms_order( $filter_terms_order, $grid ) { 
    if( $grid->slug() == 'your-grid-slug' ) { 
    $filter_terms_order = array( '2016', '2015', '2014' ); 
    } 
    return $filter_terms_order; 
    } 
    add_filter( 'wpupg_grid_cache_filter_isotope_term_order', 'wpupg_change_terms_order', 10, 2 );

    Make sure to replace the grid and term slugs to whatever you’re using.

    Thread Starter micwp123

    (@micwp123)

    Hi,

    thank you for your answer.
    I’m not really sure about what my grid-slug is. I tried this:

               function wpupg_change_terms_order( $filter_terms_order, $grid ) { 
    if( $grid->slug() == 'grid1' ) { 
    $filter_terms_order = array( 'Alles', '2016', '2015', '2014' ); 
    } 
    return $filter_terms_order; 
    } 
    add_filter( 'wpupg_grid_cache_filter_isotope_term_order', 'wpupg_change_terms_order', 10, 2 );

    I named my grid “grid1”. Is this the slug? I also tried the filter-id.
    But nothing has changed.

    Can you please help me?

    mic

    Plugin Author Brecht

    (@brechtvds)

    Hi again,

    You should use what’s used in the shortcode. So if your shortcode is [wpupg-grid id=”grid1″] then “grid1” is correct.
    Can you give me a link to your grid so I can take a look?

    Brecht

    Thread Starter micwp123

    (@micwp123)

    Hi Brecht,

    here is the link: grid.

    The name of the grid is grid1, the shortcodes are
    Grid
    [wpupg-grid id=”776″]

    Filter
    [wpupg-filter id=”776″]

    mic

    Plugin Author Brecht

    (@brechtvds)

    Then you need to check for $grid->slug() == ‘776’

    Brecht

    Thread Starter micwp123

    (@micwp123)

    Great, that works!

    Thank you.

    mic

    Thread Starter micwp123

    (@micwp123)

    resolved

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘isotope filter’ is closed to new replies.