Search for Resources and Solutions

How to create pages in the Midrub Settings component

Sinche Midrub 0.0.7.0 was added the possibility to create pages in the Midrub Settings component with hooks. Since Midrub 0.0.8.2 was improved the option to add pages in Midrub Settings component and now you add pages in same way like pages for the Midrub Team component(i mean same structure and parameters). I'm going to use this structure in future for all user's components which as multiple pages.

If you want to add new pages, you have to use the function set_user_settings_page, which has these parameters:

set_user_settings_page (

    'page slug',

    array(

        'page_name' => 'page name',

        'page_icon' => 'icon is optionally',

        'content' => 'the function name which will provide content for the page',

        'css_urls' => array(

            array('stylesheet', 'CSS URL', 'text/css', 'all')

        ),

        'js_urls' => array(

            array('JAVASCRIPT URL')

        )  

    )

);

You can add as many CSS and JAVASCRIPT links as you want. 

In the video below you can see how this works:


The function set_user_settings_page can be used in apps, themes, components and even plugins.

Was this article helpful?