Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23491

    Hello,

    How we can modify the code below

    Code:

    private function sort_buttons($entries, $params)
    {
    //get all categories that are actually listed on the page
    $categories = get_categories(array(
    ‘taxonomy’ => $params['taxonomy'],
    ‘hide_empty’=> 0
    ));

    $current_page_cats = array();

    foreach ($entries as $entry)
    {
    if($current_item_cats = get_the_terms( $entry->ID, $params['taxonomy'] ))
    {

    if(!empty($current_item_cats))
    {
    foreach($current_item_cats as $current_item_cat)
    {
    $current_page_cats[$current_item_cat->term_id] = $current_item_cat->term_id;
    }
    }

    }
    }

    $output = “<div class=’sort_width_container’ ><div id=’js_sort_items’ >”;
    $hide = count($current_page_cats) <= 1 ? “hidden” : “”;

    $output .= “<div class=’sort_by_cat {$hide} ‘>”;
    $output .= ““.__(‘All’,'avia_framework’ ).”“;
    foreach($categories as $category)
    {
    if(in_array($category->term_id, $current_page_cats, true))
    {
    $output .= “<span class=’text-sep “.$category->category_nicename.”_sort_sep’>/</span>”;
    $output .= “category_nicename.”_sort’ class=’”.$category->category_nicename.”_sort_button’ >”.$category->cat_name.”“;
    }
    }

    $output .= “</div></div></div>”;

    return $output;
    }

    to display all available porfolios categories in the filter menu ?

    Thank you

    #120026

    Hi,

    Replace this line with 1

    'hide_empty'=> 0

    0 = False , 1 = True.

    Regards,

    Ismael

    #120027

    Hello,

    Not exactly what I need !

    Please take a look seriously here (i’m waitng more than 2 weeks for this error), the portfolio is not working !

    http://www(dot)gt-motors(dot)fr/vehicules-sur-mesure/

    1– I have a 33 bmw cars – when i filter on BMW it display only 1 (the lastest date)

    2– When you go on page 3, the navigation menu is not displayed

    3– Navigation menu must be displayed always WITH ALL CATEGORIES to be able to jump to other cars brand page

    (actually if we have a page with mixed cars from 2 brands, the menu display only theses 2 brands wich not logical)

    Thank you

    #120028

    Re 2) – the reason is that you didn’t set portfolio thumbnails. The navigation won’t work if the portfolio items don’t have featured images ( http://www.kriesi.at/support/topic/portfolio-filter-not-showing-up ).

    Re 3) To display all categories doesn’t make sense if you’re using pagination (like here: http://www(dot)gt-motors(dot)fr/vehicules-sur-mesure/ ) because the filter won’t show any items if the filter criteria isn’t fulfilled. So if eg page 1 just shows cars from BMW and Jaguar and the filter navigation contains links for Fiat, Ferrari, BMW and Jaguar and the user clicks on “Ferrari” he’ll just see an empty page. This is imo more irritating than just showing all valid filter criterias. This is not a bug but an intended behavior because the isotope script ( http://isotope.metafizzy.co/ ) just rearranges/sorts all existing entries on the current page and it won’t load any content from other pages – thus if the user clicks on the filter links on page 1 it just sorts/filter all items on page 1 without loading items from page 2,3, 4, 5, etc.

    #120029

    Hello,

    Email sent !

    Thank you for your assistance

    #120030

    Hi dweb,

    I’m not sure if you meant to reply to this topic or one of the others you have open on the same issue, but as Dude said above and I in one of your others: setting the featured image should fix your issue. Just make sure its done on each of your portfolio items.

    Regards,

    Devin

    #120031

    So if I understand this thread correctly, if a user is looking at page 1 of a 3-page portfolio, and clicks on category “X”, they will get a blank page if no portfolio items on page 1 are in category “X” — it will not refresh page 1 to show the several portfolio items from, say, page 2, that belong to category “X”?

    If it is designed that way, it seems counter-intuitive. It would be better to let the filter create new pagination with my chosen category, IMHO.

    #120032

    We added a function which checks if at least one item per category is displayed on the current page. So if a category is not “represented” on page 1 it will not be displayed in the filter list. However your conclusion is correct – it will not refresh the page or load additional entries from other pages.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Porfolios categories’ is closed to new replies.