Retrieve the current post title – WordPress

Hi,
Now I discuss how to retrieve or fetch the current post title in wordpress. We can display the title in wordpress pages or we can put it on the banner images with heading.

In wordpress, many inbuilt functions are provided for different operations. For fetch the current post title, the wordpress support get_the_title(), the_title(), get_the_title_rss() inbuilt functions provided.




get_the_title(): Used for get the current post title.

the_title(); Used for get current post title

get_the_title_rss():Used for get the current post title. This is mainly used , if we specify the html tag like sub,sup etc in wordpress post or page title.
The get_the_title() and the_title() fetch whatever we enter in title. But we use the get_the_title_rss() the html tag convert and returns the correct output.

Source Code

	';       endif;
	?>

DEMO

fetch_wordpress_post_title



In the above example the SUBSTAINABILITY is the current post title. This post title display in banner image

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

One thought on “Retrieve the current post title – WordPress

  1. Dipesh

    Great, thanks ever so much! And thanks also for the step-by.step information, it´s really helpful.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *