WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
"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 posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.