The get_post_meta()
function can help to get the meta field but will not retrieve different size.
Assuming _pf_photo1
embed the attachment id, you can do something like that:
// Note the "_id" suffix
$attachment_id = get_post_meta($post->ID, '_pf_photo1_id', true);
Last parameter for this function can not be ‘medium’,
Now,you can use $attachment_id
with different function depending on what you really want to get (url, img element…):
$attachment_element = wp_get_attachment_image( $attachment_id, 'medium' );
echo $attachment_element;
There is more ways to get details for attachment wp_get_attachment_url()
, wp_get_attachment_image_src
(that returns an array with url, width, height).
You will find more details to discover these functions here
Hope it helps !
Related Posts:
- Set attached to state
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Make the checkbox meta field checked by default
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- “After file loaded” action
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- get_post_meta shortcode returns empty field
- How to get post that has non zero or greater than zero meta value
- How can i force Display names to be the same as Usernames?
- Adding Custom Fields for Img in Posts
- Moving image attachment from post to another?
- Edit Imported advanced Custom Fields from wordpress Dashboard
- Delivering a file instead of wordpress page
- Comparisson between date() and a date from wp_postmeta
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- Updating post meta for custom post types
- copy attachments to another post type and change attachment url
- How to get all attachment image from post ?? WordPress
- How can i change an image’s author?
- add_meta_box Callback not being called
- Converting a simple plugin to be placed inside of functions.php
- How WordPress autosave can save plugin fields?
- How can I filter the contents of a metafield before it’s displayed in the admin?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- How to remove duplicate Custom Fields?
- Get the url of the full sized attachment image using post ID?
- Last modified field for user profile?
- FacetWP group listings by custom field [closed]
- how do i remove posts from a WP_Query so the pagination is right?
- Saving Custom Post types and fields to a custom table
- Custom Field Template seriously messed up in WP 3.1.1
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms? [closed]
- How to change File URL in file uploaded to s3 compatible storage with self written plugin [closed]
- How to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- auto populate list of questions if user select a category xyz
- How do I hide posts across all loops based on the value of a custom field?
- How can I change the meta_key for a particular piece of information?
- Execute js files doesn’t seem to work
- WordPress metaboxes – textfield suggestion automatically populated
- Char limit on custom blog-post form? [closed]
- Custom Post Type Fields
- Meta box losing its value when scheduled post is published
- How do I enforce users to fill a determined custom field using WyPiekacz?
- How to select a paragraph other than the 1st to be the post’s excerpt?
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Order posts by meta key ( Using ACF )
- How to add fields in the WordPress editor?
- WordPress function to add text warning on every pages [closed]
- JSON API Plugin not showing Attachments id reused
- Price comparison table based on Custom Post Type?
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Custom Fields for Page Edits
- How can I add user profile fields to my mailpress mailout
- Link Posts to External URL
- How to create repeater field manually, without plugin (ACF Pro)?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- WordPress Phone Field Check (use numbers, spaces and pluses)
- Can export gallery but can’t import it Wp all import
- Auto populate a user custom field from another user custom field
- Best approach to make all tags searchable by the wordpress search function
- Create a pdf from the entries in DB
- Preset custom fields
- What database state changes happen after a post is manually “updated” with no changes?
- Get all image in media Gallery with alt/title?
- How do I add a medium to the WordPress database with my own plugin?
- custom fields not displaying on wordpress site
- WordPress hide post from custom post-type on a single page
- How to securely controlling data without keeping it in postmeta?
- Why Custom fields description is not working WordPress Version 5.4.2?
- Problem Advanced Custom Fields PRO
- Get all user meta_keys and then group users by matching values
- Custom product page’s style for printing
- Get value from an input field and pass into update_meta_data as $meta_value
- Creating Nested custom fields
- Create Biographies
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- How to add wordpress plugins in along with my standalone theme
- How to Save settings of custom tab product page in admin side in a database?
- How to Insert images in WordPress using code
- Changing the body of mail sent to new user registration
- Add new post using a page inside the website
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Storing values in Post Meta vs new tables
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- How can i do custom author list?
- Is there a way to add a custom input field for every taxonomy term in WP post editor?
- Advanced Custom Fields Plugin – not displaying images
- Woocommerce custom fields
- Trying to use Advanced Custom Fields with custom image sizes
- Output plugin post like system count [closed]
- getting image alt text via ACF plugin in WordPress [closed]
- A plugin for software reviews site like this one?
- Render CMB2 select option to post page [closed]
- Update post meta Rest Api
- Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]
- how to add meta for order in woocommerce