Certificate instructor custom field shortcode

Add the given code in your wplms-customizer.php file in wplms-customizer plugin :

if (!function_exists('vibe_certificate_inst_field')) {
    function vibe_certificate_inst_field( $atts, $content = null ) {
            extract(shortcode_atts(array(
                'field'      => '',
            ), $atts));
            $cid=$_GET['c'];
            $inst_id=get_post_field('post_author',$cid);
            if(isset($inst_id) && is_numeric($inst_id) && isset($field) && strlen($field)>3)
                return bp_get_profile_field_data( 'field='.$field.'&user_id=' .$inst_id);
            else
                return '[certificate_instructor_field]';
    }
    add_shortcode('certificate_instructor_field', 'vibe_certificate_inst_field');
}

ANd the use the shortcode :

[certificate_instructor_field field=”your-custom-field”]

Leave a Reply

Your email address will not be published. Required fields are marked *