• Resolved jymartineau

    (@jymartineau)


    I apologize in advance if this is the dumbest question asked on this thread.

    I use a static front page on my site, and I use front-page.php to tell it what to display. Ive used the page level language control to tell the plugin I want a front page in French (the site is english default).

    When I use the plugin, I can see that the plugin does its job and navigates me to a different page as the front page (I can see for example that the HTML tag has the lang=”fr-FR” tag added), but, I cannot figure out how to supply my French content to this page – I called the new page Accueil, tried giving it a page-accueil.php , but, it still keeps loading the contents from front-page.php in English obviously.

    What am I doing wrong? I would like to feed it a pre-made version of front-page.php with the contents in French… is it glaringly obvious and I just dont see it? lol I’ve read through the online help, but it’s not clear to me.

    It should be said, the plugin works great for every other page, just not this “special” one. Please hlep!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jymartineau

    (@jymartineau)

    I’ve done further testing. Here’s where I am at:

    • Ive created page-accueil.php to the French home page
    • I have linked the EN Home page (front-page.php) and the FR Home page (page-accueil.php) together through the Page Language Panel, added to each post and page by the plugin
    • I have de-selected the function that displays the home page in the language dictated by the browser
    • in theme customization, I have selected the EN home page (front-page.php) as the static home page

    <html lang="en-CA"><body class="home page page-id-950 page-template-default logged-in admin-bar no-customize-support"class="post-950 page type-page status-publish hentry front-page">

    Here’s what I observe:

    1. When selecting FR from the language switcher, the URL and HTML reflect that I am indeed on the French side
    2. However, the French Menu does not appear ( even though it is selected and is configured in the proper theme location)
    3. the home page is loading the EN home page, and the body classes are the same (home) albeit with a different page-ID, vs loading page-accueil.php, which the page linked as the French equivalent to Home (EN)
    <html lang="fr-FR">
    <body class="home page page-id-1026 page-template-default logged-in admin-bar no-customize-support"class="post-1026 page type-page status-publish hentry front-page">

    Do I need to store a french content file called front-page.php in a folder, for it to be picked up? if yes, this is not obvious in the documentation…

    Please help!!

    Thread Starter jymartineau

    (@jymartineau)

    I also notice that there’s 2 “class” arguments in the <body> tag – how is that even possible??

    Thread Starter jymartineau

    (@jymartineau)

    The 2 class thing was a cut and paste issue – fhew! I got this to work finally.

    I am simply using
    pll_current_language($value);

    To modify what content gets loaded and so far, it works beautifully. I am going to test how that impacts performance next.

    I guess the net/net is, you can’t use the front-page.php option for static front page custom code, and have two seperate .php’s governing the language… so far, the only way I’ve been able to make this work is by using a function that decides what front page content to load, depending on the language.

    Thread Starter jymartineau

    (@jymartineau)

    Forgot to hit the “resolved” option.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP front page (front-page.php)’ is closed to new replies.