How to create shortcode to display custom field value on a custom post type

You’ll have to use add_shortcode to achieve this. Let’s say that you want this shortcode to be called “my_cf”:

function my_cf_shortcode_callback( $atts ) {
    $atts = shortcode_atts( array(
        'post_id' => get_the_ID(),
    ), $atts, 'my_cf' );

    return get_post_meta( $atts['post_id'], <FIELD_NAME>, true );
}
add_shortcode( 'my_cf', 'my_cf_shortcode_callback' );

Now you can use it by putting [my_cf] or [my_cf post_id=POST_ID] to your posts.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)