• Resolved phil404

    (@phil404)


    I’m using WordPress 3.3.2 multisite and Multilingual Press to manage two sites apart from the root: /en/ (English) and /fr/ (French).

    The problem I am having is very specific:

    The language switcher widget no longer works properly when a page template contains any usage of the query_posts() function to fetch posts. Instead of pointing to the equivalent page in the other language, the link on that page will point to the root page of the other language. Removing query_posts() from the template will restore the desired functionality of the language switcher widget.

    Is this a bug with the plugin, or am I missing something?

    Thanks.

    -phil

    https://www.ads-software.com/extend/plugins/multilingual-press/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter phil404

    (@phil404)

    Ok, I have found the problem. When using query_posts() replaces the pagename=foo property from the query string, which is required in order to preserve the relationship between the translated pages. Adding pagename=team to my query_posts() query solves the problem of the broken language switcher link, but creates a new problem: no posts are returned from my query. This makes perfect sense, as no posts will contain the property pagename.

    Help. ??

    -phil

    Plugin Author Robert Windisch

    (@nullbyte)

    Did you do a “wp_reset_query()” after your custom query? The widget is using the current query data, so if you change that you need to reset your changes after your custom loop is done. Other widgets and functions will have that problem too.

    Thread Starter phil404

    (@phil404)

    Robert,

    If you’re ever in Montreal, I would like to buy you a beer or two. I had no idea wp_reset_query() existed.

    Many thanks!

    -phil

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Multilingual Press] query_posts() breaks language switcher widget’ is closed to new replies.