Archived topic
Problem with copyright text
15 replies · Started by Krzysztof on July 29, 2016
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.
Same is when I try to use others shortcodes.
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.
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.
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.
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.
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]' );
}
I can't use it because then I can't use %copy% and %current year%.
%copy% coverts into ©
%current_year% converts into <?php echo date( 'Y' ); ?>
Tom maybe You can add filter to change copyright text (I would like to block changes in Customizer)?
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/
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.
Okey, I used function to remove default message.
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' );
}
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 © ' . date('Y') . ' - <a href="/fr/credits-et-mentions-legales/">Crédits et mentions légales</a>';
break;
case 'en':
echo 'My Site Web © ' . date('Y') . ' - <a href="/en/credits-et-mentions-legales/">Credits and legal notices</a>';
break;
default:
echo 'My Site Web © ' . 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