I want to add Blog Page in front-page.php.I want to show only post title with link to actual post.I dont know where to put the_permalink in my code.My code like below:
<div class="profile">
<?php
$query = new WP_query( 'pagename=blog' );
if ( $query->have_posts() ) {
while ( $query->have_posts() ){
$query->the_post();
echo '<h2 class="text-center">' . get_the_title() . '</h2>';
}
}
wp_reset_postdata();
?>
</div><!--end blog-content -->
When I put ,the hyperlink goes to domain.com/get_permalink() not to actual url.
Example the actual url is domain.com/abc.
When I click to the post title,it goes to domain.com/get_permalink()
Anyone can help me to solve my problem?
May be you are using
get_permalink
in wrong way. Try following code.