Support

Account

Home Forums Backend Issues (wp-admin) Display ACF fields (label & Excerpt)

Solving

Display ACF fields (label & Excerpt)

  • Hello !
    I’m using ACF to have a predfined form to write posts.

    As mu site is multilingual I would like to display the ACF field label with a shortcode on my post, and when the language is changed, it will take the right label (I use WPML).

    For example, my custom field is :

    FRENCH : Type de film = drame
    UK : Movie Type = drama

    I want to have only one post that can be translated automatically using the WPML plugin (My custom fields are translated, so in the post editor I can switch between UK and FR version). The problem is for the labels/titles of the fields that I cannot pass as shortcodes in the post.

    Now, my post is like :

    Type de film = [acf field="type"]

    But I have to change the label “type” for each page translated, I would prefer to have a shortcode like [acf field label] that can display the field label which is translated in the 2 languages.

    I wish I am clear enough !

    Other problem : the shortcode to display the field value is not working on the post excerpt, it display the shortcode instead of the value… Is there a way to use the shortcode in the post excerpt ?

    I’m not really familiar to the PHP code editing so if I can use shortcode in the WYSIWYG panel it is better for me.

    Thank you for your help !

  • Thank you for your response but it still doesn’t work.

    If I use the excerpt panel, it display the shortcode and not the value, and if I let WordPress make the standard excerpt from the post content, it display nothing.

    If you have another idea, it will be great.

    Thanks

  • If it can help, I use Avada Theme and try to display my shortcode in a manual excerpt.

    I try to add these 2 lines in functions.php

    add_filter( ‘the_excerpt’, ‘shortcode_unautop’);
    add_filter( ‘the_excerpt’, ‘do_shortcode’);

    But it doesn’t change anything 🙁

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Display ACF fields (label & Excerpt)’ is closed to new replies.