Support » Plugin: WordPress Category Archive » [Plugin: WordPress Category Archive] Any patch for WP3.1?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Hugh Mandeville

    (@hughmandeville)

    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'];
        }
    }

    @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

    Plugin Author Hugh Mandeville

    (@hughmandeville)

    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.

    Plugin Author Hugh Mandeville

    (@hughmandeville)

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

    john

    (@nich008gmailcom)

    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)

    Plugin Author Hugh Mandeville

    (@hughmandeville)

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

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WordPress Category Archive] Any patch for WP3.1?’ is closed to new replies.