I'm playing with WordPress for sometime. In my website, there will be 3 possible categories for posts, like: 'offer', 'news' and 'about' (each category with individual content).

My attempt is to create header navigation, providing liks for each category, and within category some custom sidebars.

Currently, I'm working on news category, where sidebar should contain months and year, and content itself. I based my template pages on slug, therefore I have category-news.php and sidebar-news.php.

Everything looks great, navigation menu has link to /category/news-page, where my sidebar works:


<div class="col-md-3 page-section" style="width: 30%;">
    <div class="col-md-12">
        <h3><?php _e( "<!--:pl-->Aktualności<!--:--><!--:en-->News<!--:-->" );?></h3>

        <?php wp_get_archives( array(
        "type" => "monthly",
        "echo" => 1,
        "order" => "DESC"
    ) ); ?>


<?php get_header(); ?>
<div class="news-header row">
    <h1><?php _e( "<!--:pl-->Aktualności<!--:--><!--:en-->News<!--:-->" );?></h1>
<div class="news-content row">
    <?php get_sidebar("news"); ?>
    <div class="col-md-8 page-section pull-right">
        <div class="col-md-12">
            <?php while ( have_posts() ) : the_post() ?>
            <?php endwhile; ?>
<?php get_footer(); ?>

My problem is that links generated by code above wp_get_archives points to pages like /2013/12 etc., while I'd like then to have /category/news-prefix, so that they'd be under one template. How can I achieved that? How can I then highlight currently selected month?

  • "while I'd like then to have /category/news-prefix, so that they'd be under one template. How can I achieved that?" I didn't understand what you are asking it to do. Would you clarify? – Seamus Leahy Dec 7 '13 at 3:27
  • Basically, when I call wp_get_archives, the list points to urls like /2013/12 and I'm simply not sure how to combain category-news.php template page, with url it points to. How can I highlight current archive menu etc. – kamil Dec 7 '13 at 13:03
  • So you want your URLs to take you to a page with posts filtered by both the date and the category? Say something like /category/news/date/2013/12 or /2013/12?category=news. – Seamus Leahy Dec 7 '13 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.