Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Batleth

    (@batleth)

    I thought a lot and now i have a solution with a foreach loop.
    The Code looks like this:

    <div class="carousel-inner" role="listbox">
         <?php
              $i=0;
    		  $posts = get_posts('numberposts=3');
    		  foreach ($posts as $post ) :setup_postdata( $post);
    	  ?>
            <div class="item <?php if($i==0) echo 'active';?>">
            <?php if (has_post_thumbnail()){
            	$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
    			?>
              <img src="<?=$thumbnail[0];?>" alt="First slide">
              <?php } ?>
              <div class="container">
                <div class="carousel-caption">
                  <h1><?php the_title();?></h1>
                  <p><?php the_excerpt();?></p>
                  <p><a class="btn btn-lg btn-primary" href="<?php the_permalink();?>" role="button">Weiterlesen...</a></p>
                </div>
              </div>
            </div>
    <?php
    $i++;
    endforeach;
    wp_reset_postdata();
    ?>
    		</div>

    The topic can be closed ??

Viewing 1 replies (of 1 total)