My custom widget won’t stay in the widget area after I refresh the widget page

ID Base should be passed to WP_Widget class constructor as shown in the following code, You have passes wrong id “example-widget” which does not match with “id_base”, also don’t add spaces in id base. Replace MY_Widget() function with following modified function and it will work. function MY_Widget() { $widget_ops = array( ‘classname’ => ‘example’, ‘description’ … Read more

Sidebar does not display on blog page, but fine with static pages

<!– Obsolete You have to create the file named single.php for your single post template. If you use custom post types, name the file like single-my_custom_post_type.php, where my_custom_post_type part is your registered custom post type. Otherwise index.php is used by default. –> Edited: You have to change the file name from page_blog.php to page-blog.php. Notice … Read more

Shortcut to widget/sidebar editing on the admin menu?

I think that using standard WP featurs there’s no shortcut. But you can workaround using a custom widget. As example create a very simple widget, something like: class MyPageWidget extends WP_Widget { function __construct() { parent::__construct( ‘MyPageWidget’, ‘My Page Widget’ ); } function widget( $args ) { $page = get_page_by_path(‘sidebar-page’); if ( ! empty($page) ) … Read more

how to call new widgets in sidebar in custom theme?

I will put a basic code to create new widget. In WordPress its call register_sidebar; In your code, you have not put ID. Id=>your-widget-id Put this code into your functions.php function my_widget(){ register_sidebar( array( ‘name’ => __( ‘Front Sidebar’, ‘yourtheme’ ), ‘id’ => ‘sidebar-1’, ‘description’ => __( ‘This is description’, ‘yourtheme’ ), ‘before_widget’ => ‘<aside>’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)