Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #619443

    Hi i followed the below directions and it worked. How would you add multiple CPT to this? ie right now i have two custom post types employee and store

    You can define a new widget based on the existing newsbox widget. Insert this code:

    add_action(‘after_setup_theme’,’avia_load_additional_widget’);
    function avia_load_additional_widget()
    {
    if (!class_exists(‘avia_customcptbox’))
    {
    class avia_customcptbox extends avia_newsbox
    {
    function avia_customcptbox()
    {
    $this->avia_term = ’employee’;
    $this->avia_post_type = ’employee’;
    $this->avia_new_query = “Latest CPT’; //set a custom query here
    $widget_ops = array(‘classname’ => ‘newsbox’, ‘description’ => ‘A Sidebar widget to display latest cpt entries in your sidebar’ );

    $this->WP_Widget( ‘customcptbox’, THEMENAME.’ Latest CPT’, $widget_ops );
    }
    }

    register_widget( ‘avia_customcptbox’ );
    }
    }
    into your child theme functions.php or into enfold/functions.php and replace “portfolio_entries” with your custom taxonomy, “portfolio” with your custom post type, “Latest CPT” with your widget title/name.

    #621250
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.