Hallo zusammen,
ich bin momentan am verzweifeln einbisschen, aber vielleicht könnt ihr mir ja helfen. ;-)
Ich versuche hier zwei verschiedene Loops durchzuführen, damit ich einen hervorgehobenen Bereich für Nachrichten habe und einen normalen, klassischen.
Wo genau ist mein Fehler? Bzw. warum funktioniert es nicht, wenn ich im ersten Loop die normalen Funktionen verwende?
Andere Frage, wie bekomme ich nur die URL zum Thumb eines Beitragsbildes raus, um es als Hintergrund zu benutzen.
PHP
<?php get_header(); ?>
<div class="wrapper slide">
<?php
// The Query
$the_query = new WP_Query( $args );
$the_query->query('category_name=hot&post_per_page=3');
// The Loop
while ( $the_query->have_posts() ) {
for($i = 1; $i < 4; $i++)
{
if($i == 1)
{ $the_query->the_post();
echo '<div style="float:left; width: 660px; height: 250px; background-image: url(http://bbgbands.f2o.at/wordpress/wp-content/gallery/rockhall-2013/k1600_img_5395.jpg);background-size: 100%;"><a href="#"><p class="bigpt"><span class="bigpt">'. get_the_title().'</span><br></p>
<p class="bigls"><span class="bigls">aaaaa</span></p>
</div>';
}
if($i == 2 OR $i == 3)
{ $the_query->the_post();
echo '<div style="float:left; width: 200px; height: 125px; background-repeat: no-repeat; background-image: url(http://bbgbands.f2o.at/wordpress/wp-content/gallery/rockhall-2013/k1600_img_5395.jpg);background-size: 100%;"><p class="smpt"><span class="smpt">' . get_the_title() . '</span></p></div>';
}
}
}
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
?>
<div class="clear"></div>
</div>
<div class="wrapper content">
<div class="contentlinks">
<?php
query_posts('posts_per_page=10');
function custom_excerpt_length( $length ) { return 20; }
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
if (have_posts()) : while (have_posts()) : the_post();
?>
<div class="newspost">
<a class="newspost" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(200,100), array("class" => "alignright newspost")); ?>
<h3 class="newspost"><span><?php the_title(); ?></span></h3></a>
<p class="newspost-author"><?php the_time('F jS, Y') ?> von <?php the_author_posts_link() ?> - <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
<p class="newspost"><?php the_excerpt(); ?></p>
<hr class="newspost">
</div>
<?php endwhile; endif; ?>
</div>
<div class="contentrechts">
<?php get_sidebar('rechts'); ?>
</div>
<?php get_footer(); ?>
Alles anzeigen
Viele Grüße und DANKE,
dm23