Custom Fields
Support MB Custom Post Type Display CPT Entries on Front-End Page

  • This topic is empty.
  • Creator
  • #17504
    Nick Thomas


    I just purchased Meta Box Developer Bundle and had a couple questions regarding displaying custom post types on the front-end for visitors to view and search.

    I am new to PHP programming and am stuck on what to change in the gist PHP code provided from your example on and what the next steps are after adjusting the code.

    I have created a Meta Box [Title: New Profile, ID: new-profile] (Custom Fields/Field Groups) that uses the fields 'Name [ID: name1] (text field)', 'Email [ID: email1] (email field)' and 'Bio [ID: bio1] (textarea field)'.

    This is displayed on the front-end using the shortcode: [mb_frontend_form id="new-profile" edit="true" allow_delete="true" post_fields="title,thumbnail"]. I have also created a custom post type (Profiles) and adjusted the settings within the form (Meta Box) for this post type.

    The Meta Box accepts new entries properly on the front-end and displays the entries (new Profile posts) in the WordPress admin dashboard. I now wish to display all of these custom post entries on the front-end within a page that allows visitors to view and search entries.

    I have created a file named single-profiles.php and copied the gist PHP provided (see code below) into it, but am unsure of what needs to be adjusted within the code and what my steps are after this to show custom post entries on the front-end.

    Our theme uses Visual Composer and not Elementor, so I cannot follow the steps provided in this guide to display the entries either -

    Any help that you can provide on this matter would be greatly appreciated. Thank you in advance!

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array (
            'title' => 'New Profile',
            'id' => 'new-profile',
            'post_types' => array(
                0 => 'profile',
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => $prefix . 'name1',
                    'type' => 'text',
                    'name' => esc_html__( 'Name', 'text-domain' ),
                    'required' => 1,
                array (
                    'id' => $prefix . 'email1',
                    'name' => esc_html__( 'Email', 'text-domain' ),
                    'type' => 'email',
                    'required' => 1,
                array (
                    'id' => $prefix . 'bio1',
                    'type' => 'textarea',
                    'name' => esc_html__( 'Bio', 'text-domain' ),
        return $meta_boxes;
  • You must be logged in to reply to this topic.