Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I can confirm, that the stated solution works – just upgraded PHP to 5.6 and everthing is OK again.

    @a3rev, just to avoid confusion, I would suggest you to change the Installation Minimum Requirements also (it’s still stated “PHP 5.5.0” there).

    Regards, Stipe

    Thread Starter stipe

    (@stipe)

    OK, I see, I’ll try to figure it out myself somehow… but still, can you please tell me:

    1.) if I created the right concept in my functions.php? Is this the correct way to use it?

    2.) shall I call the function additionally in my page (in my header maybe?) or is it enough just to have it in functions.php?

    Thx in advance.

    Thread Starter stipe

    (@stipe)

    Hm, I’m not sure if I understood correctly. As far as I can see the “msls_options_get_permalink” works fine, if you have multiple pages and the permalinks are different (depending on language).
    But I have only two pages, one in native language (www.example.com) and one in English (www.example.com/en), which are already linked together with msls.
    But those two pages have bookmarks inside. So, when I choose f.e. the “Contact” in the main menu, the page just slides down to the bookmark and the hyperlink in the navigation bar is then “www.example.com/#contact”. If I then click on English flag, it just takes me to “www.example.com/en” and not to “www.example.com/en/#contact”.
    So for this case I can’t see, what should I put after str_replace, as I’m not replacing anything in my permalink… Or should I replace only the bookmark including the language part of URL?

    Furthermore, if this would work, could I put the all of my bookmarks replacement (f.e. #top, #contact, #about, #references) in the same function?
    I added this to my functions.php:

    
     function my_msls_options_get_permalink( $url, $language ) {
        if ( 'us' == $language ) {
            $url = str_replace( '/#top', '/en/#top', $url );
            $url = str_replace( '/#about', '/en/#about', $url );
            $url = str_replace( '/#competence', '/en/#competence', $url );
            $url = str_replace( '/#contact', '/en/#contact', $url );
    		}
    
        if ( 'sl_SI' == $language ) {
            $url = str_replace( '/en/#top', '/#top', $url );
            $url = str_replace( '/en/#about', '/#about', $url );
            $url = str_replace( '/en/#competence', '/#competence', $url );
            $url = str_replace( '/en/#contact', '/#contact', $url );
    	  }
    
        return $url;
    }
    add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
    

    but it doesn’t work.

    Any additional hint would be really appreciated.

    • This reply was modified 9 years, 6 months ago by stipe.
    • This reply was modified 9 years, 6 months ago by stipe.
Viewing 3 replies - 1 through 3 (of 3 total)