Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
1.8k views
in Q2A Core by

Me and another user cannot add a custom widget to a plugin page. Under: admin -> layout -> add widget the plugin page simply doesn't appear as an option for the widget to appear on and not every admin wants to have a widget: "Show widget in this position on all available pages"

Will this require custom programming to fix on github?

by
Which plugin in this?
by
All plugin pages with any plugin widget are affected (from the limited observation I've made).

1 Answer

+1 vote
by
edited by

Most plugins are set to appear only on certain locations/pages. Something that is designed for a sidebar may not work well at full width at the top of the page.

If you really need to put a widget somewhere else, you can edit the plugin code. Change the allow_template and allow_region functions to simply return true, eg:

function allow_template($template)
{
    return true;
}
function allow_region($region)
{
    return true;
}


Edit: I may have misunderstood, do you want a widget plugin to appear on a custom page plugin? If so, yes you'd need to edit the widget plugin to output on the specific page. You can do that in the output_widget function, like this:

function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
    if ( $template == 'plugin' && $request == 'cusotmpage' )
    {
        // plugin output goes here
    }
}

 

by
Solution: I implemented my widget in the badge-page.php directly:

function process_request($request) {
// ... page code

// WIDGET CALL: we want the best-user-widget also to be displayed on this page
$widget['title'] = "Best Users per Month";
$module=qa_load_module('widget', $widget['title']);
$region = "side";
$place = "high";
$qa_content['widgets'][$region][$place][] = $module;

return $qa_content;
}


cheers :)
by
Thanks echteinfachtv - I'm going to try implementing some code too, so it's good to know what's working and what isn't.
by
There really should be a more sensible way of assigning a widget to a custom plugin page without modifying the pages plugin code. Very strange that.
by
at least it is good to know the way how to do it :)
...