Support » Plugins » Category Based Archives

  • I am using the Category Based Archives plugin to create seperate archives pages for my news section and blog section based on the month of the posts.

    the plugin rewrites the permalink structure to include in-category tag trialing the archive ie web-address/2009/11/in-blog

    I had to play around with modifying the wp_get_archives funstion by adding a to the $url.

    The problem is that the archive page shows fine however say I have more than the default number of posts for the month then I need it to page, but the paging breaks since the new permalink is */in-blog/page/2 which does not work.

    I am looking for some help on a possible work around for this. I am not the best when it comes to modifying wordpress.

    I have serached the codex and all the information out there but no luck.

    I am getting a little desperate now, this is the only thing holding my new site from going up.

    P.S.

    if at all possible I would like to customize the look of the different archive pages based on the category as well. Any help with that would also help

Viewing 1 replies (of 1 total)
  • Hello
    I was looking for a solution to this as well, and having not found anything, I got in there and coded it up.

    In the plugin code file “category-based-archives.php”, we’re going to edit the function ‘cba_add_rewrite_rules’.
    So, find these lines:

    $new_rules = array(
         '([0-9]{4})/in-(.+?)/?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) . '&datecategory=' . $wp_rewrite->preg_index(2),
         '([0-9]{4})/([0-9]{1,2})/in-(.+?)/?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) . '&monthnum=' . $wp_rewrite->preg_index(2) . '&datecategory=' . $wp_rewrite->preg_index(3)
         );

    and replace with this:

    $new_rules = array(
         '([0-9]{4})/([0-9]{1,2})/in-(.+?)/page/([0-9]{1,2})?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) .'index.php?monthnum=' . $wp_rewrite->preg_index(2) . '&datecategory=' . $wp_rewrite->preg_index(3). '&paged=' . $wp_rewrite->preg_index(4),
         '([0-9]{4})/in-(.+?)/page/([0-9]{1,2})?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) . '&datecategory=' . $wp_rewrite->preg_index(2). '&paged=' . $wp_rewrite->preg_index(3),
         '([0-9]{4})/in-(.+?)/?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) . '&datecategory=' . $wp_rewrite->preg_index(2),
         '([0-9]{4})/([0-9]{1,2})/in-(.+?)/?$' => 'index.php?year=' . $wp_rewrite->preg_index(1) . '&monthnum=' . $wp_rewrite->preg_index(2) . '&datecategory=' . $wp_rewrite->preg_index(3)
         );

    What it does is it notices the ‘page’ part of the link, and then uses the number after that to pass into the raw wp query.

    I hope this helps.

    -J

Viewing 1 replies (of 1 total)
  • The topic ‘Category Based Archives’ is closed to new replies.