Hey,
bin grad am bauen eines Themes. Bei der erstellung der Newsseite wollte ich ein Div haben, das jedes "Newselement" umschließt. Dazu habe ich folgenden Code geschrieben:
HTML
<div id="content_full">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="news_wrapper">
<div class="thumbnail">
<?php if ( has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
</div>
<div class="text_wrapper">
<div class="news_title"><?php the_title(); ?></div>
<div class="news_author">von <?php the_author(); ?></div>
<div class="news_spacer"></div>
<div class="news_excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
Alles anzeigen
Innerhalb des "Content_full" Divs sollten nun mehrere "news_wrapper" entstehen. Nur leider verschachteln sie sich wie hier:
ersichtlich ineinander.
Hier noch der CSS Code:
Code
/* NEWS */
.news_wrapper
{
width:960px;
height:auto;
}
.news_wrapper > .thumbnail
{
width:160px;
height:160px;
padding:10px;
border:border:#999 1px solid;
float:left;
}
.news_wrapper > .text_wrapper
{
width:780px;
margin-left:20px;
height:auto;
}
.news_wrapper > .text_wrapper > .news_title
{
width:780px;
color:#005ead;
height:auto;
font-size:18px;
}
.news_wrapper > .text_wrapper > .news_author
{
width:780px;
color:#000;
font-size:8px;
height:auto;
margin-left:40px;
}
.news_wrapper > .text_wrapper > .news_excerpt
{
width:780px;
color:#000;
font-size:10px;
height:auto;
}
.news_wrapper > .text_wrapper > .news_spacer
{
width:780px;
background-image:url(../img/ind/news_spacer.png)
height:1px;
margin-bottom:15px;
margin-top:15px;
}
Alles anzeigen
Ich bin leider nicht wirklcih erfahren mit WP und mir ist nicht ganz ersichtlich, wieso die Schleife meinen Wrapper nicht mehrfach erzeugt sondern ineinanderkopiert. Aber vllt. liegt der Fehler auch ganz woanders und ich stehe einfach auf dem Schlauch.
Kann mir da jemand helfen?
Gruß
Sans