Php Wordpress Gallery
I'm not sure I understand your question correctly, but I'll give an answer a go. If I have misunderstood what you're trying to do please clarify it for me and I'll update my answer.
You can use itemtag="li"
inside the gallery shortcode to wrap each image in an li
. You'd need to remove your <li class="slide">
line of code, and maybe use jQuery to add the "slide" class back to the generated li
tags. So you could do something like this:
Also, does your code render the gallery when using the :
in the if/else statement?
<script>jQuery(document).ready(function() { jQuery("#slides li").addClass("slide");});</script><ul class="slides"> <?php if ( has_post_thumbnail() ) { ?> <?php echo do_shortcode('[gallery itemtag="li" option1="value1"]'); ?> <?php } else { ?> <img src="<?php get_bloginfo( 'stylesheet_directory' ); ?>/images/thumbnail-default.jpg" /> <?php } ?></ul>
Add this you your footer, you can add it inside the same document.ready as the jQuery to add the class slide. Just copy and paste this on a new line right after jQuery("slides li").addClass("slide");
. You can adjust the height, width, or any other options in this call if you need to. This will hopefully work.
jQuery("#slides").advancedSlider({width: 900, height: 460, responsive: 1, skin: 'light-round'});