redux-framework icon indicating copy to clipboard operation
redux-framework copied to clipboard

No docs on how to include in plugin

Open derekashauer opened this issue 12 years ago • 17 comments

Yes, there is http://docs.reduxframework.com/redux-framework/advanced/embed/

But this does nothing. When I do all this, nothing appears. No sample options appear anywhere. I also need to make the settings as a submenu of my plugin's menu page and there is no info on how to do this. Is it me or is getting started documentation completely useless?

derekashauer avatar May 08 '14 04:05 derekashauer

Well, I wrote the docs, so I don't consider them completely useless, thanks. Did you read this? http://docs.reduxframework.com/redux-framework/getting-started/

kprovance avatar May 08 '14 04:05 kprovance

Also, at the top of the new issue window you just filled out, you skipped over this link (https://github.com/ReduxFramework/redux-framework/blob/master/CONTRIBUTING.md). Please read it now and reply with the necessary information, should the previous post not work out for you.

kprovance avatar May 08 '14 04:05 kprovance

I have read every documentation page available and absolutely nothing gets this thing to do anything. I've been trying to do this for 3 hours just to get the sample options to appear and beyond frustrated.

Version 3.2.8 WordPress 3.9 dev_mode? Embedded in plugin

Folder for Redux is admin/ReduxFramework Code to embed in admin/sunshine-admin.php is below:

if (!class_exists('ReduxFramework') && file_exists(dirname(FILE).'/ReduxFramework/ReduxCore/framework.php')) { require_once(dirname( FILE ) . '/ReduxFramework/ReduxCore/framework.php'); } if (!isset($redux_demo) && file_exists(dirname(FILE).'/ReduxFramework/sample/sample-config.php')) { require_once(dirname( FILE ) . '/ReduxFramework/sample/sample-config.php'); }

I put some extra echo statements in framework.php and sample-config.php to verify they are getting loaded - they are.

derekashauer avatar May 08 '14 05:05 derekashauer

How about you try the generator? http://generator.reduxframework.com/

It works for countless others. Not sure what to tell you. The generator will get you started quick. Just export an admin folder. ;)

dovy avatar May 08 '14 05:05 dovy

Issue was I load sunshine-admin.php in an init action. Moving out of the init action finally got it to load. Still no idea on how to add it as a submenu to my plugin though.

derekashauer avatar May 08 '14 05:05 derekashauer

Ok, so yes. ReduxFramework runs before init. It runs the moment you call it. That way you can access the global variable from within your functions.php.

What do you mean add it as a submenu to your plugin?

dovy avatar May 08 '14 05:05 dovy

With my current options framework, I have it appearing as a submenu for my plugin: http://screencast.com/t/GmoWPgCjG

derekashauer avatar May 08 '14 05:05 derekashauer

First off, little suggestion. Being kind will get you kinder responses. You may be frustrated, but we don't owe you anything. If you're nice we'll help as we have the time.

Second, we have fantastic docs that you need to read more.

http://docs.reduxframework.com/redux-framework/arguments/menu_type/ http://docs.reduxframework.com/redux-framework/arguments/page_parent/

Those should get you what you need.

dovy avatar May 08 '14 05:05 dovy

Apologies for the hostility, as a plugin developer who answers support I know what you mean.

I've tried every possible combination I can think of for those two options and I can never get it to appear under my plugin's main menu. When I use a direct call to add_submenu_page it appears, but then I get "You do not have permission" errors.

In digging into the Redux code, I found the "add_submenu" function. I went through there to see what it is trying to do. My $page_parent is not one of the items in the $test array so it assumes it is a "Network settings and Post type menus". But it shouldn't assume that since it is not in the $test array that it is either network settings or for a post type. My $page_parent is not "settings.php" but it also does not have "?post_type=" either so it fails both these and no menu is added. This is for my own custom menu "sunshine_admin" added by "add_menu_page". Redux doesn't appear to allow this.

derekashauer avatar May 08 '14 05:05 derekashauer

Ahhhh. Good point. Skype me sometime. Dovydigital. Maybe you can help us solve that. ;)

dovy avatar May 08 '14 05:05 dovy

I appreciate that too. I know it can be frustrating playing with someone else's code.

I am sure we can find a solution for the menu stuff. Shouldn't be too hard.

dovy avatar May 08 '14 06:05 dovy

I thought we fixed this.

This is a layman breakdown of what we've done.

if Test for $page_parent array then
    add_$page_parent_page
else
    if $page_parent != 'settings.php' then
        // Check for ?post_type via strpos
        If strpos > 0 then
            // do post_type stuff, etc, etc.  Add memu if post type exists
        elseif $page_parent exists in current $submenu array
            // this is where your menu should be added.
            add menu
        endif
    else
        add menu for settings.php
    endif
endif

kprovance avatar May 08 '14 12:05 kprovance

You did fix it. It wasn't showing because i was running my "add_menu_page" action function at level 10 and Redux does the same. Redux got priority because it was called first in my plugin. So the parent_page for my plugin wasn't yet set. I dropped the level of my action function and then it showed and all worked fine.

Rough start but looking forward to fully implementing this.

derekashauer avatar May 08 '14 13:05 derekashauer

Just FYI, user levels were depreciated in WP 3.0 and up. http://codex.wordpress.org/Roles_and_Capabilities

kprovance avatar May 08 '14 14:05 kprovance

Not user level

add_action('admin_menu', 'sunshine_admin_menu', 10); vs add_action('admin_menu', 'sunshine_admin_menu', 0);

derekashauer avatar May 08 '14 14:05 derekashauer

Oh, priority level. Gotcha. My bad.

kprovance avatar May 08 '14 14:05 kprovance

Super glad you got it. ;)

dovy avatar May 08 '14 16:05 dovy