Antwort: Re: [wp-hackers] Adding rewrite rules to wp

Gerhard Brauckmann Gerhard.Brauckmann at mi-verlag.de
Mon Oct 1 14:20:52 GMT 2007


Austin, many thx for your feedback,

mmmhhhhh  doesnt work, maybe it's an 2.3 version issue? 

my query_var PART ist still not an item in the rules array, nor can I get 
it by using get_query_var ('part')

its only working $wp_rewrite->permalink_structure/?part=334


Gerhard Brauckmann




"Austin Matzko" <if.website at gmail.com> 
Gesendet von: wp-hackers-bounces at lists.automattic.com
01.10.2007 14:53
Bitte antworten an
wp-hackers at lists.automattic.com


An
wp-hackers at lists.automattic.com
Kopie

Thema
Re: [wp-hackers] Adding rewrite rules to wp






On 10/1/07, Gerhard Brauckmann <Gerhard.Brauckmann at mi-verlag.de> wrote:
> /* add PARTS List to specific POST  */
> /* example: http://mydomain/2007/09/31/xmas-tools-44/part/334  */
> /* this should pass to post /2007/09/31/xmas-tools-44 */
> /* whithin single.php axtract query_var (part) with token 334  - do
> somenting with the value */

I think the following is what you want, as it will set a query var of
"part" to "334" for something like
"http://mydomain/2007/09/31/xmas-tools-44/part/334":

function MI_Parts() {
       add_action('init', array(&$this, 'mi_initRewrite'));
       add_filter('post_rewrite_rules', array(&$this, 
'mi_createRewriteRules'));
} // end of initialization

function mi_initRewrite() {
        add_rewrite_tag('%part%', 'part/(.+)');
}

function mi_createRewriteRules($rewrite) {
        global $wp_rewrite;
        $keywords_structure = $wp_rewrite->permalink_structure . 
"%part%/";
        $keywords_rewrite =
$wp_rewrite->generate_rewrite_rules($keywords_structure,
EP_PERMALINK);
        return ( $rewrite + $keywords_rewrite );
}
} // of CLASS
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list