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

    Hi i am creating a custom portfolio widget base on a custom posttype.
    but i am getting an error: Class ‘avia_newsbox’ not found

    mine code in fiunctions.php goes like this:
    must be forgetting something?

    `/**
    * AVIA PORTFOLIOMODELBOX
    *
    * Widget that creates a list of latest Custom Post type Model entries. Basically the same widget as the newsbox with some minor modifications, therefore it just extends the Newsbox
    *
    * @package AviaFramework
    * @todo replace the widget system with a dynamic one, based on config files for easier widget creation
    */

    if (!class_exists(‘avia_portfoliomodelbox’) && class_exists(‘avia_newsbox’) )
    {
    class avia_portfoliomodelbox extends avia_newsbox
    {
    function __construct()
    {
    $this->avia_term = ‘model_categories’;
    $this->avia_post_type = ‘model’;
    $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’, ‘avia_framework’) );

    WP_Widget::__construct( ‘avia_portfoliomodelbox’, THEMENAME.’ Latest Models ‘, $widget_ops );
    }
    }
    }

    /*
    * activate framework widgets
    */
    if(!function_exists(‘bve_register_avia_widgets’) &&class_exists(‘avia_portfoliomodelbox’))
    {
    function bve_register_avia_widgets()
    {
    register_widget( ‘avia_portfoliomodelbox’ );
    }

    bve_register_avia_widgets(); //call the function immediatly to activate
    }

    • This topic was modified 8 years, 1 month ago by eaonflux. Reason: typos
    #688083

    Hey eaonflux,

    Try including the preceding code too:

    class avia_newsbox extends WP_Widget {
    ...
    }
    

    Best regards,
    Josue

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