Home / Web Development / Retrieve the current post title – WordPress

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

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.

Loading Facebook Comments ...
Social Media Auto Publish Powered By : XYZScripts.com