Unable to Display Page Title Using wp_title() Function in WordPress

Can you please let me know how I can use the wp_title() function to grab each page titles in WordPress. I used the following code to get the title in different page based on titles but it dost’ work!

Here is the code I am using

<title>
       <?php 
             if (is_front_page()) {
                          bloginfo('name'); }
             elseif (is_page()) {
                          wp_title(); echo ' - '; bloginfo('name'); }
       ?>
</title>

Related posts

Leave a Reply

2 comments