[Resolved] Problem with copyright text

Home Forums Support [Resolved] Problem with copyright text

Home Forums Support Problem with copyright text

  • This topic has 15 replies, 3 voices, and was last updated 6 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #213778
    Krzysztof

    I try to save this copyright text:
    Copyright %copy% 2009-%current_year% <a href="[:en]/en/about-me/[/:en][:pl]/pl/o-mnie[/:pl]">XYZ</a>
    After refresh customize I see:
    Copyright %copy% 2009-%current_year% <a href="pl]">XYZ</a>
    I added such text a long time ago and it was work before copyright was moved to customize.

    #213785
    Krzysztof

    Same is when I try to use others shortcodes.

    #213868
    Tom
    Lead Developer
    Lead Developer

    Interesting – who supplies those shortcodes?

    I’ve added sanitization for everything added to the database for security reasons, so it looks like the format of those shortcodes are being sanitized too heavily.

    #213884
    Krzysztof

    Tom, those shortcodes are from “Ceceppa Multilingua” plugin. This same is for other shortcode from this plugin:
    [cml_text lang1="value" lang2="value"]
    which gives empty space.

    #213906
    Tom
    Lead Developer
    Lead Developer

    What happens when you add the shortcode, save and then view the site?

    It’s possible that the live preview just isn’t firing the shortcode, but the live site will.

    #213908
    Krzysztof

    I don’t understand – such bug I have when I save and again go to customize. After save on front-end I have error in code.

    #213910
    Tom
    Lead Developer
    Lead Developer

    You may have to add it using a function then, as for whatever reason the Customizer isn’t liking the syntax of that shortcode.

    add_action( 'generate_credits','generate_add_copyright_shortcodes' );
    function generate_add_copyright_shortcodes()
    {
        echo do_shortcode( '[your_shortcode]' );
    }
    #213950
    Krzysztof

    I can’t use it because then I can’t use %copy% and %current year%.

    #213960
    Tom
    Lead Developer
    Lead Developer

    %copy% coverts into &copy;

    %current_year% converts into <?php echo date( 'Y' ); ?>

    #214054
    Krzysztof

    Tom maybe You can add filter to change copyright text (I would like to block changes in Customizer)?

    #214116
    Tom
    Lead Developer
    Lead Developer

    I’ve made it so shortcodes are rendered in the live preview for the next version.

    However, the syntax of the shortcodes in your initial post is really weird, so I’m not sure if it will work.

    I’m not sure sure what you mean by block changes in the Customizer? You can add your own copyright message with whatever content you want using a function like this: https://generatepress.com/knowledgebase/changing-the-copyright/

    #214117
    Krzysztof

    Block = no possibility to use Customize to change copyright text.

    Syntax of this shortcodes is okay, I have problem not only with this shortcodes, this was only an example.

    #214121
    Krzysztof

    Okey, I used function to remove default message.

    #214122
    Tom
    Lead Developer
    Lead Developer

    You could do something like this to remove the customizer control:

    add_action( 'after_setup_theme','generate_remove_copyright_control' );
    function generate_remove_copyright_control()
    {
        remove_action( 'customize_register', 'generate_copyright_customize_register' );
    }
    #533876
    Dominique

    Hi,

    For information: I had exactly the same problem with the extension wp-multilang (a fork of qtranslate-x), the shortcodes to change languages ([:fr] [:en] [:]) were not interpreted in the footer.
    I found a solution with the following code:

    add_filter( 'generate_copyright','tu_custom_copyright' );
    function tu_custom_copyright() {
    switch (wpm_get_language()) {
      case 'fr':
        echo 'My Site Web &copy; ' . date('Y') . ' - <a href="/fr/credits-et-mentions-legales/">Crédits et mentions légales</a>';
        break;
      case 'en':
        echo 'My Site Web &copy; ' . date('Y') . ' - <a href="/en/credits-et-mentions-legales/">Credits and legal notices</a>';
        break;
      default:
        echo 'My Site Web &copy; ' . date('Y') . ' - <a href="/fr/credits-et-mentions-legales/">Crédits et mentions légales</a>';
        
    }
    }

    If it can help someone with the same concern.
    Dominik

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