• Hello,

    I have a website with polylang.

    mysite and mysite/fr

    Problem is, the Disqus feed groups everything together and mixes the languages.

    Is there a way to separate the feeds?

    Regards,
    Loki

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ovann86

    (@ovann86)

    If I understand correctly – you have one Disqus forum that is being used across multiple sites. Each site is for a different language.

    Is this a WordPress multisite?

    Are the sites on different domains (e.g. sitename.fr and sitename.com)

    Or different urls (e.g. sitename.com/en/ and sitename.com/fr/)

    It may be possible to filter for different domains, but I’m not so sure about different urls.

    Thread Starter lokisatyn

    (@lokisatyn)

    Not a multi-site, just different urls at the end -> sitename.com/en/ and sitename.com/fr/
    (Except that /en/ does not need to be added since it’s the default language)

    I tried registering a new Disqus site with sitename.com/fr/, but Disqus only wants to register the domain sitename.com, thus the same for both my languages.

    Plugin Author ovann86

    (@ovann86)

    I’ve added in a filter that you can use to conditionally skip threads.

    You should be able to use it to skip threads that don’t have the URL base for each of your sites.

    You’ll need to add and configure the filter for each of your sites.

    If you don’t already, I recommend you do this in a custom plugin, e.g.

    Here’s an example that would only show sitename.com/fr/ threads (note- you need to use the full URL, ie https … www … if used )

    function my_itsg_dlc_skip_thread( $skip_thread, $thread_info, $comment ) {
    $thread_link = $thread_info[‘link’];
    $query = ‘https://www.sitename.com/fr/’;

    // skip threads that do not start with $query
    // logic : if $thread_link does not start with $query
    if ( substr( $thread_link, 0, strlen( $query ) ) !== $query ) {
    return true;
    }

    return $skip_thread;
    }
    add_filter( ‘itsg_dlc_skip_thread’, ‘my_itsg_dlc_skip_thread’, 10, 3 );

    Thread Starter lokisatyn

    (@lokisatyn)

    Hello,

    Thank you for your answer! But please forgive me but I am not very code literate and I did not understand what to do with your reply.

    What I did:
    – updated Disqus Latest Comments Addon
    – copy-pasted your code in functions.php to try it out, just replaced https://www.sitename.com/fr/ with my url
    What happened:
    – the website stopped working until I reverted functions.php

    Also, is there a way to skip threads that do start with $query?
    The aim would be to display the English thread only by eliminating the French thread (English is just https://www.sitename.com without /en/ or /fr/ in the end, so I am afraid that using https://www.sitename.com as $query would still display both languages).

    Something else I am not sure to understand, is if I had activated your code then the plugin Disqus Latest Comments would only display the filtered thread on the whole site? Because as I mentioned earlier, this is not a multisite with two separate installations of WordPress. Both English and French exist on the same site. What I am trying to do is:

    – Widget on English pages to show English Disqus thread/latest comments.
    – Widget on French pages to show French Disqus thread/latest comments.

    Polylang lets me choose if a Widget is seen on the French pages or the English pages.

    I hope this clarifies what I am looking for, and once again I apologize if I missed something obvious in your reply or screwed up the application.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Separate feeds according to url’ is closed to new replies.