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?
- AddToAny shortcode in the loop
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- How can I restrict image upload dimensions for non-admin WordPress users?
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- creating html reusable blocks via shortcodes
- wp_generate_attachment_metadata is creating an empty array
- add_shortcode is not working in plugin where others are working
- Single API call exposed via shortcode with params
- Force media library editor to overwrite the original filename?
- SEO Friendly URL on dynamic product page produced via shortcode
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Contact Form 7 Get Image Function [closed]
- How generate 200% image size and save with suffix @2x
- Load external images via proxy
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Best place for short bio,image and button [closed]
- Bulk edit WP posts to update embeded images with new alt tags
- Insert content of a post into another
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- Add padding while generating thumbnail
- accessing wp.media api from a tinymce plugin
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- get_post_title is not working on homepage
- Some code in shortcode function being ignored
- Can we have an ‘Update metadata’ button in Image Gallery for all image instances?
- How to create a custom shortcode based on the layout?
- Retrieving Meta from Image Attachment
- Add ALT attribute to Pin It Button image to pass HTML5 validation
- Unable to add TAB character to post?
- Make change in media library affect images in published articles
- plugin shortcode output
- Adding (image) caching to my Tumblr widget
- How to upload multiple files/images when developing a wordpress plugin?
- Image Manager Plugin [closed]
- Implementing an image hosting website using WordPress? [closed]
- How to Create a shortcode to this php function
- Inject HTML meta tag inside wordpress tag using add_shortcode
- How do I apply style to each category of a list?
- Create shortcode to echo javascript
- How to get post ID with hooks publish_post, new_to_publish, etc
- Bulk Image Upload And Rerrange Functionality
- What is @Action in WordPress?
- Custom Shortcode Broken in WordPress 3.1
- Use $_GET inside a shortcode print empty Array
- How to apply lazy loading in background images [closed]
- Namespaced shortcode?
- Where are theme codes located for WordPress?
- Woocommerce showing images blurry in description page
- Slider/text combination plugin
- My plugin won’t return anything [closed]
- Plugin to hide image in excerpt
- Anyway to convert a plugin to become a shortcode?
- Form that generates an ID for the customer
- Render Modula Plugin Shortcode On Ajax Request
- Shortcode to update user meta
- Why shortcode always displayed after footer not in body
- How to have sample page for each new register users in a membership website
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- using do_shortcode
- Why am I unable to load scripts in head in plugin?
- Image change on hover
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- How to write “alt” tag in image for wordpress code?
- Adding Static Image to WooCommerce Content-Single-Product template
- plugin shortcode not working on ajax request call
- Displayed content disappears when adding attributes to shortcode
- Modify page title and subtitle with a plugin
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- Where to find the code used to render a page that has a shortcode and a template defined?
- Shortcode not working after move wordpress website files
- Set post tags using tag ID
- How do I get a post author’s image/avatar via RSS from another blog?
- Shortcode not getting replaced
- How to activate a plugin on the activation of a theme?
- Add Shortcode tag in Widget/Sidebar
- In Woocommerce theme need to add custom external link [closed]
- Getting taxonomy images to display on single-post with their terms
- Flipping Book PHP Code? Any experience?
- WPTouch – how to remove shortcodes or make shortcodes function
- Photo Gallery Plugin and Touch Devices
- convert more tag to shortcode
- Image crop, resize and compression plugin?
- Shortcode does not expand in Facebook like
- How to Resize the Custom Post Images?
- Plugin that will let me specify a number of image sizes?
- Plugin that provides the [edit] shortcode?
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Images under 1MB are not being compressed