If you’d like to display all custom fields after the content on a single post, you can use the following code snippet to automatically hook the shortcodes:
function add_custom_fields_to_single_post( $content ) {
if ( is_single() && in_the_loop() && is_main_query() ) {
// Append custom field shortcodes after the content
$content .= do_shortcode('[your_custom_field_shortcode]');
// Add more shortcodes for other fields if necessary
$content .= do_shortcode('[your_another_custom_field_shortcode]');
}
return $content;
}
add_filter( 'the_content', 'add_custom_fields_to_single_post' );
