Nach stundenlangen Googlen und einem hohen Selbstnervgefühl, ich komm nicht weiter - hänge sozusagen fest. Der Loop loopt nicht mehr. JEdenfalls nicht 2 mal.
Folgendes Problem:
Ich arbeite zur Zeit an meinem Portfolio und habe eine statische Seite erstellt, welche auch die Startseite ist. Im oberen Bereicht soll sich oben links ein Block befinden, welche 3 Blog Artikel aus einer Kategorie (1) ausgeben soll.
Im unteren Bereich habe ich alle anderen Kategorien ausgeben. Als graue Kästen, welche mit einem Customfield Image verbunden sind. Leider klappt immer nur eins von beiden. Habe ich im oberen Bereich einen Loop, wird dieser ausgeben. Habe ich den unten aktiv, werden die Kästen ausgegeben. Aber habe ich beide am Laufen, wird nur der obere ausgegeben. Ich habe beide Loops mit post_query initialisiert.
Im Folgenden der Code welcher wenigstens die unteren beiden Bereiche anzeigt:
<?php
/*
Template Name: Startseite
*/
?>
<?php remove_filter('the_content', 'wpautop'); ?>
<?php get_header(); ?>
<div id="main">
<div id="contentwrapper2">
<div class="topPost">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<div class="topContent">
<div id="topmain">
<div id="articles">
Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.
</div> <!-- blog -->
<div id="me"><p>Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.</p></div> <!--me -->
</div> <!-- end topmain -->
<?php
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div id="content" class="cats">
<?php
// this is where 10 headlines from the current category get printed
if ( is_page() ) : global $post; $categories = get_the_category(); ?>
<ul class="bullets">
<?php $posts = get_posts('numberposts=100&category=[3,4,5,6,7]');
foreach($posts as $post) :?>
<li><a href="<?php the_permalink(); ?>"><img class="hover" src="<?php echo get_post_meta($post->ID, "archive_image", true); ?>" alt="<?php echo get_post_meta($post->ID, "Theme Name", true); ?> archive_image" /><span class="boxtext"><?php the_title(); ?><br />
<?php $category = get_the_category(); echo $category[0]->cat_name;?></a></span></li>
<?php endforeach; ?>
</ul>
<?php endif ; ?>
</div>
<!-- end content -->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
<div class="cleared"></div>
</div> <!-- Closes topPost -->
</div> <!-- Closes contentwrapper2-->
<div class="cleared"></div>
</div><!-- Closes Main -->
<?php get_footer(); ?>
Alles anzeigen
Und nun der den ich mir selbst noch zusammengebastelt habe - und nicht funktioniert:
<?php
/*
Template Name: Startseite
*/
?>
<?php remove_filter('the_content', 'wpautop'); ?>
<?php get_header(); ?>
<div id="main">
<div id="contentwrapper2">
<div class="topPost">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<div class="topContent">
<div id="topmain">
<div id="articles">
<?php query_posts('showposts=3&cat=1');
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="topPost">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_ttftitle(); ?></a></h2>
<p class="topMeta">by <?php the_author_posts_link(); ?> on <?php the_time('M.d, Y') ?>, under <?php the_category(', '); ?></p>
<div class="topContent"><?php the_excerpt('(continue reading...)'); ?></div>
<span class="topComments"><?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?></span>
<span class="topTags"><?php the_tags('<em>:</em>', ', ', ''); ?></span>
<span class="topMore"><a href="<?php the_permalink() ?>">more...</a></span>
<div class="cleared"></div>
</div> <!-- Closes topPost --><br/>
<?php endwhile; ?>
<?php else : ?>
<div class="topPost">
<h2 class="topTitle"><a href="<?php the_permalink() ?>">Not Found</a></h2>
<div class="topContent"><p>Sorry, but you are looking for something that isn't here. You can search again by using <a href="#searchform">this form</a>...
</p></div>
</div> <!-- Closes topPost -->
<?php endif; ?>
</div> <!-- blog -->
<div id="me"><p>Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.Lorem Ipsum Blah Blah doppel plus gut und darum denke ich dass hier noch mehr text stehen muss. Hier und auch mal . Oh Ja.</p></div> <!--me -->
</div> <!-- end topmain -->
<?php query_posts('showposts=30&cat=[3,4,5,6,7]');
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div id="content" class="cats">
<?php
// this is where 10 headlines from the current category get printed
if ( is_page() ) : global $post; $categories = get_the_category(); ?>
<ul class="bullets">
<?php $posts = get_posts('numberposts=100&category=[3,4,5,6,7]');
foreach($posts as $post) :?>
<li><a href="<?php the_permalink(); ?>"><img class="hover" src="<?php echo get_post_meta($post->ID, "archive_image", true); ?>" alt="<?php echo get_post_meta($post->ID, "Theme Name", true); ?> archive_image" /><span class="boxtext"><?php the_title(); ?><br />
<?php $category = get_the_category(); echo $category[0]->cat_name;?></a></span></li>
<?php endforeach; ?>
</ul>
<?php endif ; ?>
</div>
<!-- end content -->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
<div class="cleared"></div>
</div> <!-- Closes topPost -->
</div> <!-- Closes contentwrapper2-->
<div class="cleared"></div>
</div><!-- Closes Main -->
<?php get_footer(); ?>
Alles anzeigen
Und natürlich: HIER DER LINK ZU MEINER STARTSEITE
(Bitte nichts über das Layout, bin noch lange nicht fertig :neutral: )
Eine Antwort wäre wirklich super! Bin kurz vorm Durchdrehen. :cry: