Custom Fields
Re-Envisioned
Support General How to display custom field name & label_description in template?

This topic contains 1 reply, has 1 voice, and was last updated by  brandonjp 3 weeks, 3 days ago.

  • Creator
    Topic
  • #16181
    Resolved
    brandonjp
    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

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #16218

    brandonjp
    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 1 replies (of 1 total)

You must be logged in to reply to this topic.