How to display custom field name & label_description in template?

Support General How to display custom field name & label_description in template?Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16181
    brandonjpbrandonjp
    Participant

    I have a Custom Post Type called "job" and it has a custom field called "start_date" like so:

    
                array (
                    'id' => $prefix . 'start_date',
                    'type' => 'date',
                    'name' => esc_html__( 'APEX Start Date', 'text-domain' ),
                    'label_description' => esc_html__( '(Estimated)', 'text-domain' ),
                    'autocomplete' => 'off',
                ),
    

    In my theme, I have a template file called single-job.php and I can display the actual value from the DB using <?php echo rwmb_meta( 'end_date' ); ?>

    How can I display the field name & label_description ?

    And is there a support article or any other page with info on this? I couldn't find anything.

    Thanks, as always!
    --bp

    #16218
    brandonjpbrandonjp
    Participant

    I figured this out by using:

    <?php echo rwmb_get_field_settings( 'end_date' )['name']; ?>
    to display the field's Label (from the General tab)

    <?php echo rwmb_get_field_settings( 'end_date' )['desc']; ?>
    to display the field's Description (from the General tab)

    <?php echo rwmb_get_field_settings( 'end_date' )['label_description']; ?>
    to display the Label Description (under the Appearance tab)

    <?php echo rwmb_meta( 'end_date' ); ?>
    to display the field's value stored in the DB

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