Archiv nach Monat und Kategorie

  • Hallo,

    ich habe ein sehr nerviges Problem. Ich möchte ein Archiv erstellen, welches Pressemitteilungen nach dem Monat sortiert und diese wiederrum nur aus der Kategorie »3« angezeigt werden.

    Mir werden mit meinem derzeitigen Code wohl nach Monaten sortiert, aber alle Beiträge angezeigt – auch aus anderen Kategorien.

    Mein Quellcode sieht folgendermaßen aus:

    <?php get_header(); ?>

    <div id="content_box">

    <?php include (TEMPLATEPATH . '/archiv_l_sidebar.php'); ?>

    <div id="content" class="pages">

    <div class="entry">

    <?php if (have_posts()) : ?>

    <?php //$post = $posts[0]; // Hack. Set $post so that the_date() works. ?>

    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2>Einträge gespeichert als '<?php echo single_cat_title(); ?>'</h2>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2>Pressemitteilungen vom <?php the_time('F Y'); ?></h2>

    <?php } ?>

    <?php while (have_posts()) : the_post(); ?>
    <?php // $top_query = new WP_Query('cat=3'); ?>

    <ul class="restentry" onclick="location.href='('<?php the_permalink() ?>#more-<?php the_ID(); ?>')" onkeypress="location.href='('<?php the_permalink() ?>#more-<?php the_ID(); ?>')" onMouseOver="this.style.cssText='border-color: #96001b'" onMouseOut="this.style.cssText='border-color: #808080'">
    <span class="thumb"><?php the_post_thumbnail(array(168, 168)) ?></span>
    <h4><?php the_time('j. F Y'); ?></h4>
    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>



    <?php the_excerpt() ?>
    <p><a href="<?php the_permalink() ?>#more-<?php the_ID(); ?>" title="Lese den Rest vom Eintrag">mehr &raquo;</a></p>
    </ul>

    <div class="clear"></div>

    <?php endwhile; ?>

    <?php include (TEMPLATEPATH . '/navigation.php'); ?>

    <?php else : ?>

    <h2 class="page_header">Ups, wir konnten das nicht finden...versuchst du es nochmal?</h2>
    <div class="entry">
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    </div>

    <?php endif; ?>

    </div>


    </div>
    </div>

    <?php get_footer(); ?>


    Weiß jemand einen rat? oder hat jemand die lösung parat?
    beschäftige mich damit schon sehr lang und bin im Internet nicht fündig geworden…

    Ich danke meinem Retter schon mal!!!

    grüße
    simonsays85

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!