Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1358057

    Hi,
    I would like to override the newsbox widget by placing a custom version in my enfold-child folder? is it possible and how?
    Thank you.

    • This topic was modified 2 years, 3 months ago by WPStyling2020.
    #1358140

    Hey WPStyling2020,

    Thank you for the inquiry.

    You can redeclare the whole avia_newsbox class directly in the child theme’s functions.php file or in a separate file inside the child theme directory to override the default class.

    Example:

    
    <?php
    namespace aviaFramework\widgets;
    
    use WP_Query;
    
    /**
     * CUSTOM AVIA NEWSBOX
     *
     * Widget that creates a list of latest news entries
     *
     * @package AviaFramework
     * @since ???
     * @since 4.9			Code was moved from class-framework-widgets.php
     */
    if( ! defined( 'AVIA_FW' ) ) {  exit( 'No direct script access allowed' );  }
    
    class avia_newsbox extends \aviaFramework\widgets\base\Avia_Widget
    {
        // the rest of the code
    }
    ?>
    

    Best regards,
    Ismael

    #1358463

    Hi Ismael, thank you for your reply.
    I’ve tried to include that code in my child-theme functions.php but I get a fatal error:

    Fatal error: Uncaught Error: Class “aviaFramework\widgets\base\Avia_Widget” not found in website.com\wp-content\themes\enfold-child\functions.php:21

    Line 21: class avia_newsbox extends \aviaFramework\widgets\base\Avia_Widget

    #1358857

    Hi,

    Sorry for the delay. Please try to add the following code in the functions.php file, then look for the Custom Latest News widget in the Appearance > Widgets panel.

    // https://pastebin.com/16fbz8Hq

    Best regards,
    Ismael

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