[Resolved] Copyright message in Footer and Polylang compatibility

Home Forums Support [Resolved] Copyright message in Footer and Polylang compatibility

Home Forums Support Copyright message in Footer and Polylang compatibility

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #639576
    Theo

    Hi,
    Is there a way to get GP or Polylang to pick up a modified string in the Copyright message?

    After activating the copyright module, I wrote in some draft text and published the customizer. That string was added by Polylang to its list of “String translations” with name “generate_copyright” and group “gp-premium”.

    When I now change this draft text, the label for that string in Polylang remains the same, so whatever I enter in one of the language translations, it doesn’t get translated. Even when I change the text in the customizer back to the exact same one, the “link” with the translations string seems to be lost: no translation occurs when switching languages.

    Do I need to revert to php in hooks like https://generatepress.com/forums/topic/polylang-and-footer-content/ or can one get Polylang to “see” the changed customizer copyright string?

    #639878
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m afraid I’m not 100% sure how Polylang handles strings added in the Customizer. It might be worth asking them if there’s something special you need to do.

    The code in that topic will definitely work for now.

    Let me know if you end up asking them πŸ™‚

    #640208
    Theo

    Hi Tom,

    (I use the free version of Polylang, so there’s no support)

    Found the cause, not yet the solution: The fact that Polylang did not see a changed copyright message, and that therefore also translations did not work, is a consequence of me using a child theme (with your child theme template). As soon as I switch back to the GP theme, Polylang sees the modified copyright message and my entered translations.

    The string is stored in wp_options as a theme_mod under generate_press, not generate_press_child by the customizer. That’s perhaps the reason why Polylang does not apply it when WP is using the child theme.

    The only reason for the child theme is a simple custom post type where I slightly modified single.php to display some custom fields. I’d like to continue using it, but if need be, I’ll rework these 6 custom posts as pages. Please advise:
    1. is there a fix that I could apply by editing tables (no sql-wizard here!), or
    2. a fix that you could write so that Polylang sees that the Customizer is writing this string for a child theme, not the main theme, or
    3. should I scrap the child theme / find another way to display that custom post type?

    #640613
    Tom
    Lead Developer
    Lead Developer

    Ah yes, the copyright is using theme_mod. This is something I’ll be migrating over soon.

    That being said, I’m not sure why Polylang would care whether it’s a child theme or not. Perhaps it’s a bug in their plugin?

    #640805
    Theo

    Polylang somehow registers the string entered into the main GP theme/plugin, keeps showing it in its String Translations as long as the GP plugin is active, but the added use of a child theme makes it unmodifiable and untranslatable (greyed out checkbox in the String Translations). It seems as if – for Polylang – the main theme and the Premium plugin are linked, and the child theme is seen as a separate entity. No clue why.

    I’m out of my league here. Googled a bit and found developers writing solutions for polylang-untranslatable theme_mod content, like
    https://kau-boys.com/2047/wordpress/translate-customizer-options-with-polylang
    https://theme.co/apex/forums/topic/how-to-translate-footer-content-in-customizer/
    However, I would need to know which file to edit in the GP main theme or in the Premium plugin (edit/copy into child theme?? complicated when the thing you want to change is the plugin…) to add the pll__ function.

    Alternatively, some themes provide a wpml-config.xml file where you need to change a key-value pair when you use a child theme:
    https://docs.themeisle.com/article/80-how-to-translate-zerif
    Not sure if that helps since you do not use such a file.

    Does this help?

    #641006
    Tom
    Lead Developer
    Lead Developer

    I would just use the solution you posted further above for now until we ditch theme_mod for the copyright. It’s likely more backward compatible that using their pll function.

    #641183
    Theo

    OK. Switched back to main theme & just copied over my 2 modified php files. Guess I’ll have to pay attention when updating πŸ™‚ Thanks for your help Tom!

    #641307
    Tom
    Lead Developer
    Lead Developer

    No problem!

    It might be easier to just use the function from above? Should be simple plug-n-play, which will allow you to keep your child theme and not worry about updates.

    #641359
    Theo

    I chose not to use the hook+function because using the hook ‘After footer content’ actually places the content of the function outside the footer. So there’s no link anymore with whatever color/font change I make to the footer in the customizer. I’d have to add layout instructions to the function and I’d have to keep that in sync when I would change things. Or would I be able to just add class ‘copyright-bar’ to the function elements, and that would keep things straight?

    #641753
    Tom
    Lead Developer
    Lead Developer

    This function (https://generatepress.com/forums/topic/polylang-and-footer-content/#post-471533) actually just filters the current copyright, which is exactly what the Customizer option does. Using that method should make it so the Customizer options still work just fine.

    #641769
    Theo

    Tom, you’re absolutely right. Not sure what I missed/did wrong when I tested this earlier, but it probably was late… It now works. I’ll revert back to the child theme. Thanks a lot!

    #641788
    Tom
    Lead Developer
    Lead Developer

    No problem πŸ™‚

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