Search for Resources and Solutions

How to add a media option in the Frontend's settings

You have to read this article only if you're understanding already how to add Settings pages in the Frontend Component from the Administrator's panel https://www.midrub.com/articles/how-to-add-new-settings-pages-for-the-frontend-features

At the begin Midrub had two logos, for login and dashboard. In 2019 i've added support for themes and the logo has become optional. Each theme could have or no a logo. Is optionally and you can add the logo's option in the Frontend Settings by using the function get_option_media.

The function get_option_media has these parameters:

get_option_media(

    'An unique slug.',

    array(

        'words' => array(

            'placeholder' => 'Text for placeholder.'

        )

    )

);

The data will be saved in the options table with the slug as option's key. To call it in the theme or where you need, just use the function get_option('slug').

The media option is based on the Administrator Multimedia Gallery. But you can enter even external urls for your media.

Was this article helpful?