How to output widget

Check this out, it may guide you in the direction you need: First: register_sidebar( array( ‘name’ => ‘Social Media button’, ‘id’ => ‘smb’, ‘before_widget’ => ‘<li>’, ‘after_widget’ => ‘</li>’, ) ); Second code: public function widget( $args, $instance ) { $output = $args[‘before_widget’]; $output .= ‘<a href=”‘ . $instance[‘url’] . ‘” class=”fa fa-‘ . $args[‘icon_title’] … Read more

How to save additional user data as part of the registration process?

In the function that you’re hooking into user_register, you need to create the user and save the values. First, I’d recommend using wp_insert_user() instead of wp_create_user(). You might do something like this: $userdata = array( ‘user_email’ => $email_address, ‘user_login’ => $user_name, // this is automatically salted ‘user_pass’ => ‘plain_text_password’, ); // this function returns the … Read more

How to put a variable in a instance in the widget

As far I understood you want to assign the order number like $order_number = order_generator($email) inside the widget class. Yes, you can do it that way unless the order_generator is in another class. If you order_generator function is in another class then first you need to instantiate the class then call the method like $instance_of_your_class->order_generator($email). … Read more

Custom shortcode is not working in text widget

Shortcodes need to return data, not echo it – use output buffering to capture the output of the include and return it: function related_category_sidebar() { ob_start(); include WP_PLUGIN_DIR . ‘/sabai-directory/assets/templates/template_related_category.php’; return ob_get_clean(); } Then you will also need to do as Charles suggested and enable shortcodes for text widgets: add_filter( ‘widget_text’, ‘do_shortcode’, 11 );