Site icon Hip-Hop Website Design and Development

Present in an entry a Customized Submit Sort related to a submit

That is the data of my downside:

Applied sciences used: Divi Theme – WordPress

Scope:
Present an Superior Customized Area of kind post_object associated to a selected submit.

Particulars:

What I want:
I need to present within the entry of every information submit the nation related to that entry. When I attempt to use Divi’s dynamic content material I get the error: "Object of class WP_Post could not be converted to string".

My code:
I’ve made this shortcode nevertheless it reveals me an inventory of nations and does not present the nation assigned to the customized submit kind within the submit entry. Within the picture, you may see what I would like together with what I’ve for the time being.

See the Picture

That is my code:

    add_shortcode( 'showpost', 'display_custom_post_type' );

    perform display_custom_post_type(){
        $args = array(
            'post_type' => 'nations',
            '$post->ID'
        );

        $string = '';
        $question = new WP_Query( $args );
        if( $query->have_posts() ){
            $string .= '<ul>';
            whereas( $query->have_posts() ){
                $query->the_post();
                $string .= '<li>' . get_the_title() . '</li>';
            }
            $string .= '</ul>';
        }
        wp_reset_postdata();
        return $string;
    } 

Any concepts?