WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Category Archive
Any patch for WP3.1? (7 posts)

  1. proximity2008
    Member
    Posted 3 years ago #

    This is a great plugin, but it's not with permalinks turned on.

    Any chance that someone it working in WP3.1?

    http://wordpress.org/extend/plugins/wp-category-archive/

  2. Hugh Mandeville
    Member
    Plugin Author

    Posted 3 years ago #

    To get the plugin to work with permalinks in WP3.1, you need to update the redirect_canonical() function in wp-includes/canonical.php. On line 167 wrap the following code:

    $tax_url = parse_url($tax_url);
    if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
        parse_str($tax_url['query'], $query_vars);
        $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
    } else { // Taxonomy is accessable via a "pretty-URL"
        $redirect['path'] = $tax_url['path'];
    }

    in an if (is_tax()) block:

    if (is_tax()) {
        $tax_url = parse_url($tax_url);
        if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
            parse_str($tax_url['query'], $query_vars);
            $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
        } else { // Taxonomy is accessable via a "pretty-URL"
            $redirect['path'] = $tax_url['path'];
        }
    }
  3. Osu
    Member
    Posted 3 years ago #

    @Hugh - I'm not keen on changing the core files. Is there any way to modify the plugin code itself to make this work? Or an alternative plugins that does work without core hacks?

    Thanks,

    osu

  4. Hugh Mandeville
    Member
    Plugin Author

    Posted 3 years ago #

    The plugin just generates a URL with date and category in the query string

    /?m=201104&cat=2

    with permalinks on, it generates a URL with date and category in file path part of the URL

    /category-label/2011/04

    Since WP3, with permalinks set, the date and category URL doesn't work with out fixing the WP3 code. So I think WordPress needs to fix their redirect_canonical() function.

    If someone can come up with a URL that shows posts for a particular category and date with permalinks set in WP3.1, we can change the plugin to use that URL pattern.

  5. Hugh Mandeville
    Member
    Plugin Author

    Posted 3 years ago #

    Just checked, seems to be working correctly in WP 3.1.1.

  6. john
    Member
    Posted 3 years ago #

    I've tried it with 3.11- no go.
    Everything looks good, links are built like so:

    http://192.168.1.6/?m=201104&cat=4 for March 2011,

    unfortunately my permalink settings (Day and name http://192.168.1.6/2011/04/06/sample-post/)

    turn everything into:
    http://192.168.1.6/category/cat1/

    (cat1 is the correct category name, I assume it has ID 4)

  7. Hugh Mandeville
    Member
    Plugin Author

    Posted 3 years ago #

    If you are using permalinks, the permalink structure needs to include %category% for the plugin to work. For example:

    /%category%/%year%/%monthnum%/%post_id%/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic