I’m using the “flexise” slideshow script to automatically scroll a list of images. The list is hard-coded along with the script in a wordpress template page.
While this works fine, how could you make it so that the slideshow pulled any images added to a special (private) wordpress page instead of having to add each img src manually??
<ul id="flexiselDemo3">
<li><img src="http://mysite.com/wp-content/uploads/2014/02/logo.png" /></li>
<li><img src="http://mysite.com/wp-content/uploads/2014/02/logo2.png" /></li>
<li><img src="http://mysite.com/wp-content/uploads/2014/02/logo3.png" /></li>
</ul>
Many thanks
Trying your suggestion now, I’ve replaced the above with this:
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
// This is where you specify the ID of your private image page
'post_parent' => 6909,
));
if (count($attachments)) {
// We have attachments
?>
<ul id="flexiselDemo3">
<?php
// Now we loop through them
foreach ($attachments as $attachment) {
?>
<li>
<?php echo wp_get_attachment_image($attachment->ID, 'full'); ?>
</li>
<?php
}
?>
</ul>
<?php
}
But it’s throwing an error. Probably something simple, but I’m not experienced enough to debug?
Parse error: syntax error, unexpected '<' in /home4/speedyp/public_html /speedypancake.com/tmc/wp-content/themes/sirens/page_f.php
Most of this is part of the Codex: