Put the below code in your functions.php
and then you can use this [get_image_by_id id="your-image-id"]
shortcode to get the image
add_shortcode( 'get_image_by_id', 'the_dramatist_get_image_by_id');
function the_dramatist_get_image_by_id($atts) {
return wp_get_attachment_image($atts['id']);
}
Here "your-image-id"
is numeric ID of the image.
Hope that helps.
Related Posts:
- Layout shop page: resize images and columns
- Redirect to another page using contact form 7? [closed]
- Search by Attachment ID
- Elementor Pro display featured image on section -> style -> image using shortcode
- insert og image link in wordpress post
- Get Current Post ID in WP Loop For GiveWP
- Is there a function to search for a wildcard value when calling a shortcode?
- How to get home page ID?
- Is it possible to “freeze” a WordPress blog?
- How to Delete All regenerated thumbnails but keep the original ones?
- How to upload image with simple form?
- How to make WordPress use protocol indepentent upload files?
- Adding Custom Fields for Img in Posts
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- shortcode doesn’t work
- Use Media Uploader in Plugin
- WordPress shortcodes & performance
- resize only height using wp_get_image_editor
- Get uploaded image url
- How to add inline css/js inside a shortcode
- How to crop image from center using wp_image_editor
- How extend shortcode default values for a plugin?
- Shortcode in AJAX popup
- Can I use a Shortcode output as an HTML attribute value?
- WP theme with Backbone
- Converting Attachment to Images?
- Bulk Image Uploader to create new post from each image [closed]
- How to add a random image to a post from gallery and only show one?
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- Custom CSS for plugin form
- Show history of post revisions on front end
- Plugin shortcodes not working in custom theme
- tag breaks shortcode output (other solutions don’t work)
- Allow users of my plugin to define their own shortcode rather than use mine?
- Set featured image randomly from WordPress Database on post submission
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- creating html reusable blocks via shortcodes
- add_shortcode is not working in plugin where others are working
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- Some code in shortcode function being ignored
- plugin shortcode output
- How to upload multiple files/images when developing a wordpress plugin?
- How to Create a shortcode to this php function
- What is @Action in WordPress?
- Where are theme codes located for WordPress?
- Form that generates an ID for the customer
- How to have sample page for each new register users in a membership website
- using do_shortcode
- How to write “alt” tag in image for wordpress code?
- plugin shortcode not working on ajax request call
- Modify page title and subtitle with a plugin
- Add Shortcode tag in Widget/Sidebar
- Getting taxonomy images to display on single-post with their terms
- WPTouch – how to remove shortcodes or make shortcodes function
- Image crop, resize and compression plugin?
- Custom shortcode for displaying user based on a role parameter
- WordPress Plugin Insert Html Code with Shortcode
- IF condition based on wp_remote_get output
- Clear out old images, any advice?
- Get all the URLs of the pages that uses a specific shortcode
- Large amount image data transfer
- Add the_post_thumbnail_url to a shortcode in function.php
- Scrape a webpage for image and add it to post
- How do I link an image in my plugin so it displays on WordPress?
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- Adding a Tag Parameter / Filter to My Shortcode
- Add_image_size not generating correct size
- Is there a way to insert multiple images into a post at the same time without using a gallery?
- Filters on the_content with plugins, pages and shortcode
- Which is a better practice when writing shortcodes: pack lots of configuration parameters or just give an id?
- I’m having several WP issues, especially with missing images
- Get all image in media Gallery with alt/title?
- How do I use a plugin’s shortcode attribute value in another function?
- Do images in plugins automatically load?
- Make the product page as homepage WooCommerce
- Image path in childs theme
- Shortcode function not showing up on mobile browser
- WP_get_image_editor resizing images in a foreach loop
- Implementing Scrollable Images
- Shortcode generated widget to appear on same line as heading text and button
- How to make cover image in post block expand to entire screen?
- Page takes on two different formats
- Sanitize AROUND shortcode
- Sending post data over REST API, how to parse shortcodes in post_content?
- shortcode which is introduced into entry the blog, and appears in side bar
- Images not showing on homepage after migration [duplicate]
- Space in WordPress Attribute Causing Problems
- Shortcode registered from a plugin not recognized
- Strange get_the_* behavior with php 5.4
- Retrieve post thumbnails
- Make a wordpress site similar to Hot Or Not – Image rating system [closed]
- Displaying single Instagram images as a tile
- Embedding BitBucket Code in Posting
- Do shortcodes affect page indexing by search engines?
- how to add “alt” for all image in wordpress
- How to show in front End images using Visual Composer attach_images?
- Seo Problems in My meta Discription [closed]
- How can I get the permalink of a page on which shortcode has been used