Please help! I have a problem with getting wordpress databas

In WordPress’s template hierarchy, index.php is the catch-all file for any WordPress post/page/archive/etc. that might get loaded. By the time the active theme’s index.php file is loaded, WordPress is already set up. By redirecting from the theme’s index.php to another file, you’re re-starting the page load from scratch. If you don’t explicitly include certain WordPress … Read more

Unexpected add action function in WP plugin

It’s not entirely clear in the tutorial, but the add_action() call should be outside the class. class My_gCal_Widget extends WP_Widget { public function __construct() { parent:: __construct( ‘my_gcal_widget’, ‘My_gCal_Widget’, array( ‘classname’ => ‘my-gcal-widget’, ‘description’ => ‘Shows events from a calendar’ ) ); } public function widget($args, $instance) { } } add_action(‘widgets_init’, function() { register_widget(‘My_gCal_Widget’); });