WordPress has in-built core php coding to display latest posts on the homepage. Users with advanced PHP knowledge can easily create custom code for showing posts and related information as per requirement. However, for users trying to learn PHP syntax, even simple code can be tough nut to crack.

PHP code to display specific Post title by Post ID

For beginners wanting to know PHP coding for use in WordPress, following can be small starting step to learn. Checkout following code that display specific post title and related variations.

NOTE – In the following code 94 is the post ID whose post title the code displays. You need to replace 94 with the ID number of the post that you want to show. Just hover over post in WordPress dashboard to view its ID in the URL below. If you face problem, check article to find category IDs in WordPress, same procedure apply for finding post IDs.

1. Show clickable Post title


“>post_title; ?>


4. Show clickable Post title with specific class style


Davinder Singh Kainth

A digital creator with 15+ years of experience in Website Design, Development, SEO, and Content Creation to Podcasting at SmartWebCreators.com with the motto of "Be Smart, Keep Creating". A coach, consultant, and your dear geek friend ❖

Leave a Comment