Title: Duplicate widget and make small changes
Last modified: August 19, 2016

---

# Duplicate widget and make small changes

 *  [jpdeboer](https://wordpress.org/support/users/jpdeboer/)
 * (@jpdeboer)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/duplicate-widget-and-make-small-changes/)
 * In this theme I have a sidebarwidget, that shows news from newscategories I can
   fill in. Now I want the same, but then for portfolio-categories.
 * I found this permanent solution:
 * > Open up sidebar_news.php and find this line:
   >  `$additional_loop = new WP_Query("
   > cat=".$cat."&posts_per_page=".$count);`
   > Change it to:
   > `$additional_loop = new WP_Query("post_type=portfolio&cat=".$cat."&posts_per_page
   > =".$count);`
 * Still I can not get this to work. Unfortunately also this is a permanent solution
   and I am looking to make both possible.
 * Also this was said:
 * > If you want to use the Sidebar News widget for the blog entries and for the
   > portfolio entries you need to duplicate the widget or change it’s code (more
   > complex). I would create an extra portfolio news widget based on “Sidebar News”
   > widget. Currently it’s not possible to show both post types.
 * Now I tried duplicating the widget and change things so I see it in the widget
   area, but no luck.
 * Anybody any idea how to get a copy of this news-widget?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Mr Brainz](https://wordpress.org/support/users/mr-brainz/)
 * (@mr-brainz)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/duplicate-widget-and-make-small-changes/#post-1873551)
 * Are portfolio-categories and newscategories actual categories or custom post 
   types?
 * In your code, setting a post_type is for setting a custom post type. If it’s 
   a category then you could use ‘category_name’ to pull the posts by the category
   slug.
 * Also not sure where you’re pulling your $cat and $count vats from.
 * Are you outputting this new query with $additional_loop->the_post() anywhere?
 * It’s worth having a read over this [http://codex.wordpress.org/Function_Reference/WP_Query](http://codex.wordpress.org/Function_Reference/WP_Query)
 *  Thread Starter [jpdeboer](https://wordpress.org/support/users/jpdeboer/)
 * (@jpdeboer)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/duplicate-widget-and-make-small-changes/#post-1873669)
 * [@mr](https://wordpress.org/support/users/mr/) Brainz:
 * > Are portfolio-categories and newscategories actual categories or custom post
   > types?
 * How can I tell?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Duplicate widget and make small changes’ is closed to new replies.

## Tags

 * [change](https://wordpress.org/support/topic-tag/change/)
 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [jpdeboer](https://wordpress.org/support/users/jpdeboer/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/duplicate-widget-and-make-small-changes/#post-1873669)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
