Require an external class in to functions
-
I need some help to solve a problem
I have created a widget with the following code
class Widget extends WP_Widget { function Widget() { $widget_ops = array('classname' => 'widget', 'description' => __( 'desc', 'Shah_khor' ) ); $this->WP_Widget('widget', __( 'widget', 'Shah_khor' ), $widget_ops); } function widget( $args, $instance ) { extract($args, EXTR_SKIP); //Some Code } function update( $new_instance, $old_instance ) { //Some Code } function form( $instance ) { //Some Code } } add_action( 'widgets_init', 'mywidgets' ); function mywidgets() { register_widget( 'Widget' ); }
It works perfect but I want to organize my functions file, so I decided to put this in a new file and then use require_once
require_once ( get_stylesheet_directory() . '/lib/widget.php' );
It works on the admin, but when I go to the frontend I get an empty page.
Do you have any idea how can I solve this?
Thanks advance
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Require an external class in to functions’ is closed to new replies.