Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
631 views
in Plugins by

I have created a page module plugin (landing-page) and a widget plugin (recent-questions) and I need to call the widget into the page. My page doesn't list on Add Widget pages section as it is created via module plugin. I have to check "Show widget in this position on all available pages" to make it visible on landing page module. But it will make it visible on all pages I will create in future. Please guide. My code is:

Landing page plugin registration
qa_register_plugin_module('page', 'qa-teenmesh-landing-page.php', 'qa_teenmesh_landing_page', 'Teenmesh Home');

Recent Questions plugin registration
qa_register_plugin_module('widget', 'qa-teenmesh-recent-questions.php', 'qa_teenmesh_recent_questions', 'Teenmesh Recent Questions');

Widget code

function allow_template($template) {
    return ($template == "plugin");  // any other page type didn't worked
 }
function allow_region($region) {
    return ($region == "main");
}
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) {
    $themeobject->output("<p>Hello</p>");
}

 

Q2A version: 1.5.3

Please log in or register to answer this question.

...