How to Insert Images in PHP Codes in WordPress?

Posted by Deepak PHP

This is a very simple post about how you can insert image in your PHP code. I am sharing this here because a visitor asked to me how can he insert an Image in Post Meta (below Post Title) or in any where in his PHP Code in WordPress. So here is the most common method to call an Image in anywhere you want in your PHP Code.

<img src="<?php bloginfo('template_url'); ?>/images/bullet.png" />

This is the best way to insert the images cause you don't need to input the full URL of your Image or its directory. The Default folder for storing the Images in WordPress is Images under WP-Content > Theme > Your Theme > Images. There for you can insert any image from your Images folder just replace the name of your image along with its extension (bullet.png).

By Using above code you can add any image before your Meta Author, Date or Category or Tags also. For better?positioning you can also apply some CSS Rule to your images.

One Response to “How to Insert Images in PHP Codes in WordPress?”

  1. Chuck Long says:

    Thanks for this. Very helpful.

Leave a Reply

    Deepak Singh

    BlogTechnics is founded by Deepak Singh (me). I am a Professional Blogger & SEO Expert from India. I writes about Blogging, WordPress, Blogspot, SEO, Social Media, Web Development, Make Money Online and Technology. Along with Blogging I offers various services such as WordPress Blog Setup, WordPress SEO, Blogspot Template Designing, WordPress Theme Designing, etc.read more