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 to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- get current date + 90 days and checking every day
- auto populate list of questions if user select a category xyz
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- How to create an input field, and base the output on spreadsheet data? [closed]
- 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?
- WordPress Post Visibility Options for Frontend
- Custom User meta field display
- Bulk update all posts from plugin settings screen
- Execute js files doesn’t seem to work
- WordPress metaboxes – textfield suggestion automatically populated
- Char limit on custom blog-post form? [closed]
- Unable to select image using custom image field type
- Custom fields for custom post type
- Redirect to another page using contact form 7? [closed]
- Every new post/draft has a custom field variable “yst_is_cornerstone” showing
- Custom Post Type Fields
- Meta box losing its value when scheduled post is published
- How to insert multiple postmeta values with one query?
- How do I enforce users to fill a determined custom field using WyPiekacz?
- Mass SQL WordPress Meta Key deletion
- Date format – Meta Box plugin
- get meta value from database by post id
- Adding class to last list item? Not WP generated
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Sticky option for custom post types without using custom fields or plugins
- How to remove bulk actions from custom post type
- Adding custom meta boxes to specified custom post type
- 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?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Order posts by meta key ( Using ACF )
- How to add fields in the WordPress editor?
- How can I concatenate variables to search results title? [closed]
- WordPress function to add text warning on every pages [closed]
- Search by Attachment ID
- JSON API Plugin not showing Attachments id reused
- How to add an extra, independent set of custom fields?
- 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)
- How can I store data from custom fields to custom tables?
- Remember the Meta Value With Radio Buttons
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Attachments broken after giving WordPress its own directory
- Custom Fields for Page Edits
- Plugin that lets visitors Like a post (not facebook) and stores likes in custom meta?
- Parent Child Custom Fields with Advanced Custom Fields
- grab or load text on demand
- How can I add user profile fields to my mailpress mailout
- Dictionary-style definition list plugin
- Advanced Custom Fields Plugin – Images not displaying
- Link Posts to External URL
- Adding custom Field To The Posts Listing
- How to create repeater field manually, without plugin (ACF Pro)?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- Why does “updated_post_meta” did not fire when uploading media other than image?
- WordPress Phone Field Check (use numbers, spaces and pluses)
- Can export gallery but can’t import it Wp all import
- Table of contents (TOC) plugin is not showing header tag
- Auto populate a user custom field from another user custom field
- Best approach to make all tags searchable by the wordpress search function
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Create a pdf from the entries in DB
- Help with autofilling field
- Help to Create a Simple Plugin to make a post
- how to find out which plugin disable custom field for post
- Preset custom fields
- What database state changes happen after a post is manually “updated” with no changes?
- submit two file input fields in the same form
- Register PODS Custom Field with WPGraphQL [closed]
- Get all image in media Gallery with alt/title?
- Add an action based on custom post meta field
- How do I add a medium to the WordPress database with my own plugin?
- how to auto random increment for post view
- custom fields not displaying on wordpress site
- WordPress hide post from custom post-type on a single page
- Create multiple posts when a custom post is created
- How to securely controlling data without keeping it in postmeta?
- Why Custom fields description is not working WordPress Version 5.4.2?
- Adding Custom Endpoint in WordPress Rest API
- General Term for this form Field
- How do I change the functionality of an image slider which is part of ACF?
- Make custom post types using ACF
- Problem Advanced Custom Fields PRO
- “Enable Media Replace” plugin does not update serialized object in WPMeta
- Custom Field used to allow a Free Story; no longer works
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?