I think I might need halp again. Suddenly my code stopped working and I don’t get any gallery displayed anymore.
I give your code a try now which works generally good. But it displays “all” galleries.
What I’m looking for is only the gallery of the “current” post (“current” while the loop is running).
What I’m trying to do is: I have a overview page (homepage) and if a post has a gallery I want to show it at the post (on the homepage) to generate a slideshow with javascript from it.So if it works I have a lot of posts with a lot of little slideshows right at the posts all on one page.
So my current code (from a theme that I’m customising) looks like this:
<?php
$cat_id = wt_get_option('wt_feat_postlist_cat');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'cat' => $cat_id,
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'paged' => $paged
);
?>
<?php $i = 0; ?>
<?php $query = new WP_Query( $args ); ?>
<?php if ( $query -> have_posts() ) : ?>
<?php while ( $query -> have_posts() ) : $query -> the_post(); ?>
<?php
$post_class ="";
if ( $i % 2 == 1 ){
$post_class =" col-last";
}
?>
<div class="col col-425<?php echo $post_class; ?>">
<?php get_template_part( 'content', 'excerpt' ); ?>
</div>
<?php $i++; ?>
<?php endwhile; ?>
<?php endif; ?>
At the get_template_part( 'content', 'excerpt' );
part comes a template in that generates the DOM for the output.
When I paste your script in there, it returns, as mentioned, all galleries from the entire website. And with my initial echo do_shortcode('[gallery columns="1" size="full" filter="raw"]');
retuned only the gallery of exact that post. But that stopped working, somehow ??
I hope somebody can give me a hand on this! Thanks in advance!!
CI