Custom Fields
Re-Envisioned
Support General Displaying Taxonomy Advanced / Select Advanced field in front end

  • Creator
    Topic
  • #29916
    Resolved Darren Miller
    Participant

    I'm having trouble displaying my field in the front end. It's a Taxonomy Advanced field, and the field type is Select Advanced.

    I'm using this code to display on the front end:

    <?php
        $terms = rwmb_meta('taxonomy_ws852srw3v');                                    
        echo $terms;
    ?>

    But the front end just shows "Array"

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #29930
    Long Nguyen
    Moderator

    Hi Darren,

    That means you need to use a loop to iterate through the array elements to get terms. Please get more details here https://docs.metabox.io/fields/taxonomy-advanced/#template-usage

    #29937
    Darren Miller
    Participant

    Thanks for the quick response!

    I changed the code to this, but now it's not rendering anything at all:

    <?php
        $terms = rwmb_meta('taxonomy_ws852srw3v');                                    
    if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
        foreach ( $terms as $term ) {
            echo '<p>', $term->name, '</p>';
        }
    }
    ?>
    #29938
    Darren Miller
    Participant

    Also is it possible to get this to work using the shortcode within the main content area on a page? I wasn't able to get this working with the shortcode either so I'm kind of trying all avenues here, but ultimately the shortcode option would be ideal for me.

    Ultimately I'm trying to display the custom field info for a certain page within a block using the Kadence theme/blocks framework....

    #29939
    Darren Miller
    Participant

    Wait, I think I figured it out! I was using the Taxonomy's metabox in the page editor UI, and NOT the custom field's metabox, and so the custom field didn't register that anything was selected! I removed the taxonomy metabox from the page editor UI, and it displays properly when I check boxes in the custom field UI now.

    Now I just have to style this thing...

    Thanks for the patience here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.