I created the a text field in which I can add url of pdf file. Now I'm trying to show it on every post after the content but it only shows the button but not the content. If I remove the_content from add_action, it shows the content but not the download pdf button.
add_action( 'the_content', 'show_download_url' );
function show_download_url() {
$download_pdf = get_post_meta( get_the_ID(), 'download_pdf', true );
if ( $download_pdf ) {
printf( '<a href="%s" class="btn btn-primary">Download PDF</a>',
esc_url( $download_pdf )
);
}
}