If you want the image URL you should use wp_get_attachment_image_url()
, not wp_get_attachment_image()
:
$background_image_id = get_post_meta(get_the_ID(), 'your_background_image_id', true);
$background_image = wp_get_attachment_image_url( $background_image_id, 'full' );
$profile_image_id = get_post_meta(get_the_ID(), 'your_profile_picture_id', true);
$profile_image = wp_get_attachment_image_url( $profile_image_id, 'full' ); ?>
wp_get_attachment_image()
returns a full HTML <img>
tag, but background images are just a URL.
Related Posts:
- How Can I save multiple records in same meta key?
- Custom fields for custom post type
- Show posts from WP Custom Post Type selected from a field in a metabox
- Querying meta values within an array
- Check for custom field value in different post type than current one and do something
- what is the correct way to compare dates in a WP query_posts meta_query
- Advanced search form with filters for custom taxonomies and custom fields
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- WP_Query orderby custom field then post_date in one query
- wordpress plugin error handling
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Detect meta value changes when post is updated (post_updated)
- I can’t set meta_key in my custom post type query
- order by meta_value serialized array
- Can’t sort order of wp_query with 2 meta keys
- How to get source of custom meta image?
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- How loop through posts based on custom fields
- how to set default value for checkbox in wordpress
- Display custom post types with custom date field value (before today) & order by custom date field
- Displaying Metabox value (custom post type taxonomy)
- How to have the right design for a custom post type without accessing themes
- Customize permalink when creating a post
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Create a random unique 6 digit number as custom field for custom post type
- Custom Post Type Navigation on Custom Field
- how to interconnect custom post types?
- meta_query compare >= not working but
- Metadata for a taxonomy – is there any WordPress way of doing this?
- List all images from a single post meta value
- WP_Query: include custom post type only with specific meta value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Meta Key Value in current-user-only loop
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Get posts between custom dates
- How to implement a Google map store locator
- Update Post Meta for a logged in user
- Orderby CPT custom fields not working
- A better way to add a meta box to custom post types
- Two Custom Post Types Many to Many Relationship
- get_post_meta not working on publishing
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- Importing Data from a Non-WordPress database, into WP
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Check if post with same meta value exists
- Send a conditional email notification when a custom field value changes in Post Type
- ACF in wordpress
- delete_post_meta() for whole CPT / multiple posts?
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query of custom post type sorted by meta_key has unexpected results
- copy images from custom field to another custom field
- Custom Query: If One Post Object Field Value Is The Same As Another
- How to show custom field on specific custom post type posts only when filled
- Custom post type in Custom widget – $listItem
- Cannot obtain custom meta information
- How can I output WPAlchemy repeating fields meta values in my page template?
- Generating and downloading files with WP API
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- Add a class to post_class if more than one post shares same meta_value_num
- Fill custom fields when saving custom post types
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Writing a custom Glossary plugin
- Filter search posts by post meta?
- Custom fields for post or terms which don’t update on post update
- order the meta query results by 2 custom fields
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- How to keep custom post type related information
- Orderby if between two meta fields
- How to select meta key in custom database query
- Use WP_query to match post types based on custom field values
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- Custom post type that lets users create a set of posts?
- How do I extract the contents of a CPT’s custom field for all posts?
- Query events post type after current date and timezone
- Delete custom post type metadata without deleting the post in admin area
- How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
- meta query always fails even if data is correct
- Unable to get the upcoming events for custom post
- Advanced search form with filters for custom taxonomies and custom fields
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- How to consume external API from WordPress post editor and display the response data in the custom field?