• Resolved timholz

    (@timholz)


    Hi – Since the link «Mitmachen und/oder Spenden > mir die Probleme mitteilt» on your website leads to nowhere, i post my suggestion here. When switching paged category pages, i noticed that your language switch always goes back to page one, no matter if i am, for instance on page 5. I’ve tried to replicate your plugin in it’s basic functions. I also added a switch for paged category pages. Here is an example:

    // is_ES() is a function that checks get_locale()
    if (is_ES() == true){
            $page = 'seite';
            $myblog_id = 1;
        } else {
            $page = 'pagina';
            $myblog_id = 2;
        }
    
    if (is_archive()){
            $cat_base = get_option('category_base');
            switch_to_blog($myblog_id );
            //since get_category_link doesn’t work
            //properly, (it prints the category base of the
            //opposite blog) i’ve taken a different
            //approach with str_replace()
            //see: https://core.trac.wordpress.org/ticket/48786
            $cat_dest = get_option('category_base');   
            $url_cat = get_category_link(get_query_var( 'cat' ));
            //check if it’s paged
            if (get_query_var( 'paged' ) > 0){
                //adding $page and the number to the url
                $cat_switch = str_replace($cat_base, $cat_dest, $url_cat) .$page.'/'.get_query_var( 'paged' ).'/';
            } else {
                $cat_switch = str_replace($cat_base, $cat_dest, $url_cat);
            }
            restore_current_blog();
        }

    This lets me switch to and fro for paged category pages. If you have some time and energy left, how about adding something similar to your plugin? regards theo

    • This topic was modified 1 year, 1 month ago by timholz.
    • This topic was modified 1 year, 1 month ago by timholz.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘links for paged categories or tags’ is closed to new replies.