0

I created a custom media control (WP_Customize_Media_Control) into which I upload a file.

I want to give it a specific ID so I can refer to it in various places in my theme.

Is it possible to do so? If so, how?

Thanks a lot in advance! This is literally the most important user file in my theme.

enter image description here

0

The setting associated with the media control will have the ID for the attachment stored as its value. Assuming you have registered a setting for your control like this:

$wp_customize->add_setting( 'resume', array(
    'type' => 'option',
    // ...
) );

Then you would obtain the attachment ID just by reading from the option, like: get_option( 'resume' ).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.