Version Description
Download this release
Release Info
Developer | anmari |
Plugin | amr shortcode any widget |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- amr_shortcode_any_widget.php +7 -5
- readme.txt +35 -8
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- screenshot-4.jpg +0 -0
- screenshot-1.png → screenshot-5.png +0 -0
- screenshot-2.png → screenshot-6.png +0 -0
- screenshot-3.png → screenshot-7.png +0 -0
- screenshot-8.jpg +0 -0
- screenshot-9.jpg +0 -0
amr_shortcode_any_widget.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
/*
|
3 |
Plugin Name: amr shortcode any widget
|
4 |
Plugin URI: http://webdesign.anmari.com/shortcode-any-widget/
|
5 |
-
Description:
|
6 |
Author: anmari
|
7 |
-
Version: 1.
|
8 |
Author URI: http://webdesign.anmari.com
|
9 |
|
10 |
*/
|
@@ -23,6 +23,7 @@ if it is in, then get the instance data and use that */
|
|
23 |
|
24 |
if (isset($_wp_sidebars_widgets) ) {
|
25 |
if ($debug) {
|
|
|
26 |
echo '<br />Attributes entered:<br />';
|
27 |
var_dump($atts);
|
28 |
echo '<br />Available sidebars and widgets<br />';
|
@@ -72,7 +73,7 @@ if it is in, then get the instance data and use that */
|
|
72 |
foreach ($wp_registered_widgets as $i => $w) { /* get the official internal name or id that the widget was registered with */
|
73 |
if ($w['id'] === $id) $widget_ids[] = $id;
|
74 |
}
|
75 |
-
if ($debug) {echo '<h2>We have an id: '.$id.'</h2>'; var_dump($widget_ids);}
|
76 |
}
|
77 |
else {
|
78 |
if ($debug) { echo 'No valid widget name or id given';}
|
@@ -107,8 +108,9 @@ if it is in, then get the instance data and use that */
|
|
107 |
if (!($sidebarid = get_sidebar_id ($sidebar))) $sidebarid=$sidebar; /* get the official sidebar id - will take the first one */
|
108 |
|
109 |
if ($debug) {
|
|
|
110 |
echo '<hr>Looking for widget with name:'.$widget.' or id='.$id.' Found instances:'.' <br />';
|
111 |
-
foreach ($widget_ids as $i=> $w) {
|
112 |
echo $w.'<br />';
|
113 |
};
|
114 |
}
|
@@ -136,7 +138,7 @@ if it is in, then get the instance data and use that */
|
|
136 |
if ($debug) {echo '<br />Sidebar '.$sidebar.'with sidebarid '.$sidebarid.' empty or not defined.'; }
|
137 |
}
|
138 |
|
139 |
-
|
140 |
if (empty ($wid)) {
|
141 |
if ($debug) { echo '<h2>No Widget ids in sidebar '.$sidebarid.' with name '.$sidebar.' Try defaults </h2>';}
|
142 |
unset($sidebar); unset($sidebarid);
|
2 |
/*
|
3 |
Plugin Name: amr shortcode any widget
|
4 |
Plugin URI: http://webdesign.anmari.com/shortcode-any-widget/
|
5 |
+
Description: Include any widget in a page for any theme. [do_widget widgetname ] or [do_widget "widget name" ]. If upgrading see changelog. Can be very powerful eg: with queryposts widget it can bceome a templater.
|
6 |
Author: anmari
|
7 |
+
Version: 1.4
|
8 |
Author URI: http://webdesign.anmari.com
|
9 |
|
10 |
*/
|
23 |
|
24 |
if (isset($_wp_sidebars_widgets) ) {
|
25 |
if ($debug) {
|
26 |
+
echo '<h3>DEBUG on: Please scroll down till you find the shortcodes sidebar.</h3>';
|
27 |
echo '<br />Attributes entered:<br />';
|
28 |
var_dump($atts);
|
29 |
echo '<br />Available sidebars and widgets<br />';
|
73 |
foreach ($wp_registered_widgets as $i => $w) { /* get the official internal name or id that the widget was registered with */
|
74 |
if ($w['id'] === $id) $widget_ids[] = $id;
|
75 |
}
|
76 |
+
if ($debug) {echo '<h2>We have an id: '.$id.'</h2>'; if (!empty($widget_ids)) var_dump($widget_ids);}
|
77 |
}
|
78 |
else {
|
79 |
if ($debug) { echo 'No valid widget name or id given';}
|
108 |
if (!($sidebarid = get_sidebar_id ($sidebar))) $sidebarid=$sidebar; /* get the official sidebar id - will take the first one */
|
109 |
|
110 |
if ($debug) {
|
111 |
+
if (empty($widget)) $widget = '';
|
112 |
echo '<hr>Looking for widget with name:'.$widget.' or id='.$id.' Found instances:'.' <br />';
|
113 |
+
if (!empty($widget_ids)) foreach ($widget_ids as $i=> $w) {
|
114 |
echo $w.'<br />';
|
115 |
};
|
116 |
}
|
138 |
if ($debug) {echo '<br />Sidebar '.$sidebar.'with sidebarid '.$sidebarid.' empty or not defined.'; }
|
139 |
}
|
140 |
|
141 |
+
$output = '';
|
142 |
if (empty ($wid)) {
|
143 |
if ($debug) { echo '<h2>No Widget ids in sidebar '.$sidebarid.' with name '.$sidebar.' Try defaults </h2>';}
|
144 |
unset($sidebar); unset($sidebarid);
|
readme.txt
CHANGED
@@ -1,15 +1,35 @@
|
|
1 |
=== amr shortcode any widget ===
|
2 |
Contributors: anmari
|
3 |
-
Tags: shortcode widget page
|
4 |
-
Tested up to: 3.
|
5 |
-
Version: 1.
|
6 |
Stable tag: trunk
|
7 |
|
8 |
== Description ==
|
9 |
-
This simple 'utility' plugin allows one to have any widget used in a page shortcode in any theme - no need to use the hybrid theme or create a special template. For more details see [anmari.com](http://webdesign.anmari.com/category/plugins/shortcode-any-widget/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
== Changelog ==
|
|
|
|
|
|
|
|
|
13 |
= Version 1.3 =
|
14 |
* Added debug link and retested. Added readme.
|
15 |
|
@@ -28,7 +48,8 @@ This simple 'utility' plugin allows one to have any widget used in a page shortc
|
|
28 |
== Installation ==
|
29 |
|
30 |
0. Activate plugin
|
31 |
-
1.
|
|
|
32 |
2. Add [do_widget id=widgetid] in a page or post
|
33 |
3. If it fails, click on the debug prompt and look for the id of your widget, use that.
|
34 |
|
@@ -39,7 +60,13 @@ If you use a widget more than once for different shortcodes, you can use the wid
|
|
39 |
|
40 |
== Screenshots ==
|
41 |
|
42 |
-
1.
|
43 |
-
2.
|
44 |
-
3.
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
1 |
=== amr shortcode any widget ===
|
2 |
Contributors: anmari
|
3 |
+
Tags: shortcode, widget, page, templates, page template
|
4 |
+
Tested up to: 3.3.1
|
5 |
+
Version: 1.4
|
6 |
Stable tag: trunk
|
7 |
|
8 |
== Description ==
|
9 |
+
This simple 'utility' plugin allows one to have any widget used in a page shortcode in any theme - no need to use the hybrid theme or create a special template. You could use the query posts widget in the page to create a archive within a page, or the rss widget to list feed content from other sites. For more details see [anmari.com](http://webdesign.anmari.com/category/plugins/shortcode-any-widget/)
|
10 |
+
|
11 |
+
1. Test chosen widget works in normal sidebar first.
|
12 |
+
2. Activate this plugin
|
13 |
+
3. Go to Appearance > widgets and find "shortcode" sidebar
|
14 |
+
4. Drag chosen widgets from configured sidebar to shortcodes sidebar. Save.
|
15 |
+
5. Go to page where you want configured widget to appear
|
16 |
+
6. enter one of:
|
17 |
+
[do_widget widgetname] eg: [do_widget calendar]
|
18 |
+
[do_widget "widget name"]. eg: [do_widget "tag cloud"]
|
19 |
+
[do_widget id=widgetid] in a page or post
|
20 |
+
7. If the plugin cannot work out what you want, it will show a debug prompt
|
21 |
+
, click on the debug prompt and look for the id of your widget in the shortcodes sidebar (you may have to scroll through a lot of debug nfo). Try with the id. Sometimes the widget name that wordpress calls it internally is not the same as what you see on the screen and you willneed the 'debug' to find the id.
|
22 |
+
|
23 |
+
Plugin has been tested with most standard widgets (rss feeds, tag cloud, pages, meta, search, and of course my own plugins widgets - upcoming events list, calendar and user lists.
|
24 |
+
|
25 |
+
If you use a widget more than once for different reasons, you may need to use the widget id to isolate which widget instance and it's settings to use. ie: [do_widget id=categories-6] . If you just use the name, it will display all widgets in the shortcode sidebar with that name (all instances).
|
26 |
|
27 |
|
28 |
== Changelog ==
|
29 |
+
= Version 1.4 =
|
30 |
+
* Updated readme - made very detailed steps and added some screen shots.
|
31 |
+
* Tested on wp 3.3.1 and fixed some notices when bad parameters entered.
|
32 |
+
|
33 |
= Version 1.3 =
|
34 |
* Added debug link and retested. Added readme.
|
35 |
|
48 |
== Installation ==
|
49 |
|
50 |
0. Activate plugin
|
51 |
+
1. Goto Appearance > widgets and find "shortcode" sidebar
|
52 |
+
1. Drag chosen widgets to shortcodes sidebar. Save. (note the names)
|
53 |
2. Add [do_widget id=widgetid] in a page or post
|
54 |
3. If it fails, click on the debug prompt and look for the id of your widget, use that.
|
55 |
|
60 |
|
61 |
== Screenshots ==
|
62 |
|
63 |
+
1. setting up widgets in page (must be in the shortcode sidebar)
|
64 |
+
2. widgets in a page
|
65 |
+
3. setting up widgets in the shortcode sidebar
|
66 |
+
4. two rss feed widgets in shortcode sidebar - both will show if just name used
|
67 |
+
5. Demonstration of two widgets being used via the do_widget short code.
|
68 |
+
6. The Page or post with the do_widget shortcodes
|
69 |
+
7. The shortcode sidebar. The widget's user interface (UI) is used to provide a UI for the do_widget shortcode.
|
70 |
+
8. Debug prompt if one enters something like id=junk
|
71 |
+
9. Debug messages - scroll down till you see the shortcodes sidebar - the widgets and their ids will be listed. Use the id of the widet you want.
|
72 |
|
screenshot-1.jpg
ADDED
Binary file
|
screenshot-2.jpg
ADDED
Binary file
|
screenshot-3.jpg
ADDED
Binary file
|
screenshot-4.jpg
ADDED
Binary file
|
screenshot-1.png → screenshot-5.png
RENAMED
File without changes
|
screenshot-2.png → screenshot-6.png
RENAMED
File without changes
|
screenshot-3.png → screenshot-7.png
RENAMED
File without changes
|
screenshot-8.jpg
ADDED
Binary file
|
screenshot-9.jpg
ADDED
Binary file
|