Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #15986

    How can I exclude some special “portfolio categories” from the “sortable portfolio overview page”?

    I mean not the images (they should be shown), but only the small words of those special categories, with which we can sort the portfolio items at their overview page.

    Here: the words “verkauft”, “verfügbar” (= portfolio categories) should not appear at this overview, but the images, tagged with this categories should remain there!

    Explanation: I tag images with, for example, “Acryl” + “verkauft” and show at the portfolio single page a status “sold”.

    “Sold” is set as a portfolio category.

    But this category has the only aim, to show me the status at the portfolio single view,

    and the (portfolio category) word “sold” should not appear on the portfolio overview page, but images tagged with it, should remain.

    Thanks.

    #89712

    Try following – open up includes/loop-portfolio.php and replace:

    $args = array(

    'taxonomy' => 'portfolio_entries',
    'hide_empty'=> 0,
    'include' => $includeArray

    );

    with:

    $args = array(

    'taxonomy' => 'portfolio_entries',
    'hide_empty'=> 0,
    'include' => $includeArray,
    'exlude' => '18'
    );

    and instead of 18 insert the id of your “sold” category.

    #89713

    thanks, I’ve tried it, but it excluded nothing. I have verified, that I have the right portfolio category IDs, but nothing is excluded.

    Maybe the template builder is a reason, because this page, I’m talking here about, is created as a “normal” page with a dynamic template, including some elements, text etc., and a part with a portfolio overview – sortable.

    The function itself (the sorting) works fine, but it doesn’t exclude the ID 91 in my case.

    #89714

    Yeah, I hoped that it’s possible to include and exclude a category at the same time but obviously it’s not. Use following code instead:

    $filtered_cats = array_filter($includeArray,
    function ($cat){
    return ($cat != '91');
    }
    );
    $includeArray = $filtered_cats;

    $args = array(

    'taxonomy' => 'portfolio_entries',
    'hide_empty'=> 0,
    'include' => $includeArray
    );

    and use your own id instead of 91.

    #89715

    thanks for your patience and help, but I’m not quite sure, if I have added it right, because I get now an error:

    Warning: explode() expects parameter 2 to be string, array given in /home/www/web333/html/sites/wp-content/themes/corona/includes/loop-portfolio.php on line 56

    Warning: array_filter() expects parameter 1 to be array, null given in /home/www/web333/html/sites/wp-content/themes/corona/includes/loop-portfolio.php on line 61

    Warning: implode() [function.implode]: Invalid arguments passed in /home/www/web333/html/sites/wp-content/themes/corona/includes/loop-portfolio.php on line 62

    This is what I’ve added:

    http://pastie.org/4663936

    I’m not so familiar with PHP so maybe I have added something at the wrong place or too much/less?

    #89716

    I updated the code – it seems like it’s an array and not a string – this is quite strange though because according to the docs: http://codex.wordpress.org/Function_Reference/get_categories exclude does not accept an array…

    #89717

    thanks a lot, Dude, but still an error:

    Warning: array_filter() expects parameter 1 to be array, string given in /home/www/web333/html/sites/wp-content/themes/corona/includes/loop-portfolio.php on line 52

    the code, that I have now inserted (line 43-65):

    http://pastie.org/4668618

    #89718

    Hi colorit,

    I’m going to tag Nick and Devin to this to see if they may be able to help.

    Regards,

    Mya

    #89719

    Hi colorit2,

    Unfortunately I’m not sure we can do anything else. I would approach it the same way Peter has which for some reason doesn’t seem to be working.

    We can tag Kriesi to take a look and he might be able to help figure out a solution.

    Regards,

    Devin

    #89720

    Hi @all,

    I guess, this is not a matter of generally not working, I guess, that I for myself have made a mistake adding the code mentioned above. I’m not very familiar with PHP, but it seems that I have added DUDE’s code on the wrong place or have replaced not the right things. We should first solve this ;-) Thanks.

    #89721

    Try reloading the includes>loop-portfolio.php to where it was to begin with. If you didn’t save a backup, you can re-download the theme files from themeforest under your Downloads.

    Now, search for:

    $args = array(

    'taxonomy' => 'portfolio_entries',
    'hide_empty'=> 0,
    'include' => $includeArray

    );

    Replace that with:

    $filtered_cats = array_filter($includeArray,
    function ($cat){
    return ($cat != '91');
    }
    );
    $includeArray = $filtered_cats;

    $args = array(

    'taxonomy' => 'portfolio_entries',
    'hide_empty'=> 0,
    'include' => $includeArray
    );

    Where 91 is your category that you want to exclude.

    Regards,

    Devin

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

The topic ‘How to exclude portfolio categories from sortable portfolio overview page?’ is closed to new replies.