Hallo,
ich mache gerade eine Wesbseite, aber jetzt möchte ich einen Slider hinzufügen, der sich auf die letzten 3-5 post bezieht, das geht auch alles einwandfrei, jedoch werden die bilder nicht gewechselt, man kann auch mit den pfeilen vor und zurück, die Punkte sind auch nicht funktionstüchtig.
PHP
<?php get_header(); ?>
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<?php
$i = 0;
$posts = get_posts ('category=1');
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="Sonst Was">
<?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>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div><!-- /.carousel -->
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
Alles anzeigen