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

I would like to show a widget (implemented inside a plugin) on a custom page (implemented inside another plugin).

I do not want to select the option : "Show widget in this position on all available pages"

I would not like to modify the "custom page" code to force it displaying the widget.

I'd like to have the custom page displayed inside the Admin-->Layout--->Available widgets ---> My widget ---> add widget ---> "Show widget in this position on the following pages" list

The custom page should appear on this list of pages (for my widget but also for other widgets).

If I'm not wrong  the clean solution would be that of extending the templatelangkeys array containing the "templates", to add my custom page.

But I've read here an "old" Gideon's answer to another user, saying that "there is currently no easy way to do this".

Isn't there a way to add a custom page to that list ?

 

 

Q2A version: 1.6.2
by
Thanks Scott.
I had read that post, but it's a solution (the Kai's one) that requires that you modify the page code to include the plugin (and "force" it to show inside it).
I would like that the custom page is displayed here :
Admin-- Layout -- Available widgets -- My widget -- add widget -- "Show widget in this position on the following pages".

I've not tried your solution but Kai said that it does not add the custom page at that list ....
by
Don't you think that the q2a core should allow it ? ;-)

1 Answer

+3 votes
by

Yes I see the problem. Widgets can be added to custom pages, but not those from a page plugin (unless you modify the plugins to allow it).

The problem comes down to two places in the code:

  1. qa-page-admin-widgets.php line 112 - there is a check to make sure page plugins aren't listed there.
  2. qa-page.php line 626 - the problem here is that $qa_template is 'plugin' and not the specific page key (such as custom-2).

I will take a look into this for a future Q2A version. I may integrate my Widget Anywhere plugin (in the sense of allowing custom HTML widgets at any locations, not just the 5 or so in Admin>Layout) so will tackle it then.

by
Thanks, speaking about the core, it should be very useful to be able to assign a widget to **every** page I'm using in q2a via the admin-->Layout panel (and not only to the "standard" ones).
Speaking about your plugin, I've tried it too yesterday: I could insert a page slug for custom-pages (great) but I could only use html to insert the widget....
It would be nice if I could have a droplist with the list of available widgets already registered in q2a ... :-)
by
Any update about this feature for the plugin widget anywhere ? This plugin currently allows to put some HTML anywhere but it doesn't allow to put the widget of another plugin anywhere.
...