WordPress or WP is an open-source management system of content (CMS) and it is free as well. Its features generally include a template and a plugin which are collectively referred to as Themes in WordPress.
Do you want to get a WordPress featured image post’s URL? This can come in handy to you if you develop your own child theme or WordPress theme. You can also make little tweaks to any theme that does not show any featured image post by default.
Do not worry, as, in this article, we will discuss how to achieve or how to get the post thumbnail URL in WordPress.
But, first, let us discuss why we should get one.
Why get a URL of the post thumbnail in WordPress?
Adding a featured image or a thumbnail to your posts on WordPress makes them more attractive and appealing. Thus, adding a few elements of visual interest will make your WordPress blog appear more interesting and attractive.
If you wish to share or upload a post to your social media, you might require copying the URL/link to the image that is featured or any other picture in your post.
However, if you wish to develop your personal theme or modify a theme from existing work, you can get post thumbnail URL if you want to utilize it along with a customized markup of your own. In such cases, you will require to add a snippet of code to the files of your theme.
Now, you will learn how this can be done step by step through a guide on how to get the post thumbnail URL in WordPress.
How to get the post thumbnail URL in WordPress?
If you want to get a URL of a thumbnail of a post, then you will need to get a code added to the template of the theme you are trying to customize.
Or, if you need to display a post thumbnail simply, then you can paste the code on the template that you’re presently working on (customizing), in the middle of WordPress.
Now, if you wish the thumbnail post to get displayed by using your own customized markup or using the theme thumbnail in a different way, you need to achieve the URL of the thumbnail of the post.
Instead of this, into the template, you can paste this particular code.
This particular code will simply display the featured image’s URL. Then, you can custom change the code and utilize the thumbnail URL of the post in any which way you wish.
Also, you can custom change the image’s size. You will have to replace the �medium’ word with some other image size (default) like �thumbnail’, �large’, �full’, or medium-large’.
You can even use an additional image size that is your creation. Ensure to regenerate the thumbnails if you use a customized image size.
Conclusion
We hope we were able to guide you through all your queries through this article and now you will be able to get the thumbnail URL of a post in WordPress.
Leave a Reply