get_the_post_thumbnail()
returns the entire img
tag, not just the image URL.
global $post;
return get_the_post_thumbnail( $post->ID );
You can also use function wp_get_attachment_url() or wp_get_attachment_thumb_url() to get image URL and insert it into the img
tag.
global $post;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
if ( false === $thumbnail_id )
return '';
$img_url = wp_get_attachment_url( $thumbnail_id );
return '<img src="' . $img_url . '" />';
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Autogenerate wordpress shortcodes using array?
- Shortcode display outside the div
- Shortcode under a Shortcode Multiple times Possible?
- Disabling post images for not logged in users
- Converting a simple plugin to be placed inside of functions.php
- Layout shop page: resize images and columns
- bulk change of image setting “link to” to “link to: image url “
- Trying to count the total number of paragraphs inside a blog article
- May i Use ShortCode in Template?
- Prevent shortcode from being wrapped in tags
- Inserting HTML tag with ACF into shortcode
- Adding Shortcode to Text Widget
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- creating html reusable blocks via shortcodes
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- What is @Action in WordPress?
- Image change on hover
- Return multiple values in a shortcode attribute
- Shortcode Attributes to Return different $_POST
- strange shortcode error: does shortcodes requires any dependency?
- Get Image Having the ID [closed]
- Add the_post_thumbnail_url to a shortcode in function.php
- Adding a Tag Parameter / Filter to My Shortcode
- Add_image_size not generating correct size
- grab or load text on demand
- How to get current cart values using WC_Shortcodes?
- insert og image link in wordpress post
- Get Shortcode output to database for static post_content
- How to wrap image tag into div for post only?
- Find all strings between an enclosing shortcode
- wordpress Shortocode running twice?
- Posting code inside the post instead of in the template file using shortcode
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to disable hover zoom on woocommerce. None of the common methods work
- How to get next day date of a specific day
- Send email with list of active plugins upon activation/deactivation
- Shortcode not working – quotes seems strange
- How to fix broken media library?
- Using custom fields for image alt and title
- Get all the URLs of the pages that uses a specific shortcode
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- How do I create a custom permalink structure for a page template
- Where Should i write the code for wordpress ajax voting?
- How to remove a class function from a plugin by using remove_action()?
- How to get images using taxonomy ( WP Media Folder)
- adding Adsense’s In-Article Ads between images of blog post
- Add “Featured Image” box in my plugin post page
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- How to use template inside plugin shortcode with variables for big HTML code
- Get param from shortcode in plugin function
- Large amount image data transfer
- Need to convert image url to a Base_64 data url with wordpress function..
- How to translate wordpress error message
- shortcode – multiple instances of same parameter name in one shortcode instance
- dynamic name of the style for wp_enqueue_style
- Api external with wordpress
- Function call in wordpress short code handler fails
- All custom widgets are not showing in widget area at the same time
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- WordPress function to add text warning on every pages [closed]
- Blurry images when loading the page first time
- Inserting shortcode in href – any ideas or workarounds?
- How do I convert my WordPress website to be domain agnostic?
- Change Header (Logo) Based on Login
- Image Galleries for website migrated from .com to .org
- How to access OOP plugin function inside themes or other plugin
- how to change wp-admin url using function file
- wp_localize_script not passing the data
- Search by Attachment ID
- Add action to custom Function
- Get post content from outside the loop with plugin shortcode usability
- Hook for altering the content of all wp mails
- How to rewrite URL and get the values?
- Show media-uploads to all users
- Overwrite add_image_size defined by theme
- same user role or copy the user role to be same as the other role
- Scrape a webpage for image and add it to post
- JSON API Plugin not showing Attachments id reused
- How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]
- Is there a good way to load tiny_mce_popup.js through editor.windowManager.open?
- Sharing functions between plugins
- How to prevent tabs from opening all at once
- Help with a function in a widget
- How do I link an image in my plugin so it displays on WordPress?
- Executing Javascript in Plugin
- Form Plugin for Api Requests which is used via Shortcode
- Changing plugin options from theme functions file?
- Echo out element to another page.
- Load CSS files in header of Bones theme?
- Expected ‘add_filter’ (T_STRING)
- Shortcode and variable
- Could not add ‘LoginLogout’ link using BAW login logout plugin
- My widget won’t update its values when save is clicked
- Execute a function when the entire page is displayed
- Is there any way to inject text onto pages?
- How can I achieve this, using shortcodes