Search code examples
wordpressredux-framework

Redux Framework Add Submenu


I cant get Redux Options Framework working for my plugin. I was trying to add the settings as submenu to my plugin.

I created a simplified demo plugin and could also approve this behaviour.

<?php
/**
 * Plugin Name: Redux sample plugin
 * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
 * Description: A brief description of the Plugin.
 * Version: The Plugin's Version Number, e.g.: 1.0
 * Author: Name Of The Plugin Author
 * Author URI: http://URI_Of_The_Plugin_Author
 * License: A "Slug" license name e.g. GPL2
 */

require_once(plugin_dir_path(__FILE__) . 'inc/admin/admin-init.php'); 

function redux_sample_plugin_log() {
}

function createSettingsMenue() {

        $pluginSlug = 'redux_sample_plugin';
        //create new top-level menu
        add_menu_page('Redux Sample Plugin'),
                        'Redux Sample Plugin',
                        'administrator',
                        $pluginSlug . '_log',
                        'LogMenu'
                                );

        /*add_submenu_page( $pluginSlug . '_log',
                        null,
                        'Im a silly dummy entry',
                        'administrator',
                        'dummy',
                        '__return_null'  );*/
}
add_action( 'admin_menu', 'createSettingsMenue', 9 );

I changed the config to this:

...
    'page_slug' => 'my_plugin_settings',
    'page_title' => 'Settings'
    'menu_type' => 'submenu',
    'page_parent' => 'redux_sample_plugin_log',
...

The Menu is not shown with the code above (case 1 illustration). If you comment in the submenu function call the redux options are shown properely (case 2 illustration). I spent a lot of time but can't get it working. I was that sure it must be a bug that I opened a case at the github issue tracker (#1745) and also provided some additional details. They said I'm likely doing it wrong. Can somebody help me out?

//Edit Added screenshot for both cases

Cases

//Edit This behaviour is fixed in Redux 3.3.9.35. No need for adding another page as workaround any more.


Solution

  • This behaviour is fixed in Redux 3.3.9.35. No need for adding another page as workaround any more.