I would recommend just modifying the single-listings.php
template file to output the gallery directly:
<?php echo do_shortcode( ' ); ?>
That way, for all the images that have been imported and attached to a given CPT, they weill be output just as if you had placed a shortcode in the post_content for each post.
Edit
If you have post metadata that contains image URL paths, and you want to upload/attach those images to the post, then have a look at media_sideload_image()
(or, in 3.5, wp_sideload_image()
).
Related Posts:
- Remove Dimension from wp_get_attachment_image
- explode array within shortcode
- How can I append custom data to images in the editor?
- With WordPress Importer, why can’t I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
- How can I remove fields in the attachment editor?
- Saving Custom Field in Attachment Window in WordPress 3.5
- Add multiple images to a page sidebar
- How to set a default meta value for custom field
- Add custom field to image editor
- How to save custom fields for attachments
- Display info from custom fields in all images’ HTML
- copy attachments to another post type and change attachment url
- ajax delete value from custom field array
- Save attachment custom fields on front end
- Save page data to an xml file
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- Insert attachment ID in custom field from media uploader
- Importing from XML is ignoring serialized custom field
- How can I store a file in the database in the same way WordPress and ACF do?
- Getting the ID of any image for use in functions.php
- Validate data on attachment_fields_to_save
- How do i save and retrieve custom attachment meta?
- Custom field not updating when value is empty
- how to upload a image from frontend with wp_insert_post and also update_post_meta?
- Link FROM attachment to full post and get custom fields values on attachment page?
- Show custom field on attachment page?
- Save attachment ID instead of URL in custom field
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- Custom field in media library not saving, selected() function not adding “selected” to select list input type
- How to delete attachments associated with custom field type when post property changes? [closed]
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Adding thumbnails for non-image attachments
- How can I attach files without using a plugin?
- Filter post listing by meta value which is a date
- Extra profile field as select box?
- Matching Serialized Arrays with meta_query
- Pre-filling custom fields on New Post
- Make Custom Field Into A Link On The Front End?
- Why isn’t my code to save custom fields in quick edit working?
- How to oEmbed from custom field, responsive to container size and responsive
- Custom Meta Boxes: Store two values in one repeatable field
- Up/Down voting system for WordPress
- Custom Meta Field not Working with qTranslate [closed]
- Problem in custom meta boxes
- Loop through two different sets of custom fields
- Add an advert every nth Paragraph
- Metabox with multiple fields added by user and upload box
- Get all meta keys assigned to a post type
- sort search results by custom fields using dropdown
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- I want to send an email when each post is published
- Creating a widget with a number of custom fields
- How to loop through certain custom field values
- How to Create Dynamic Fields in a Meta Box?
- Set front page option using custom fields?
- Add post meta fields, when creating a post using WordPress’ REST API
- Custom Field Values not updating unless I click “Update” twice
- update_post_meta for repeated custom field [closed]
- Can I create a template or doctype for my blog site?
- Custom field, add class to anchor tag
- How to combine custom fields to make one order-able value
- Updating Other User’s Metadata
- get_posts in meta box dropdown not showing latest posts
- Trying to reorder posts by custom field
- Delete custom fields when deleting posts
- Custom Query based on custom field of a single post
- Add post meta programmatically to attachment
- comment meta_query for keys that aren’t yet set
- Link the retrieved custom field values to its respective posts
- Sortable custom field values from all posts on a page template
- How can I combine this php statement to get the results of multiple variable inputs?
- Looping inside block return
- Sortable Custom Columns not sorting correct
- Is there a size limit to the value you can save in a custom field?
- Sort posts by clicks on download button
- Running wp_postmeta update query does not show the custom fields data in admin section
- How to load script conditionally on custom field in wp_postmeta?
- Showing Custom Fields on Parent Page
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- Show Custom Field of Current Page in For Loop
- Custom Field & Gravity Forms [closed]
- Redirect DRAFT Posts to a Custom URL (Custom Field) : Currently 404 Page
- multiple meta_query and orderby question
- How to make menu country specific?
- SQL query to change the value of a Custom Field
- want to add video upload option for front end user
- Adding fields to attachment – only shows when inserting new attachments
- Saving and using Custom Field in user settings/profile “Checkbox list”
- How do I use foreach to get content from a custom-field in multiple posts?
- Related post thumbnail not showing up
- Copy url from post_content to custom field
- How do i get a specific user metadata using custom metavalue outside of wordpress?
- How to retrive Custom Fields as Values for a Form field
- Use custom field value as href
- Custom fields doesnt work well with any postTAB plugin
- Colecting values from custom field checkboxes and displaying them in the post
- Build Array from Input Fields question
- Grouped Custom Meta Fields without plugin
- Google not index my Custom 404 page ?why?
- Match submitted array fields with the MYSQL database fields to update them correctly in PHP