Forum Replies Created
-
AuthorPosts
-
January 20, 2015 at 12:18 am in reply to: Latest News Widget Query from ALL custom post types #382195
I got it to work, I forgot to set avia_term to my custom category.
Is there away to create multiple instances of this widget?
January 13, 2015 at 5:57 pm in reply to: Latest News Widget Query from ALL custom post types #378956I’ve added the below code to my child functions.php but I can’t get my custom posts to display in the Latest CPT widget:
add_action(‘after_setup_theme’,’avia_load_additional_widget’);
function avia_load_additional_widget() {
// portfolio
if (!class_exists(‘avia_customcptbox_portfolio’)) {
class avia_customcptbox_portfolio extends avia_newsbox {
function avia_customcptbox_portfolio() {
$this->avia_term = ‘portfolio_entries’;
$this->avia_post_type = ‘portfolio’;
$this->avia_new_query = ”; //set a custom query here
$widget_ops = array(‘classname’ => ‘newsbox’, ‘description’ => ‘A Sidebar widget to display latest portfolio entries in your sidebar’ );$this->WP_Widget( ‘customcptbox_portfolio’, THEMENAME.’ Latest CPT Portfolio’, $widget_ops );
}
}
register_widget( ‘avia_customcptbox_portfolio’ );
}// post
if (!class_exists(‘avia_customcptbox_post’)) {
class avia_customcptbox_post extends avia_newsbox {
function avia_customcptbox_post() {
$this->avia_term = ‘category’;
$this->avia_post_type = ‘pressrelease’;
$this->avia_new_query = ”; //set a custom query here
$widget_ops = array(‘classname’ => ‘newsbox’, ‘description’ => ‘A Sidebar widget to display latest post entries in your sidebar’ );$this->WP_Widget( ‘customcptbox_post’, THEMENAME.’ Latest CPT Post’, $widget_ops );
}
}
register_widget( ‘avia_customcptbox_post’ );
}
}- This reply was modified 9 years, 10 months ago by tpengelly.
-
AuthorPosts