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
- wp.media.view.ImageDetails – Save settings as HTML5 data-* attributes for image
- How to customise the output of the WP image gallery shortcode from a plugin?
- How to call shortcode function directly and pass $atts
- How to select featured images for 1500 posts?
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Plugin form unable to process
- What’s the point of using WordPress’s built in admin-ajax.php?
- Frontend editing, Frontend user dashboard
- Using plugin functionality in external php script not working
- Override plugin with functions.php
- Get the url of the full sized attachment image using post ID?
- The Point of Using apply_filters()
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- Missing argument 3 for wp_register_sidebar_widget()
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Storing Options in a Shortcode
- Shortcode button dosent work for all posts. Work for first post only
- Is there a way I can find wordpress posts that don’t contain a word?
- Plugin Handle URL With Custom Theme
- All sites themes functions.php have been changed
- Grab WordPress Salt Data From URL
- My plugin won’t return anything [closed]
- Help with WP Business Directory Manager Plugin?
- Plugin that provides the [edit] shortcode?
- get specific value of a array | PHP
- How to change shortcode’s default theme?
- Loading a plugin’s js file from functions.php
- Is there a way to convert shortcodes to html content?
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- How to access OOP plugin function inside themes or other plugin
- Different registration form for different roles
- How to get custom minimum price in Woocommerce
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How to hide featured images of all posts falling under the same category in wordpress?
- how to validate input field in wordpress generated with wpform plugin
- Error using wordpress functions inside a plugin class
- Share my WordPress plugin for updating how?
- The function called on the wp head hook becomes null
- How to detect 404 url and make this link underline or change background color?
- working code, not working – Plugin Dev
- How to Unhook actions/filters in within Class in plugin
- How to disable/enable a plugin at a specific time
- Configuring default woo commerce login with modal popup
- Dynamically Modify s2member Options
- register_activation_hook doesn’t fire at all
- How to add HTML to a template only when user is logged out/ not registered
- My ajax request don´t work and return 0
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to delete posts older than one year with post meta, post attachments and files?
- How to pass value to a plugins shortcode?
- Hide some shortcodes on posts from back-end
- Trouble implementing python on WordPress
- Create csv file in plugin
- How to display single arbitrary facebook post with a shortcode?
- How do add_action and WP_Query
- How can I manage the background image of a slider based on the featured image of a page?
- getting image alt text via ACF plugin in WordPress [closed]
- What is wrong with this dbDelta syntax?
- Call a function with href
- Allow users to download media files directly from Amazon S3 (AWS plugin)
- How to display multiple images in the before and after plugin?
- Activate and deactivate two plugins automatically at certain hours