Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   Where does the shortcode for a custom widget go? (http://forum.bytesforall.com/showthread.php?t=15987)

jms5017 Nov 16, 2011 02:49 PM

Where does the shortcode for a custom widget go?
 
From this thread
http://forum.bytesforall.com/showthr...dget+shortcode

It says: "Once you have created the new widget area, copy paste the shortcode [FrontpageSlideshow] into the widget."

I have a custom widget in my header area fine. Now I am trying to add the shortcode. Where the heck does the short code go? The plugin is wp-imageflow2 and the gallery has been uploaded to
wp-content/galleryimageflow2???

juggledad Nov 16, 2011 02:58 PM

do you have a custom widget or a custom widget AREA? if you have a new widget area, then you need to add some widget not it. You might need a text widget in this situation

jms5017 Nov 16, 2011 04:18 PM

I think I have a custom widget area called my_header_widget to which I added a text widget,
then tried adding the shortcode to the text widget.
The result of doing that was the shortcode appeared on the page exactly as I entered it instead of the gallery. I've been looking on the internet and I found this suggestion from stephanie leary who writes books about wordpress.


"Shortcodes are bracketed placeholders you can use while editing your content
that will be replaced with some other, more complicated content (like an embedded video or image
gallery) when your post is displayed to visitors. Unfortunately, shortcodes are processed only in
post/page content. You can use them in text widgets, however, if you enable theme in the theme
functions as shown in Listing 6-39.

Listing 6-39. Enabling shortcode parsing in text widgets
add_filter('widget_text', 'shortcode_unautop');
add_filter('widget_text', 'do_shortcode');
The first line ensures that a shortcode placed by itself on its own line won’t be surrounded by
paragraph tags. The second line actually parses the shortcode.

I added the two lines of code to the themes functions.php file
but that didn't work either.

the images for the plugin which is wp-imageflow2 are in wp-content/galleryimageflow2
and the shortcode I tried was [wp-imageflow2 dir=wp-content/galleryimageflow2]
Help is greatly appreciated.

jms5017 Nov 16, 2011 04:20 PM

site is jkstest.info

lmilesw Nov 16, 2011 05:54 PM

A shortcode cannot be natively used in the standard text widget. To use a shortcode in a widget you either need to install a plugin that "enables" that option such as Shortcodes in Sidebar Widgets or using code like
PHP Code:

<?php echo do_shortcode('[your shortcode]'); ?>

in a php aware widget such as Linkable Title Html and Php widget.

jms5017 Nov 16, 2011 06:39 PM

I've installed the "shortcodes in sidebar widget" as you suggested.The gallery still doesn't show up.

How do i know if I have a "php aware" widget to attempt to try to figure out where I would insert the
<?php echo do_shortcode('[your shortcode]'); ?>
code that you suggest?

The widget area is My_header_widget.

lmilesw Nov 16, 2011 07:06 PM

The Linkable title widget I mentioned is a php aware widget.


All times are GMT -6. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.