0
votes
1answer
15 views

Which wordpress function is the caption shortcode linked to?

I have used this code in my page content to try and output an image + caption with a custom caption class and id... [caption id="my-caption-id" class="my-caption-class" align="alignnone" ...
1
vote
3answers
76 views

Checking if an attribute exists in a shortcode

I've written a small plugin that spits out html for a button. It works great, except for one thing: If the user doesn't specify an image, the image appears broken. Is there a way for me to check and ...
0
votes
1answer
28 views

Shortcode displays only default attribute values

For some reasons every shortcode, that I try to add to functions.php, displays only default attribute value and ignores what I specify in a post. E.g.: function my_shortcode( $atts ) { extract( ...
0
votes
0answers
101 views

Using get_terms() as shortcode attribute

Hop you pepople would be fine. I'm creating a shortcode with the following code. $categories = get_terms( 'project-type' ); foreach ($categories as $category) { ...
0
votes
1answer
103 views

Passing variable in nested shortcodes

How can I pass style attribute of [boxes] shortcode to [box] shortcodes without using global variables? I don't want to use global variables, because I saw on a few articles that using global ...
2
votes
1answer
297 views

Get multiple shortcode attribute values

I'm trying to get several values from a shortcode. I tried several things without success. The shortcode looks like this: [myshortcode metakey="<field_key:key1, title:Title ...
2
votes
2answers
720 views

Pass boolean value in shortcode

In WordPress shortcodes, how can I pass boolean attributes? Both of [shortcode boolean_attribute="true"] or [shortcode boolean_attribute=true] are giving string values. EDIT There would be no ...
2
votes
2answers
105 views

How to handle valueless attributes in shortcodes?

Some HTML elements accept valueless attributes such as <input disabled /> or <video autoplay /> How do I handle this case with shortcodes where I want to disable autoplay by default (= ...
2
votes
2answers
1k views

Automatically add this attribute to the gallery shortcode

When inserting a gallery it adds the following shortcode: [gallery columns="6" ids="18,150,146,23,147,17,21,20,22"] I would like it to automatically add link="file" as the last attribute, whenever ...
0
votes
3answers
1k views

Escaping quotes from shortcode attributes

I have been trying to figure out how to escape quotes (single and double) from shortcode attributes. Basically the content is written by the user and therefore can potentially include " and ' quotes. ...
2
votes
1answer
70 views

getting values from a shortcode with an include

I have a checked a few links but nothing seems to for me in getting the attribute value of a shortcode so that I can use it in a condition. function bf_shortcode_slideshow($atts) { ...
2
votes
1answer
252 views

wpautop() when shortcode attributes are on new lines break args array

I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines - to make it more readable to content editors: [component attr1 ="value1" ...
1
vote
3answers
636 views

Caption shortcodes not including caption as attribute

I recently installed the bonpress theme and am having trouble with the captions showing correctly. The more I try to understand how captions are supposed to work in Wordpress, the more I suspect ...
1
vote
2answers
1k views

Remove width and height attributes from [gallery] output

WordPress automatically adds the width and height attributes to [gallery] shortcode images. How to delete these attributes? Something like this but for [gallery] output.