Skip to main content
added 53 characters in body
Source Link

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything.

I guess I need a for loop to store all my contents in an array and then output in the second row.

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
        
 

Need to show the content below when a tab is clicked.`

`

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything.

I guess I need a for loop to store all my contents in an array and then output in the second row.

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
    
 

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything.

I guess I need a for loop to store all my contents in an array and then output in the second row.

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>       

Need to show the content below when a tab is clicked.`

`
deleted 34 characters in body; edited tags
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything.

I guess I need a for loop to store all my contents in an array and then output in the second row.

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
   

Hello Guys, I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything. I guess I need a for loop to store all my contents in an array and then output in the second row. Please help me out guys !!!

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
   

Hello Guys, I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything. I guess I need a for loop to store all my contents in an array and then output in the second row. Please help me out guys !!!

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything.

I guess I need a for loop to store all my contents in an array and then output in the second row.

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
   
Source Link

Store post content in a php variable and output them using for loop

<div class="page-tile row">
<?php $i = 0; ?>
<?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
<div class="tile col-lg-2 col-md-2 col-sm-2 col-xs-12">
    <a class="nav nav-tabs" role="tablist" href="#collapse-<?php the_ID(); ?>" data-toggle="tab" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>">
        <?php the_post_thumbnail("kontakt-thumb",array('class' => 'img-responsive')); ?> 
    </a>
</div>

<?php ob_start() ?>
    <div class="kontakt-content tab-content">
        <div class="tab-pane" role="tabpanel" id="collapse-<?php the_ID(); ?>">  <?php echo the_content(); ?> </div>
    </div>
<?php $output = ob_get_clean(); ?>

<?php $i++; ?>    
<?php endwhile; ?>
   

Hello Guys, I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs are not doing anything. I guess I need a for loop to store all my contents in an array and then output in the second row. Please help me out guys !!!