I managed to ‘solve’ the problem with the code below. It’s not a pretty solution but it does the job. Any adjustments to the code to make it more pretty are welcome.
<?php
/*
Template Name: Page information
*/
get_header(); ?>
<div class="row">
<div class="main-wrap" role="main">
<?php do_action( 'foundationpress_before_content' ); ?>
<div class="row">
<div class="column"><a class="back-to-shop-link" href="https://wordpress.stackexchange.com/shop" title="Terug naar de shop">< Terug</a> </div>
</div>
<header class="featured-hero" role="banner">
<figure>
<img src="<?php echo the_post_thumbnail_url('full'); ?>" alt="<?php echo the_title(); ?>">
</figure>
</header>
<div class="info-tabs">
<?php
$tabsnr = 1;
$linknr = 1;
$panelnr = 1;
$tabscontentnr = 1;
$break_after = 3;
$counter = 1;
$args = array(
'post_type' => 'information',
'posts_per_page' => 9,
//'orderby' => 'date',
);
$argsContent = array(
'post_type' => 'information',
//'posts_per_page' => 3,
//'orderby' => 'date',
);
$tabs = new WP_Query( $args );
$tabsContent = new WP_Query( $argsContent );
?>
<?php // tabs for tabs ?>
<?php if ( $tabs->have_posts() ) {
while ( $tabs->have_posts() ) : $tabs->the_post();
if ($counter % $break_after == 1) {
echo '<ul class="tabs" data-tabs id="tabs-' . $tabsnr++ . '">';
$items = array();
}?>
<?php
$item = array();
ob_start();
the_title();
$item[] = ob_get_contents();
ob_end_clean();
ob_start();
echo get_the_post_thumbnail_url();
$item[] = ob_get_contents();
ob_end_clean();
ob_start();
the_excerpt();
$item[] = ob_get_contents();
ob_end_clean();
ob_start();
the_permalink();
$item[] = ob_get_contents();
ob_end_clean();
$items[] = $item;
?>
<li class="tabs-title small-6 large-4">
<a class="tabs-link" href="#panel-<?php echo $linknr++; ?>"><?php the_title(); ?></a>
</li>
<?php
if ($counter % $break_after == 0) {
echo '</ul>';
echo '<div class="tabs-content" data-tabs-content="tabs-'. $tabscontentnr++ .'">';
foreach($items as $item) {
echo '<div class="tabs-panel" id="panel-'. $panelnr++ .'">';
echo '</div>';
}
echo '</div>';
wp_reset_postdata();
}
$counter++;
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>
</div>
<?php do_action( 'foundationpress_after_content' ); ?>
</div>
</div>
<?php get_footer();