shortcode to show custom post types by category

Here is a part in your code that may cause error:

$catlist .= '<h2>'.the_title().'</h2>';

Try replacing with

$catlist .= '<h2>'.get_the_title().'</h2>';

Explanation: the_title() echo the title of the post. But in your case you are using it within a function that will return the value. So you have to use get_the_title() instead. Thanks.

Note: also there is a closed php tag right before that line which is never open again. That surely causing the error.

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