1
vote
1answer
17 views

Allow shortcode for custom widget

The following code allows shortcode parsing for 'text' widget: add_filter('widget_text', 'do_shortcode'); How to make a similar one for a custom widget? I tried the following one but it didn't ...
0
votes
0answers
11 views

Enqueue script in Widget

I am trying to use wp_enqueue_script inside function widget of the Widget class. But it seems like when I print html it doesn't handle the javascript functions which I enqueue before. This enqueue ...
0
votes
1answer
47 views

Shortcode in Text Widget not working

Not sure why this is not working. I get no errors, but just shows nothing at all in the text widget. The shortcode works on pages and posts. WordPress version 3.9.1 add_filter('widget_text', ...
0
votes
0answers
124 views

Custom Meta Boxes repeatable field show on single.php

I have some code that adds a Metabox, with repeatable fields to the edit screen of the WordPress backend. It looks like this: The code, I have in the functions.php, looks like this: function ...
1
vote
1answer
43 views

How can I whitelist only specific shortcodes for processing in text widgets?

I know that I can use the following filters to enable processing of shortcodes in Text Widgets: add_filter( 'widget_text', 'shortcode_unautop'); add_filter( 'widget_text', 'do_shortcode'); How can ...
0
votes
2answers
48 views

Add Shortcode tag in Widget/Sidebar

I want to add a shortcode tag in the sidebar/widget. I am able to get the required functionality if I add the code in the theme's function.php add_filter('widget_text', 'do_shortcode'); My problem ...
0
votes
1answer
42 views

Transform php shortcode into a widget [duplicate]

I have this bit of php that calls a short code with the date of today in the format i need. <?php $today = date('d.m'); echo do_shortcode('[table id=1 column_widths="10%|10%|80%" ...
0
votes
0answers
220 views

Shortcodes in widget titles: attributes include quotes which are html encoded, why?

I wrote a shortcode plugin that works with widget titles. So I added shortcode support to widget titles like this: add_filter('widget_title', 'do_shortcode'); So my shortcode looks like this: ...
0
votes
1answer
45 views

call widget from within shortcode

I have a shortcode in my functions.php which runs a query on a category. I want to have a twitter feed on this particular page. I have a javscript option working on my page for twitter right now but ...
0
votes
0answers
75 views

How to detect shortcode usage, submit a form from widget to that page?

I've created a plugin and now want to create a widget containing a form that will submit to the page where my plugin shortcode is embedded from any wordpress page on the front end. I assume that ...
0
votes
1answer
87 views

Running a Gallery Shortcode in a Custom Fields Widget

I am creating a website for a Fringe Adelaide Venue, we have planned on displaying a gallery on each artist page. We are already using Custom Fields to place some unique content in a Custom Fields ...
0
votes
1answer
143 views

Can I use widgets & shortcode if I need to return an array?

I'm trying to achieve the following functionality. I have several widget 'areas' that I can place widgets into. I programmed these widget areas into the theme of my site and I can turn them on and ...
0
votes
1answer
217 views

Calling widget using shortcode

I am using shortcode to call a widget. All is working fine but I want to pass some $instance(parameters) to the_widget. I am using $content to pass paramets to the_widget but I dont see any chnages ...
0
votes
1answer
147 views

How do i display the built-in gallery inside a widget?

I want to display a specific gallery (without a plugin = WordPress built-in gallery) inside a widget. I tried the shortcode [gallery ids="717"] but that doesn't work. Maybe a workaround could be ...
1
vote
1answer
287 views

How the widget can be run by shortcode

I have my own widget, that uses WP_Widget class, and executes its code inside function in this class. Is there any ways to run this widget using shortcode inside post? This is how my widget ...
28
votes
4answers
5k views

Where to put my code: plugin or functions.php?

Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php? There are many cases and many debates about that topic, mostly because there are ...
0
votes
1answer
218 views

Create Widget or Enable Shortcodes in Sidebar

I'm well aware that WordPress by default does not process shortcodes in the sidebar. My question is why. I'm building a very small plugin that exports some content when the shortcode is present. This ...
0
votes
1answer
724 views

PHP Widget and do_shortcode

I'm using PHP Widget which allows PHP code to execute from a widget. I tried using this code to execute do_shortcode but it's not rendering <?php $lat = get_field('woo_maps_lat'); $long = ...
3
votes
1answer
60 views

When to use which plugin output method?

I'm a Drupal dev, getting into Wordpress. So far as I can tell there are a few different methods by which a plugin can output content on to a Wordpress site: Shortcode Rewrite API Widget API ...
0
votes
2answers
518 views

page url in shortcode

I have a problem. I'm using a custom shortcode to try to get the url. If the shortcode is inside a post then it gets the post url. When I open the post on a category list, this post shortcode works ...
2
votes
2answers
2k views

Shortcode from a widget is wrapped in unwanted <p> element

I'm using Black Studio TinyMCE Widget as a rich text editor widget. In a sidebar I inserted the TinyMCE widget with a [testimonial] shortcode and some content after it. For example: [testimonial] ...
1
vote
1answer
761 views

check for shortcode in post/pages AND widgets AND template files

For the next version of my plugin www.mapsmarker.com I would like to output the plugin´s css and js-files only if the shortcode [mapsmarker ...] is used. For posts/and pages I already found this ...
1
vote
2answers
375 views

Inserting shortcode [stream /] into a Text widget

hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it. <?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 ...
1
vote
2answers
2k views

the_widget() and widget's ID

Let's assume I have a widget that displays only its name: <p> <?php echo $args['widget_id'] ?> </p> So when I drag & drop my widget to any sidebar it shows: ...
0
votes
1answer
150 views

Shortcode displays always first. Once again

OK, I've had a problem with echoes in my last shortcodem, but everything works fine now. But I have another one: function myWidget_shortcode( $atts ) { extract( shortcode_atts( array( ...
2
votes
1answer
717 views

Custom shortcode in widget forced to top of widget

A custom shortcode i made is being forced to the top of the widget outside of the widget container. Any ideas why? This is my code... function nktmediaplayer_func($atts) { ...