Support » Plugin: Polylang » Wrong front page showing in Appearance > Customize with Polylang loaded

  • Resolved ElectricFeet

    (@electricfeet)


    Hi Fédéric and thanks for such a great plugin.

    I’ve been using Polylang on-and-off in a test environment. I’ve not used it much— mainly to test the Customizr-Polylang “bridge” code. I’m currently using it much more, as I’m re-writing the “bridge” code to take advantage of Customizr’s hooks.

    I have a static front page called “home” (en), which corresponds to a page called “pagina iniziale” (it). I then have a separate “blog” page, which is only defined in English (because the page is an empty page anyway and “blog” is the same in both languages).

    I now have a brand new WordPress local installation: WP 3.9.1; Polylang 1.4.5; no other plugins or code loaded.

    I have noticed that with Polylang loaded, Appearance > Customize shows my blog page, not the front page as it should. This happens with twenty thirteen and twenty fourteen themes (I also tried the Decode theme and got the same symptoms). With Polylang deactivated, the front page is correctly displayed.

    Perhaps something is calling is_home() instead of is_front(), or calling them in the wrong order, or something similar.

    Do you know what could be causing this? I don’t recall seeing it before, so maybe it’s a conflict introduced in WP 3.9 or 3.9.1? it could also be my setup, of course, but it’s a brand new install, so I don’t think there should be anything corrupt in there. All my other plugins are deactivated, of course.

    https://wordpress.org/plugins/polylang/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    I don’t reproduce such issue. Could you check that your homepages in both languages are correctly linked? Is the problem only in customizer or in frontend too?

    Could you precise you Polylang settings?

    I then have a separate “blog” page, which is only defined in English (because the page is an empty page anyway and “blog” is the same in both languages).

    Polylang expects the page to be translate as I don’t see how you would access your Italian posts otherwise.

    Thanks for the swift reply Fédéric. I did some more digging.

    (I also created two pages called “Blog”, with slugs “blog-en” and “blog-it”; gave them the right language; and connected them in Polylang’s dropdown. Thanks for explaining that!)

    I think Polylang is suffering from a bug(?) that I found in WordPress. If it isn’t a bug, it’s an inconsistency that you need to work around.

    As I’m in a test environment, I frequently change the Front page displays settings, so I managed to stumble quite easily on it.

    In the WordPress database settings, if show_on_front is set to a static page ID, but the page_on_front is not set, then WordPress takes you to the blog page. This is what I was seeing in my post above. Taking you to the blog page under the circumstances seems reasonable behaviour, but it would be better if the page_on_front were set properly under all circumstances.

    There are various different scenarios that give varying degrees of issues, but the worst case scenario for Polylang is when show_on_front is set to “posts”, but page_on_front is set to a page ID. To replicate this, proceed as follows:

    In Polylang settings, set The language is set from the directory name in pretty permalinks.

    From Appearance > Customize (NOT from Settings > Reading) select:

    Front page displays: A static page
        Front page: home (a static page called "home")
        Posts page: blog (an empty page called "blog")

    and Save & Publish.

    The front page called “home” displays and the blog posts show on their page. Everything is working as it should.

    Now refresh customize (again, from Appearance > Customize, NOT from Settings > Reading) and select:

    Front page displays: Your latest posts
        Front page: home (leave this alone - still set to "home")
        Posts page: blog (leave this alone - still set to "blog")

    and Save & Publish.

    In my case, Polylang is showing the page called “home”, which is a static page with some text on it, while the blog page shows an empty blog (in my case “… en/blog-en/”) with no posts.

    I speculate that this is because Polyang is suffering from the WordPress bug/inconsistency in the link above. Perhaps because Polylang is checking the Page_on_front setting (which still—incorrectly IMO—contains the ID of the page called “home”) and not the Show_on_front setting (which —correctly— contains “posts”).

    Does that make more sense? Can you replicate it?

    Plugin Author Chouby

    (@chouby)

    Hi!

    Your analysis is perfect!

    In Settings->Reading, WordPress resets the page_on_front option if you choose to display posts. And that’s not the case in Customizer. As you wrote, it is not consistent but I have to deal with this as WordPress does it (i.e. systematically test show_on_front before testing page_on_front).

    So the current development version (1.5dev31) should fix this.
    http://downloads.wordpress.org/plugin/polylang.zip

    Wonderful! Thanks Fédéric. I’ll give it a try and let you know if I have any further problems.

    p.s. Fédéric, you might want to take a look at this and update your blog post on the “bridge” code. Hope you like it 🙂

    Plugin Author Chouby

    (@chouby)

    I am really glad you did this. For sure I updated my post to link to your guide and new code snippet 🙂

    🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Wrong front page showing in Appearance > Customize with Polylang loaded’ is closed to new replies.