• How can I get (which function) an array with the language and the links for all the linked pages of a current page ?

    Thanks for your answer.

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

    (@realloc)

    If you need the id of the linked object just try

    $values = MslsOptions::create()->get_arr();

    To get an array of the linked pages:

    $links = ( new MslsOutput() )->get( 0, true );

    Hello, Dennis.

    I’ve been trying for days to have an array with the language + link but including the current language, i.e. if I’m in the Italian wordpress, it only shows me the US and Russian wordpress, but not the Italian… How can I make it even show me the current?

    Thanks.

    Plugin Author Dennis Ploetner

    (@realloc)

    I guess that you can just use get_permalink without any parameters.

    But in your code I saw the following, includes/MslsBlogCollection.php:

    	public function get_filtered( $filter = false ) {
    		if ( ! $filter && $this->current_blog_output ) {
    			return $this->get_objects();
    		}
    
    		return $this->get();
    	}

    If $filter was supposed to be false, it should be executed.

    return $this->get_objects();

    And this does show all, including the current language… but it does not work, I must modify it this way:

    	public function get_filtered( $filter = false ) {
    		if ( $filter == false ) {
    			return $this->get_objects();
    		}
    
    		return $this->get();
    	}

    And use

    $links = ( new MslsOutput() )->get( 0, false );
    
    print_r($links);

    With this it does show all the languages… But I don’t want to modify the code of your plugin and then I would lose the changes once updated. Could you fix it in the next version, please?

    It seems that you had it in your code but it should not work, since there is a class css that is added to the current language “current_language” but never shows the current language… So I figured it was a bug

    					$arr[] = sprintf(
    						'<a href="%s" title="%s"%s>%s</a>',
    						$url,
    						$link->txt,
    						( $current ? ' class="current_language"' : '' ),
    						$link
    					);

    Thanks.

    Plugin Author Dennis Ploetner

    (@realloc)

    Did you activate the link to the current language in the dashboard?

    Oh, thank you, that was it. Lol… I’ve been doing this for days and look how simple it was.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Array of language + link’ is closed to new replies.