Cant’ Grab WordPress Built-in Posts Through Loop

Can you please let me know why this is happening?

A loop like yours assumes the data from the “main query”. You’ve created a custom page template so the main query on that page is going to be the single “TestPage” data. That is the way it is supposed to work. That is, if ( have_posts() ) : while ( have_posts() ) : the_post(); doesn’t always give you the post archive data.

To get the posts you’d need to create a new query and loop over that. Like this:

$newq = new WP_Query(array('post_type'=>'post'));
if ($newq->have_posts()) {
  while ($newq->have_posts()) {
    $newq->the_post();
    the_title();
  }
}

You should probably look over the Template Hierarchy carefully, because this may not be the way you want to go about things at all.

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