• Resolved Carlos Pinedo

    (@carlos-pinedo)


    Hi, I’ve been a fan of this plugin for a while. Today I found an error with a “select field” label, it should appear “Desarrollo Sostenible“, but instead appears “a:1:{i:0;s:21:”desarrollo-sostenible”;}” ?What could be the problem?

    The WordPress Version: 6.3.2.

    The “List category posts” version: 0.89

    The Shortcode: [catlist post_type=”doc” customfield_name=”sala” customfield_value=”desarrollo-sostenible” customfield_display=”sala,ano,autor” customfield_display_separately=”yes” numberposts=30 pagination=yes pagination_prev=Anterior pagination_next=Siguiente author=no date=no customfield_display_name=no thumbnail=yes orderby=date posts_morelink=”Leer más” ]

    ACF select field screenshot:
    https://www.aulapais.com.co/wp-content/uploads/2023/10/acflabel.png

    Select field label (how it’s supposed to appear ): Desarrollo Sostenible Select field label (how its appearing: ) a:1:{i:0;s:21:”desarrollo-sostenible”;}

Viewing 7 replies - 1 through 7 (of 7 total)
  • lukasdd

    (@lukasdd)

    I have the same problem

    Plugin Contributor zymeth25

    (@zymeth25)

    This is because the LCP plugin deals with regular, “raw”, WordPress custom fields but the ACF plugin uses its own augumented implementation. For this to work we would have to add ACF logic to our plugin. Another solution which you could do without waiting for us to implement anything is to use a custom template, see this thread: Customfields name or label | www.ads-software.com

    Thread Starter Carlos Pinedo

    (@carlos-pinedo)

    Thanks for answering, I’ll read the thread

    Thread Starter Carlos Pinedo

    (@carlos-pinedo)

    The instructions and code of inula (@janetb) works really well:

    Delete the following line from your custom template:

    $lcp_display_output .= $this->get_custom_fields($post);

    Replace for every customfield with:

    $field_object = get_field_object( 'Met', $post->ID );
    $lcp_display_output .= $field_object['label'];
    $lcp_display_output .= $field_object['value'];

    Again, where Met is the name of the customfield

    Thread Starter Carlos Pinedo

    (@carlos-pinedo)

    However, it doesn’t work if the field is of the ‘Select multiple values’ type. In that case, you get the term ‘Array’ instead of the value of the field.

    Plugin Contributor zymeth25

    (@zymeth25)

    You can do this with “Select multiple values”, always refer to ACF documentation when dealing with their custom fields.

    https://www.advancedcustomfields.com/resources/select/#display-multiple-values

    Thread Starter Carlos Pinedo

    (@carlos-pinedo)

    Thanks for all the help zymeth25?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘ACF “Select field” label not appearing as it should’ is closed to new replies.