January 23, 2011 at 6:41 pm #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:
$array_cat = explode(",", $cat);
$myquery = array(
'tax_query' => array(
'taxonomy' => 'portfolio_entries',
'field' => 'id',
'terms' => $array_cat ,
'operator' => 'IN'
$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
At least replace following code in functions.php:
$autoload['widgets'] = array('sidebar_news');
$autoload['widgets'] = array('sidebar_news', 'sidebar_portfolio');January 25, 2011 at 2:09 pm #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.January 25, 2011 at 3:36 pm #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?January 26, 2011 at 8:58 am #39530
I’ll look into it if we can get the portfolio categories to work. I think they’re based on tags…January 27, 2011 at 7:42 am #39531February 3, 2011 at 8:09 am #39532February 3, 2011 at 8:53 am #39533February 3, 2011 at 11:23 am #39534February 4, 2011 at 7:38 am #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.March 1, 2011 at 3:20 pm #39536
The topic ‘How to use the sidebar news widget to display portfolio items instead of posts?’ is closed to new replies.