[wp-trac] [WordPress Trac] #21219: get_post_type_archive_link in multisite context: struct issue

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 3 12:11:03 UTC 2012


#21219: get_post_type_archive_link in multisite context: struct issue
--------------------------+------------------------------
 Reporter:  michelwppi    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Post Types    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by michelwppi):

 Thanks for your question.. in this code lines, you will find how to do


 {{{
 add_filter ('post_type_archive_link', 'switch_query_book', 10, 2);
 add_filter ('post_type_link', 'switch_query_book', 10, 2);

 function switch_query_book ( $link, $post_type) {
         global $blog_id;
         $link .= '#bid='.$blog_id; // here for test - comment if ok
         switch ( $blog_id ) {
                 case 1 :
                 $search = "livre";
                 $replace = "book";
                 break;

                 case 2 :
                 $search = "book";
                 $replace = "livre";
                 break;

         }

         $link = str_replace ($search, $replace, $link);

         return $link;
 }
 }}}

 Enjoy awaiting a better WP architecture with more separation !

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21219#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list