Support » Plugin: Multisite Language Switcher » Get the associated post

  • Resolved Orfeo

    (@arnaudfr)


    Hello,

    I just wan’t to know how to get the post associated to the current post.

    Thanx !

    • This topic was modified 1 week, 3 days ago by  Orfeo.
    • This topic was modified 1 week, 3 days ago by  Orfeo.
Viewing 5 replies - 1 through 5 (of 5 total)
  • I tried to do that :

    
    $mslsOption = new MslsOptions();
    $link= $mslsOption->get_permalink( 'fr_FR' );
    

    But it returns the link to the home page while it exits an associated post.
    I have search through the whole source code, I am surprised there isn’t a simple way to do that, it seems to be a basic thing …

    Plugin Author Dennis Ploetner

    (@realloc)

    Hey,

    there is a magic __get that should give you that:

    $mslsOption = new MslsOptions();
    $linked_post = $mslsOption->fr_FR;
    Plugin Author Dennis Ploetner

    (@realloc)

    … or if you need all linked item IDs:

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

    Ok thanks, you should add that to the FAQ ! 🙂

    Hello.
    That topic is exactly what I was looking for!
    But I paste you construction in single.php and do not see any IDs.

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

    -gives

    Array ( [admin_language] => ru_RU [display] => 2 [content_priority] => 10 [reference_user] => 1 )

    And

    $mslsOption = new MslsOptions();
    $linked_post = $mslsOption->ru_RU;

    -do nothing.

    What can I do wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.