- This topic has 11 replies, 2 voices, and was last updated 1 year, 8 months ago by Fernando.
-
AuthorPosts
-
January 13, 2018 at 12:00 pm #470199Dan
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
DanJanuary 13, 2018 at 5:31 pm #470317LeoStaffCustomer SupportHi 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 🙂
January 13, 2018 at 6:10 pm #470327DanYes, 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
DanJanuary 13, 2018 at 8:41 pm #470376TomLead DeveloperLead DeveloperI 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?
January 15, 2018 at 9:19 am #471533DanHi 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,
DanJanuary 15, 2018 at 7:58 pm #471889TomLead DeveloperLead DeveloperDefinitely nothing wrong with that method 🙂
May 2, 2020 at 2:36 pm #1266754pistolitasPolylang 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">© <?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?
May 3, 2020 at 9:16 am #1267715TomLead DeveloperLead DeveloperThe 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 🙂
September 2, 2022 at 12:41 am #2331142DiegoThanks 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; }?>
September 2, 2022 at 12:47 am #2331155Fernando Customer SupportHi 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
September 2, 2022 at 1:13 am #2331169DiegoThanks. It works for me.
September 2, 2022 at 1:19 am #2331176Fernando Customer SupportYou’re welcome Diego!
-
AuthorPosts
- You must be logged in to reply to this topic.