You’re not passing your attribute array to the shortcode_atts
method. You’re passing in an uninitialized variable.
Your function starts with
function get_my_gallery_content ( $atts ) {
But then you don’t reference $atts
again. The code is reading $attr
, which is empty.
Change the line
), $attr, 'gallery'));
to
), $atts, 'gallery'));
You also need to change the following to match your argument variable name:
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( !$attr['orderby'] )
unset( $attr['orderby'] );
}
This code reads $attr
but you’re passing in $atts
. Make sure they all match.
Because the array is empty, the logic falls back to only retrieving the current post’s children. That’s why you’re only seeing those in your galleries.
Related Posts:
- Detect if is image unattached
- Retrieving a custom link on an attachment
- how to test for attached image
- Gel all image from certain post type
- ID of images from gallery
- Hide “Gallery Settings” and “Insert into Post” button from Attachment window
- Getting attachment images is cloning some of them
- How to make a customized “Create Gallery” tab in the ‘Add Media’ window?
- Reorder “menu order” of attachments to another predefined order
- Add image attachment to post via coding?
- Ordering of gallery images without using shortcode in theme
- Display random gallery images and its parent post title leading to parent post permalink
- Where does the gallery shortcode gets its attachments from?
- hide attached images of a post
- WordPress Gallery Permalink Structure Displaying Incorrectly
- How do I get just the title from wp_get_attachment_image
- changing the default picture size link url
- Programmatically Altering Gallery Link and image size?
- How is it possible that a gallery doesn’t have attachment ids?
- ID of images from gallery
- How to save media-form on custom tab
- Gallery Thumbnail Layout Template
- How To Retrieve An Image Attachment’s Alt Text?
- Turn a URL into an Attachment / Post ID
- How to get attachment file name not attachment URL
- How to cleanly delete attachment but retain original file?
- Trying to hide buttons from Attachment window
- Uploading Multiple Attachments From Front-End With A Description
- Validate alt text for attachments?
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- Get all posts (of any post type) an attachment is used in
- Can I attach a document (eg: PDF) but have a JPEG as a thumbnail?
- How can I display custom fields value from attachment media?
- Add an image gallery to a custom post type?
- Unable to upload specific .zip file type via frontend in WordPress 4.0
- Add_Filter example for wp_get_attachment_link
- Can i hide the attachments from media which I uploaded from front end?
- attachment url rewrite
- How to get all attachment image from post ?? WordPress
- Automatically delete attachments and posts [closed]
- How to delete orphan attachments?
- Get the title and URL of the attachment parent post
- Confused with attachment mimetype order
- Disable edit media attachments?
- Post Auto Draft Issue
- rename attachments based on parent-post-title on upload
- Rename attachments during upload no matter what filetype
- Link all WordPress images size
- post_author for wp_insert_attachment
- Displaying Post Attachment(s) at Top of single.php
- Detach an image from a page using php
- Get the path of the first attached media (single.php)
- Adding width and height to wp_get_attachment_image_src
- custom admin thumbnail for videos, not getting post’s id?
- Image Gallery Numbers for 3.5
- How do I link an image to the post it is attached to?
- How to delete a custom file from upload directory when deleting its post
- Attachment page 404
- Query to only return the 2 newest post attachments (images)?
- Clean up images, delete unused image sizes attached to a post type
- What is the best way to store thumbnails for a non-image attachment?
- Change default selection for “Embed or Link”?
- What will happen if I delete all my attachment type posts from database?
- How can I make an attachment page for pdf uploads?
- filter get_children to return all mime types EXCEPT ‘x’
- Weird string offset errors when displaying post attachments
- the_time() returning wrong date/time (way in the future)
- Add audio attachment link to RSS
- Links to my uploads went crazy
- How to add a caption to an image attachment in a file list?
- Echo list attachment size in post
- How do I intercept and modify the functionality of wp_get_attachment_image()?
- Undoing define( ‘UPLOADS’, ”.’files’ ); to repoint to “wp-content/uploads” folder
- Upload image and assign it’s id to post
- Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?
- Can’t sort get_posts by post_mime_type
- How can I rewrite old attachment URLs?
- How to list “invisible” Auto Drafts?
- How to add media from front-end to an existing post and edit file title
- Add a word to the first // wp_get_attachment_url // as the subdomain name
- Media Library Mess After FTP … /uploads
- Media item permalink goes to source file instead of attachment.php
- Display audio file in audio.php
- Display setting ‘size’ not available in image settings modal
- Attachment Metadata inside of Loop
- Attachment file display link text
- Get video attachment ID and display length
- missing attachment are showing as 404
- Insert attachments from front end form
- How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?
- Add link to attachment for old posts
- Drupal 6 to WordPress migration – media attachments
- Move caption in on attachment page
- WordPress gallery image link gives 404 when not logged in
- get_image_tag filter not working
- Change attachment inside the_content using filters
- Bulk delete media by year
- Count images in post then add class if just one
- One audio attachment, with two possible interchangeable extensions
- Attachement Meta DATA