My issue is that I’m constantly getting parse errors when running this code, and no matter how much I’ve looked into it I’m lost!
The idea behind this code is to create an auto updating jQuery gallery that pulls the information from the posts to add the images, captions, links and titles. I’ve got the code pulling the latest 5 articles from the category :blog.
Here’s my code:
<?php
$posts = query_posts('category_name=blog&showposts=5');
while (have_posts()) : the_post();
if ($posts) {
foreach ($posts as $post):
setup_postdata($post); ?>
<li><img src= "<?php echo $full_img[0]; ?>" alt="<?php the_title (); ?>" title="<?php the_title (); ?>" data-description="<?php the_content (); ?>"/></li>
<?php endforeach;
}
?>
This is sthe syntax for the gallery:
<li>
<img src="../gv/path/to/image.jpg" alt="image" title="Pretty Picture" data-escription="Some more information about the photo" />
</li>
Some things to consider
data-description="<?php the_content (); ?>This part is prone to errors. Note thatthe_contentreturns HTML code and you will end up with something like thisdate-description="<p><b>Description</b></p>"$full_img