Follow below steps to create custom PDF upload field in custom post type:
- Install Advance Custom Field from wordpress.org
- Go to Custom Fields and click on Add New button.
- Follow instructions in below screenshot to add the custom field to upload PDF file.
-
Use below code to display content on post type template.
$pdf_file = get_field('pdf_upload'); if( $file ) { echo '<a href="'.$pdf_file.'">Download File</a>'; }
Reference Documentation: https://www.advancedcustomfields.com/resources/file/
Hope this helps..!!