1) Add this snippet to functions.php
// ========================================================================= // CUSTOMIZER PDF UPLOAD // ========================================================================= function pdf_customize_register( $wp_customize ) { // Add Settings $wp_customize->add_setting('customizer_setting_pdf', array( 'transport' => 'refresh' )); // Add Section $wp_customize->add_section('pdf_section', array( 'title' => __('PDF', 'name-theme'), 'priority' => 70, )); // Add Controls $wp_customize->add_control( new WP_Customize_Upload_Control( $wp_customize, 'customizer_setting_pdf', array( 'label' => __('PDF Upload', 'name-theme'), 'section' => 'pdf_section', 'settings' => 'customizer_setting_pdf', ))); } add_action('customize_register', 'pdf_customize_register');
2) Displaying in the Front End
<a href="<?php echo esc_url( get_theme_mod( 'customizer_setting_pdf' ) ); ?>">Download PDF</a>
Leave a Reply