register_widget(”); not working
-
hello there, i’m developed a plugin for corona virus statics. but i’m facing a problems into my code. i’m using this below functions:
function coronastatics_widgetreg() { register_widget('corona_bd_widget'); register_widget('corona_bd_widget_world'); } add_action('widgets_init', 'coronastatics_widgetreg');
and i’m calling this functions as __construct. below is the code:
<?php class corona_bd_widget extends WP_Widget{ public function __construct() { $widget_ops = array( 'classname' => 'corona_bd_widget', 'description' => 'Display Bangladesh Live CoronaVirus (Covid-19) Real-Time Data' ); parent::__construct('corona_bd_widget', 'CoronaStatics Bangladesh', $widget_ops); } // output the widget content on the front-end public function widget($args, $instance) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } $data = json_decode(coronastatics_bangladeshapi()); ?>
the codes are working good. but now i want to change the “corona_bd_widget” to “coronastatics_bangladeshwidget”, but while i’m changing this “corona_bd_widget” to “coronastatics_bangladeshwidget” it’s not showing anything into the widget area of my website. can you please explain what is the issue?
thanks.
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘register_widget(”); not working’ is closed to new replies.