[Geschlossen] Text in ACF (Advanced Custom Fields) blocks is not being translated when Shortcode is being used in ...
Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.
Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
-
8:00 – 13:00
9:00 – 13:00
9:00 – 13:00
8:00 – 12:00
8:00 – 12:00
-
-
14:00 – 17:00
14:00 – 18:00
14:00 – 18:00
13:00 – 17:00
13:00 – 17:00
-
Unterstützt die Zeitzone: Europe/Zagreb (GMT+02:00)
Hintergrund des Themas:
I am trying to translate text in ACF (Advanced Custom Fields) blocks, but the text is not being translated when a shortcode is used in the same field. You can see the issue on this page: versteckter Link section "Table reservation (possible from 2 persons)"
Die Symptome:
The text, both normal and button text from the shortcode, is not being translated.
Fragen:
Why is the text in ACF blocks not being translated when using a shortcode?
How can I ensure that both normal text and button text from shortcodes are translated?
i created the field group and i'll put content in it but
We use ACF Pro and we got a custom block.
<?php
/**
* voncontent Block Template.
*
* @param array $block The block settings and attributes.
* @param string $content The block inner HTML (empty).
* @param bool $is_preview True during AJAX preview.
* @param (int|string) $post_id The post ID this block is saved to.
*/
There is a File Manager available on versteckter Link
We could go through:
// Add this to your theme's `functions.php` file or a custom plugin.
function register_acf_block_types() {
// Check if function exists.
if( function_exists('acf_register_block_type') ) {
// Register a custom block.
acf_register_block_type(array(
'name' => 'voncontent',
'title' => __('Voncontent Block'),
'description' => __('A custom block for displaying content.'),
'render_template' => 'template-parts/blocks/voncontent/voncontent.php', // Adjust the path as necessary
'category' => 'formatting',
'icon' => 'admin-comments',
'keywords' => array( 'voncontent', 'content', 'custom' ),
'supports' => array(
'align' => true,
'mode' => false,
),
));
}
}
add_action('acf/init', 'register_acf_block_types');
And add voncontent.php, inside a folder such as template-parts/blocks/voncontent/ within the theme.
However our sandboxes don't have FTP access, only File Manager plugin (so if we make syntax error it would take the site down) so if you think it would be simpler for to you to upload your theme by all means.
Let me know!
The topic ‘[Geschlossen] Text in ACF (Advanced Custom Fields) blocks is not being translated when Shortcode is being used in …’ is closed to new replies.