Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2850

    Attention: This modification requires WP3.1+. It won’t work with WP 3.0.x or WP2.x !!!!!

    Open up /framework/theme_widgets/sidebar_news.php and find following code:

    $additional_loop = new WP_Query("cat=".$cat."&posts_per_page=".$count);

    Change it to:

    if (!empty($cat))

    {
    $array_cat = explode(",", $cat);
    $myquery = array(
    'posts_per_page'=> $count,
    'tax_query' => array(
    array(
    'taxonomy' => 'portfolio_entries',
    'field' => 'id',
    'terms' => $array_cat ,
    'operator' => 'IN'
    )
    )
    );

    }else{

    $myquery = 'post_type=portfolio&taxonomy=portfolio_entries&posts_per_page='.$count;

    }

    $additional_loop = new WP_Query($myquery);

    If you want to use the sidebar news widget AND a portfolio items widget you must duplicate the widget file. First make a copy of sidebar_news.php located under /framework/theme_widgets and name the copy sidebar_portfolio.php

    Then replace all occurrences of

    kriesi_sidebar_news_widget

    with:

    kriesi_sidebar_portfolio_widget

    (ignore lower/uppercase).

    At least replace following code in functions.php:

    $autoload['widgets'] = array('sidebar_news');

    with:

    $autoload['widgets'] = array('sidebar_news', 'sidebar_portfolio');

    #39527

    Perfect! Thanks so much, this will be a great asset to our website. One note: I tried using category IDs to only pull certain portfolio entries, but it did not work. Once I left the Cat ID field blank (in the widget area), my portfolio entries started popping up! If there is any way to only pick certain categories, that would be awesome. If not, this is still an awesome tool.

    #39529

    Same problem here.

    Had some help to create a second version of sidebar_news.php to only show portfolio items in sidebar. This now shows all portfolio-items from all categories is I leave this field empty. As soon as I fill in id’s it shows nothing.

    Any fix for this?

    #39530

    I’ll look into it if we can get the portfolio categories to work. I think they’re based on tags…

    #39531

    Thanks for looking into it. I hope you can figure it out!

    #39532

    @Dude: Any luck yet?

    #39533

    Hey,

    no I don’t have enough time at the moment…

    #39534

    Can you give an idea when you think you can have it figured out?

    #39535

    When I’ve some time. At the moment I’m missing some help here (normally 2 (or more) persons are required to handle all requests). I take an exam in criminal law in around 4 weeks so my time is limited. As this topic is beyond the scope of this support forum I’ll look into it when I’ve some working hours left.

    #39536

    Update: I posted a modified query code. Now it’s possible to show certain portfolio categories only….

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

The topic ‘How to use the sidebar news widget to display portfolio items instead of posts?’ is closed to new replies.