Okay
  Public Ticket #2309295
wpml and portfolio filters
Closed

Comments

  •  27
    kaPuh started the conversation

    Hello there.

    Is it possible to link the portfolio filters like https://dawnparisi.com/#vektor and the english version https://dawnparisi.com/en/#vector ?

    Means: is it possible that the user when on the English Homepage clicking the portfolio filter #vector and then clicking the language switcher to change to the German version that he lands on https://dawnparisi.com/#vektor not on https://dawnparisi.com/ ?!? See screenshot!

  •   kaPuh replied privately
  • [deleted] replied

    Hi,

    I have tried to login to login to your WP admin panel however the credentials didn't worked, however you may try to set Absolute Category Link (pushState):

    medium
    (view large image)

    This should work for you.

  •  27
    kaPuh replied

    First of all: I am in the backend with these WordPress Credentials I gave to you. Strange that it do not work for you?

    And then: I changed it to absolut  but it does not work!

    Perhaps you can try a second login?

    Thank you!

  • [deleted] replied

    Hi,

    I have tried to access the admin panel but I receive this error:

    https://d.pr/i/VlkCLi

    I am not sure what is happening there.

  •  27
    kaPuh replied

    As you can see, I am in the backend! With these logins.

  •  27
    kaPuh replied

    Can you try it again?!

    Ich tried it with your login credentials in different browsers and it all works fine ?!

  • [deleted] replied

    I was able to login now!

    I have tested the behavior and the URL is now reflected with current language permalinks:

    https://d.pr/v/bHn1m3

    Isn't this what you was looking for or I am missing the point?

  •   kaPuh replied privately
  • [deleted] replied

    Hi,

    I have created this code for you to achieve what are you looking for:

    <script>
    jQuery( document ).ready( function( $ ) {
        var termsTranslations = {
            books: 'buecher',
            vector: 'vektor',
        };
        var hash = document.location.hash.toString();
        if ( hash ) {
            hash = hash.replace( '#', '' );
            $.each( termsTranslations, function( termEn, termDe ) {
                if ( termEn === hash ) {
                    $( '[data-term="' + termDe + '"]' ).click();
                }
                if ( termDe === hash ) {
                    $( '[data-term="' + termEn + '"]' ).click();
                }
            } );
        }
        $( '.wpml-ls-item a' ).on( 'touchstart mousedown', function() {
            var href = $( this ).attr( 'href' ).replace( /#.*/g, '' ),
                hash = document.location.hash.toString();
            if ( ! href.endsWith( '/' ) ) {
                href += '/';
            }
            $( this ).attr( 'href', href + hash );
        } ); 
    } );
    </script>
    Please add this code in Theme Options > Other > Custom JS > Footer JS.

  •   kaPuh replied privately
  • [deleted] replied

    Can you please grant me access on your site so I can test and make it work for you?

    To include your credentials click Insert Credentials button in editor toolbar. (See how)

  •  27
  • [deleted] replied

    Hi,

    I tested them earlier but I can't enter to your Wordpress login area because 503 error is appearing (see video).

    Thanks!

  •   kaPuh replied privately
  • [deleted] replied

    Hi kaPuh,

    Sorry but I still receive the same Error 503, can you please contact your hosting provider and ask them why this is happening? I think that they block visit from other states or have activated any firewall in the server.

    Thanks!

  •   kaPuh replied privately
  •  27
    kaPuh replied

    Hallo?

  • [deleted] replied

    Hello,

    Sorry for waiting, we were working in new update of Kalium 3.

    I have created this code snippet for you and it worked, see video https://d.pr/v/haxLYI:

    <script>
    jQuery( document ).ready( function( $ ) {
        var $terms = $( '.portfolio-root-categories [data-term]' ),
            $languageSwitcher = $( '.menu-item-type-wpml_ls_menu_item a' ),
            lsLink = $languageSwitcher.attr( 'href' ),
            languageTranslations = {
                'vektor': 'vector',
                'buecher': 'books',
                'vector': 'vektor',
                'books': 'buecher',
            };
        var checkSlug = function( term ) {
            if ( languageTranslations[ term ] ) {
                $languageSwitcher.attr( 'href', lsLink + '#' + languageTranslations[ term ] );
            } else {
                $languageSwitcher.attr( 'href', lsLink );
            }
        };
        
        $terms.on( 'click', function( ev ) {
            var term = $( this ).data( 'term' );
            checkSlug( term );
        } );
        let hash = window.location.hash;
        
        if ( hash ) {
            checkSlug( hash.replace( '#', '' ) );
        }
    } );
    </script>
    
    I have tested and it worked.

  •  27
    kaPuh replied

    Thanks a lot. This code is working very well!