Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link problem #95

Open
crizzler opened this issue Dec 12, 2015 · 6 comments
Open

Link problem #95

crizzler opened this issue Dec 12, 2015 · 6 comments
Labels

Comments

@crizzler
Copy link

Links to translated posts do not work like in Version 1.0.4.

Version 1.0.4 link structure: domain.tld/blog/post
Version 1.0.6 link structure: domain.tld/post

Changing site settings or perma link structure has no effect.

@lloc
Copy link
Owner

lloc commented Jan 14, 2016

Thanks. I will check this now.

@lloc lloc added the Bug label Jan 14, 2016
@lloc lloc added this to the 1.0.9 milestone Jan 14, 2016
@f4z3k4s
Copy link

f4z3k4s commented Feb 2, 2016

I experienced the same issue with translated posts. No matter if I change the permalink, the language switcher keeps redirecting me from /en/blog to /de and vice versa. Same issue with posts. Is there any solution for this by now? Thanks in advance.

@lloc
Copy link
Owner

lloc commented Feb 2, 2016

Do you have an URL where I can see this?

@f4z3k4s
Copy link

f4z3k4s commented Feb 2, 2016

Thanks for the quick reply. The url is the following: http://quercusapp.com . If you click on about then select blog and you press on 'DEUTSCH' it jumps to the frontpage of the german version, although the german blog is selected in the language switcher. Same goes with posts. We struggled hours with figuring out what could cause this and haven't been able to solve this yet. Thank you for helping us!

@f4z3k4s
Copy link

f4z3k4s commented Feb 4, 2016

Is that a problem with the plugin itself? Or are we not doing something correctly perhaps?(We just did the same thing as with the other pages). Or is the problem related to Wordpress?

@jeffturcotte
Copy link

This definitely needs to be fixed in the core code. For the time being, here is a function I wrote that generates all the data you need to output a custom language selector that actually works as intended.

public function get_language_options()
{
    global $post;

    $blogs = MslsBlogCollection::instance()->get_objects();
    $posts = ($post) ? get_option('msls_' . $post->ID) : [];

    $current = null;
    $links = [];

    foreach($blogs as $blog) {
        $language = $blog->get_language();

        if ($blog->userblog_id == MslsBlogCollection::instance()->get_current_blog_id()) {
            $current = $language;
        }

        // if linked post doesn't exist, link to homepage
        $links[$language] = $blog->path;

        if (isset($posts[$language])) {
            switch_to_blog($blog->userblog_id);
            $links[$language] = get_permalink($posts[$language]);
            restore_current_blog();
        }
    }

    return [
        'current' => $current,
        'links' => $links
    ];
}

@lloc lloc removed this from the 1.0.9 milestone Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants