[Support request] Polylang and Footer content

Home Forums Support [Support request] Polylang and Footer content

Home Forums Support Polylang and Footer content

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #470199
    Dan

    Hi,
    I have a site with 2 languages.
    Would you know how can I change the footer credit (Edited via the customizer) for each language?
    I am using the Polylang plugin.

    Thanks
    Dan

    #470317
    Leo
    Staff
    Customer Support

    Hi there,

    If you are using WPML then you can use the after footer content hook with this method:
    http://demo.generatepress.com/hook-locations/

    You will have to check with Polylang if they support the same thing 🙂

    #470327
    Dan

    Yes, polylang supports it too.
    I was wondering why doesn’t The customizer change per language and if it’s a wp, GP or polylang thing.
    And if there’s an option without the hook.

    Thanks
    Dan

    #470376
    Tom
    Lead Developer
    Lead Developer

    I believe WPML gives you an option to change the Customizer option per language, as we’ve included a compatibility file that looks for specific theme options in WPML. Not sure if Polylang has something like that?

    #471533
    Dan

    Hi Tom, didn’t see that in Polylang,
    As a previous user of WPML, my impression is that this plugin slows the site down so I have been trying out Polylang.
    Maybe it’s worth asking the Polylang author for a compatibility file like in WPML.

    Till that is solved I used the “Before Footer Content” to replace the credit line based in the language selected.

    <?php
    add_filter( 'generate_copyright','tu_custom_copyright' );
    function tu_custom_copyright()  { ?>
    <?php if (get_locale() == 'en_US'): ?>
    ---English content---
    <?php endif; ?>
    <?php if (get_locale() == 'he_IL'): ?>
    ---Hebrew Content---
    <?php endif; }?>
    

    Thanks,
    Dan

    #471889
    Tom
    Lead Developer
    Lead Developer

    Definitely nothing wrong with that method 🙂

    #1266754
    pistolitas

    Polylang currently works with Generatepress Elements,

    so my solution is

    • Create a Hook and choose a language
    • Hook->footer
    • Disable Site Footer
    • Execute PHP
    • Display Rules -> Location -> Entire Site

    with this code

    <footer class="site-info" itemtype="https://schema.org/WPFooter" itemscope=""><div class="inside-site-info grid-container grid-parent"><div class="copyright-bar"> <span class="copyright">&copy; <?php echo date('Y'); ?> <?php echo get_bloginfo( 'name' ); ?></span> • Powered by <a href="https://generatepress.com" itemprop="url">Generate8Press</a></div></div></footer>

    and so on for the rest of the languages. Now you have a custom footer for each language.

    Maybe is not very elegant, but It does the job. Any better solution?

    #1267715
    Tom
    Lead Developer
    Lead Developer

    The method that Dan mentioned above makes it so you don’t need to remove the default footer – it just filters the content.

    However, there isn’t anything wrong with your method, either 🙂

    #2331142
    Diego

    Thanks for this info. But I don’t know where do I need to put this code? Could you help me? Thank you again.

    <?php
    add_filter( 'generate_copyright','tu_custom_copyright' );
    function tu_custom_copyright()  { ?>
    <?php if (get_locale() == 'en_US'): ?>
    ---English content---
    <?php endif; ?>
    <?php if (get_locale() == 'he_IL'): ?>
    ---Hebrew Content---
    <?php endif; }?>
    #2331155
    Fernando
    Customer Support

    Hi Diego,

    Can you try adding this through Code snippets?:

    add_filter( 'generate_copyright','tu_custom_copyright' );
    function tu_custom_copyright()  {
    if (get_locale() == 'en_US'):
    endif;
    if (get_locale() == 'he_IL'):
    endif; }

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2331169
    Diego

    Thanks. It works for me.

    #2331176
    Fernando
    Customer Support

    You’re welcome Diego!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.