I’ve taken some custom SiteOrigin Page Builder widgets out of a theme and placed them in a new custom plugin. We are moving to a different theme.
In the main plugin file, I have:
require plugin_dir_url( __FILE__ ) . 'hdr003.php'; require plugin_dir_url( __FILE__ ) . 'hme006.php'; require plugin_dir_url( __FILE__ ) . 'hme007.php'; function purity_register_widgets(){ register_widget('ICD_HDR003_Widget'); register_widget('ICD_HME006_Widget'); register_widget('ICD_HME007_Widget'); } add_action( 'widgets_init', 'purity_register_widgets');
In, for example, hdr003.php, I have:
class ICD_HDR003_Widget extends WP_Widget {
However, I receive:
Fatal error: Class ‘WP_Widget’ not found
Hence, I’m trying to include in hdr003.php:
require_once(get_home_path(). 'wp-includes/class-wp-widget.php');
but this produces an error:
Fatal error: Uncaught Error: Call to undefined function get_home_path()
The function is a valid function.
If I replace that line with:
require_once(ABSPATH . 'wp-includes/class-wp-widget.php');
I receive:
include_once(ABSPATH/wp-includes/class-wp-widget.php): failed to open stream: No such file or directory
The file /wp-includes/class-wp-widget.php exists.
I’ve replaced /wp-admin & /wp-includes with newly downloaded copies.
Help appreciated.
Hi Insight,
Unfortunately, this isn’t something we can directly assist you with a fair amount of custom work and may, potentially, violate licensing agreements (we would need more information to confirm if this is the case). This is beyond the scope of what we can help you with on our forums, but you could hire a developer to assist you with this. We recommend using Codeable. You’ll be able to hire someone at an hourly rate to do this work for you.