Title: Get Post Title
Last modified: August 20, 2016

---

# Get Post Title

 *  [nbatioco](https://wordpress.org/support/users/nbatioco/)
 * (@nbatioco)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/get-post-title/)
 * Im trying to create a conditional tag in my sidebar
 *     ```
       <?php if (is_single()) {
       	echo ('Welcome Guest! Do you like <?php the_title(); ?> ?');
       } else {
       	echo ('');
       }
       ?>
       ```
   
 * I want to display the post title using the above code…
 * Hope you can help me

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Alessio Lo Vecchio](https://wordpress.org/support/users/youon/)
 * (@youon)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/get-post-title/#post-2493601)
 * To display the title, you have to insert in a loop 🙂
    And probably you have 
   to rewrite it something like this 😉
 *     ```
       <?php if (is_single()) {
       	echo 'Welcome Guest! Do you like ';
               echo the_title();
               echo ' ?';
   
       } else {
       	echo '';
       }
       ?>
       ```
   
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/get-post-title/#post-2493626)
 * dont mix php code into string output.
 * read [http://codex.wordpress.org/Function_Reference/the_title](http://codex.wordpress.org/Function_Reference/the_title)
 * for instance, try:
 *     ```
       <?php if (is_single()) {
       	echo ('Welcome Guest! Do you like '.the_title('','',false).'?');
       } else {
       	echo ('');
       }
       ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get Post Title’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/get-post-title/#post-2493626)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
