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.
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
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
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