Show custom field, meta field… of the current post/page

Content Views Pro helps you to show custom field, meta field… of current post in single post page with 2 steps:

  1. create a new View, select custom fields and meta fields you want to show.

    Especially, you might need to select the option All / Multi post types for Filter Settings > Content Type to match the post type correctly and automatically.
  2. show the View:
    • To show for specific posts only, please edit these posts, then add below shortcode to text editor:
      [pt_view id="VIEW_ID" post_id="GET_CURRENT"]
      
    • To show for each of all posts, please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):
      // Content Views Pro - show related posts for each post
      add_filter( 'the_content', 'cvp_theme_show_info_of_current_post', 999 );
      function cvp_theme_show_info_of_current_post( $content ) {
      	if ( is_single() ) {
      		ob_start();
      		echo do_shortcode( '[pt_view id="VIEW_ID" post_id="GET_CURRENT"]' );
      		$content .= ob_get_clean();
      	}
      	return $content;
      }
      

    Please replace VIEW_ID in above code with ID of the View in step 1.

Best regards,

Scroll to Top