WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Custom URLs for lang switches in home page (9 posts)

  1. rafastar
    Member
    Posted 2 years ago #

    Hi.

    I'm totally new both to WordPress and PHP, i.e. a dumb user, so sorry if the question is dumb too.

    I think you plugin is great, it makes anything I need but one. I'm using a predesigned theme with a special home page based on slides. The content for these slides is provided through special fields under a configuration panel, so I can't establish language relationships between home pages and even worse, I'm forced to keep a multisite environment just for the home page in the alternate language.

    The problem is that I can't link the alternate language switches in the menu bars of both home pages (stored in different sites) to the home page in the other site. On the other hand, under WordPress I do can provide a custom link for "Home" in the menu bar, so I could point it to other site without any problems, but I don't know how to do that for the Polylang flags.

    Please, tell me this is a dumb question and there is an easy solution. I'm a good C++ programmer so if need to get my hands in PHP, I could give a try. I know there is another plugin called "Multisite Language Switcher" but I prefer this plugin.

    Thanks,
    Rafa.

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    It could be worth to try making your theme working on an unique site.

    Did you try to create a front page per language (setting languages and translation) and declare one of them as front page in the Settings->Reading panel and then see what happens ?

    After doing this, we may have to do some adjustments to make the slider working. Up to now, I always found a solution, for example here or here

    Is your theme downloadable somewhere ?

  3. rafastar
    Member
    Posted 2 years ago #

    Wow! Thank you for your fast answer! You must be earning a lot of money with this...

    My theme is Nova from elegantthemes.com. It's a pay only theme so I'm afraid you can't test it. As you can see, I've just mentioned the main slideshow but there is another problem with the tabs at the bottom of the home page. So I thought creating a multisite would be the only solution although it would be great to get rid of this.

    I also pondered the alternative of the static home page but the slideshow+tabs is too complex for me to replicate and it's the strongest asset of the theme.

    Thank you again for your incredible support.

  4. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    You must be earning a lot of money with this...

    I guess you are joking...

    I have seen the demo. Could you explain how your home page is set up ? Does the theme have a file called front-page.php ? How do you enter the content of this page ?

  5. rafastar
    Member
    Posted 2 years ago #

    I guess you are joking...

    Yes, indeed.

    The theme comes with a proprietary control panel. There you can select which pages you want to conform the home page slides and tabs, clicking on them. This control panel is unique for the theme, that's why I immediately though of a multisite as the only solution to handle two versions of the home page. But as I've said I don't have experience with WordPress so I may be wrong.

    Finally, once you have selected the pages for each of these two areas you can provide custom titles for them via special fields added to the page edit area of WordPress. This is no problem: two pages in different languages, two custom titles.

    I don't see front-page.php but the theme comes with a file called home.php. There I can see two main blocks that start this way, respectively:

    <ul id="main-tabs">

    and

    <?php for($i=0; $i < $home_pages_num; $i++) { ?>
    <div class="tab-slide clearfix" id="<?php echo esc_attr($pagesContent[$i]['hash']); ?>">

    I suppose there is the heart of the question but I don't understand much.

    I appreciate very much your help but I didn't intend you to write code for me. I think that's too much. I just wanted to know if there is another way of tackling the problem, high level.

    Thanks a lot.

  6. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    I asked you the question about front-page.php because, thanks to your issue, I discovered that it is not loaded in on translated front page. Thanks to you I will correct this in the next release.

    home.php however should be correctly loaded. So what I would try in your case is: writing two pages, one in "language 1", the second in "language 2". Then I would tell the theme to display both on the homepage (either in the slider or in the tabs), and see what happens...

  7. rafastar
    Member
    Posted 2 years ago #

    Eeeehh... I feel silly. You're right, as simple as that. It worked! Both in the slider and the tabs, the right pages show whenever you change the language. And without needing a multisite!

    Thank you very much for your support! An glad that because of my incompetence you have discovered that issue with front-page.php.

  8. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    I often say something that I could translate like that: It's better to feel silly during 5 minutes, than to stay silly all life !

  9. ryanlindahl
    Member
    Posted 1 year ago #

    Hello, I am also trying to create a custom home page that uses a theme with a proprietary control panel built into WordPress. I am able to change the nav bar but I would like to have a custom slideshow and widgets that are specific to a language. Do you have documentation on how to do that? What do you mean by writing two pages, on in language 1 and the other language 2? Are you supposed the modify the front-page.php or duplicate it?

    Thanks,
    Ryan

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags