Dear,
The mentioned code can’t cause a mess.
Unfortunately, I can’t check your site now – Error establishing a database connection. You need to check database settings in wp-config.php file or contact your hosting provider support. Once this error will be solved, describe in more details with screenshots what exactly result you want to achieve in the sidebar.
You can use Lightshot screenshot tool https://app.prntscr.com/en/index.html to share screenshots.
Regards