0

I am attempting to use a slightly modified form of a widget in the Hueman theme alongside its original version. The header is as follows

class AlxPostsFork extends WP_Widget {

/*  Constructor
/* ------------------------------------ */
function __construct() {
    parent::__construct(
  'alxpostsfork',
  __('Hueman Posts Fork', 'hueman'),
  array(
    'description' => __('Display posts from a category', 'huemanFork'),
    'classname' => 'widget_hu_posts_fork'
  )
);
}

In Widgets.php (/wordpress/wp-includes/widgets.php) I have inserted the following line

register_widget('AlxPostsFork');

And I am getting the following error:

Fatal error: Class 'widget_hu_posts_fork' not found in C:\wamp64\www\wordpress\wp-includes\class-wp-widget-factory.php on line 106

What am I doing wrong?

  • You should never modify WordPress itself, your code needs to go inside themes and plugins – Tom J Nowell May 19 '17 at 13:46
  • @TomJNowell that was the first thing I tried. How would I go about inserting said widget via a plugin? – Sam S. May 19 '17 at 15:37
  • A plugin is just a PHP file with a comment at the top that lives in the wp-content/plugins folder, but these are simpler questions that you should ask as a separate question on the site – Tom J Nowell May 19 '17 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.