• Resolved anima11

    (@anima11)


    Hi,

    I tried linking to the associated page using this and this topic, however, I cannot find where this part of the code is stored.

    Where exactly do I need to paste this code?

    $mslsOption = new MslsOptions();
    $linked_posts = $mslsOption->get_arr();

    Currently the language switcher always links to the homepage instead of the associated page.

    Thanks a lot ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    Hello,

    MslsOptions has a factory that tries to figure out in which content type it is right now. This here should do what you want to archive:

    $mslsOption   = \lloc\Msls\MslsOptions::create();
    $linked_posts = $mslsOption->get_arr();

    Cheers!

    Thread Starter anima11

    (@anima11)

    Hi Dennis,

    thank you so much for your help. I’m sorry, I am still learning about code and I I’m certainly doing something wrong here cause it doesn’t work.

    I pasted the code that you gave me above, in the document “MultisiteLanguageSwitcher.php”
    I tried several locations within the document but none has worked out, it either returns a fatal error or still switches to the homepage instead of the associated page even though an associated page is selected.

    Did I understand it right that the code goes into “MultisiteLanguageSwitcher.php” and should work at any given spot?

    Sorry for bothering you and thanks for your help ??

    Plugin Author Dennis Ploetner

    (@realloc)

    Please, don’t save any code in the plugin directly.

    It depends on what you want to archive: Often is the file functions.php in your theme a good place.

    What exactly do you want to do? I ask because you can link the contents in the wp-admin together (using the plugin’s functionality).

    Read on here: https://msls.co/

    Thread Starter anima11

    (@anima11)

    Actually, i think what I`m trying to achieve is quite basic: I want the german Site to link to the associated English one. I did this https://msls.co/user-docs/editing-association-contents.html#status-of-connections already but it always links to the homepage and not the chosen associated page.

    Thus, I started searching the support forum if anyone has encountered the same issue.

    Thread Starter anima11

    (@anima11)

    I reinstalled the whole website including plugins again and now it works perfectly with all published sites and posts ??

    I’ll take that. Thanks for your help, Dennis. ??

    Plugin Author Dennis Ploetner

    (@realloc)

    Thanks for the update. Very good!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Link associated page’ is closed to new replies.