I have been currently building a custom widget in WordPress based on the text widget as a starting point. It seems that within the function __construct
part of the widget, the class name is a hard coded string.
I would like to make this hard coded string more dynamic by calling a separate file which has a bunch of if else statements that get chosen depending on the select option chosen by the user. This would clearly change the class on the widget front end to allow for different styling.
parent::__construct('one_in_four_widget', __('LCPS Custom Widget'), $widget_ops, $control_ops);
I tried replacing the hard coded string with an include file
parent::__construct(include( get_template_directory_uri() . '/views/one-in-four-admin.php' ), __('LCPS Custom Widget'), $widget_ops, $control_ops);
However this seems to break the admin area with numerous warnings eg
Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /Users/jonbeech/Sites/lancscps 2nd site/lancscps.dev/wp-content/themes/lancscpstheme/functions/one-in-four-widget.php on line 33
Any thoughts would be appreciated? Is it a case of my syntax being incorrect?