Skip to main content
14 events
when toggle format what by license comment
Dec 18, 2013 at 14:31 comment added Monique If I view the posts they display the images.
Dec 18, 2013 at 14:23 comment added Maruti Mohanty can you check the posts if those have gallery images in them.
Dec 18, 2013 at 13:35 comment added Monique thanks for the update of the code. I have put in in my functions.php, but still it displays all the images. The var_dump still returns null.
Dec 18, 2013 at 12:30 comment added Maruti Mohanty @Monique Modified the answer for the get_random_gallery_images(), check if this works
Dec 18, 2013 at 12:29 history edited Maruti Mohanty CC BY-SA 3.0
Added more details
Dec 18, 2013 at 12:22 comment added Maruti Mohanty so it means get_random_gallery_images() has some issues, check and debug it
Dec 18, 2013 at 12:18 comment added Monique Editted my question, did not put the code in index.php but in single.php. Also, I have put the <?php var_dump($attachment_ids) ?> above my shortcode in single.php and the result is NULL
Dec 18, 2013 at 11:47 comment added Monique I am sorry. I cannot get it to work (I have very little knowledge of php) I don't know where to put the var_dump and how to read the results
Dec 18, 2013 at 11:32 comment added Maruti Mohanty you can user var_dump($attachment_ids) to see what it returns and why have you used the set of codes in index.php,
Dec 18, 2013 at 11:20 comment added Monique I have debug on in my wp-config.php and I see no errors if fewing the post. (don't know how to to debug the specific function get_random_gallery_images()
Dec 18, 2013 at 11:11 comment added Maruti Mohanty can you debug and see what does the function get_random_gallery_images() returns, it should return one attachment id
Dec 18, 2013 at 11:04 comment added Monique I changed the $args code to post_per_page like you have mentioned, but it still displays all of the images. (removed the 'numberposts' => 1 )
Dec 18, 2013 at 10:29 history edited Maruti Mohanty CC BY-SA 3.0
Updated the answer
Dec 18, 2013 at 10:23 history answered Maruti Mohanty CC BY-SA 3.0