WP_Query function for custom post type

The $post variable inside your function does not point to anything. You are declaring global $wp_query (which you are not actually using), but not global $post.

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