Post type attachment from specific user
I have without any luck been trying hardcoding to refer your slideshow plugin to show attachments submitted to a post. Below is what I have been experimenting with but nothing shows but "No slides are available". Your support is much appreciated.
$pid = $post->ID;
$uid = $user->ID;
$args = array(
'order' => 'ASC',
'post_type' => 'attachment',
'post_parent' => $pid,
'post_author' => $uid,
'meta_key' => 'image',
'meta_value' => '1',
'numberposts' => -1,
'post_status' => null,
);
$attachments = get_posts($args);
echo '<div class="slideshow">';
if (function_exists('slideshow')) { slideshow($output = true, $gallery_id = false, $post_id = $attachments, $params = array()); }
echo '</div>';
Tagged:
Comments
Thank you for your question.
Please take a look at the Slideshow plugin online documentation at the following link:
https://tribulant.com/docs/wordpress-slideshow-gallery/9532/shortcodes-hardcodes-for-displaying-a-slideshow/
There are some shortcodes and hard-coding examples that you might find useful.
Thank you for your reply. I am quite new to digging into the code of wordpress and have been trying to make sense of the examples in the online documentation.
Am I then correct to assume that it will be a problem referencing the slideshow to $attachments since it is an array? Or is it possible to somehow provide multiple posts (in my case posts of the attachment type) to the slideshow plugin?
Yes it is a problem to pass the $attachments array as the $post_id, it won't work. That parameter specifically takes a $post_id numeric/integer value.
So that is currently the only way you can do it.
Thanks for the info. A shot in the dark since I consider myself a beginner, but could a possible workaround be to assemble my attachments to a gallery which is then used for the slideshow? Something similar to below?