BB-Code-like mechanism by which strings enclosed in square brackets can serve as shorthand for longer and more complicated strings. These strings are processed by callback handlers, usually on page load, which replace the bracket enclosed string with the output from the callback handler.

learn more… | top users | synonyms (2)

1
vote
2answers
1k views

shortcode to create dynamic dropdown box form shortcode attributes

I am trying to make a shortcode that will create a dynamic dropdown list of downloadable file links, that once selected, html will show a download link below the dropdown. Here is the end result of ...
1
vote
1answer
80 views

Should I cache default WordPress gallery shortcode output?

I'm overriding default WordPress gallery like so: add_filter( 'post_gallery', 'my_gallery_shortcode'), 12, 2 ); function my_gallery_shortcode($output, $attr) { // some modifications ...
1
vote
1answer
51 views

Storing Options in a Shortcode

I am creating a Wordpress plugin. I want to create 1 single shortcode that changes output based on the settings changed by the user on the admin settings page. So for starters, I have something like ...
1
vote
3answers
1k views

Getting attribute value from shortcode

I have this shortcode [learn_more caption="something here:"] [/learn_more] I want to extract the caption value and remove other stuff. "something here:" This is the code that I have, but it ...
1
vote
1answer
195 views

Check if post has gallery images/media

Is there a Wordpress conditional that I can use to check for gallery images/media in a post? I do not want to check if the [gallery] shortcode exist in a post. Attached is a screenshot of what I ...
1
vote
2answers
465 views

do_shortcode() doesn't work if shortcode contained in variable, works if shortcode passed as string

I'm developing a plugin, wherein one of the features is to switch out forms on a specific page by changing the shortcode within a custom field. within my plugin file: function getShort() { ...
1
vote
1answer
194 views

Function to show only first instance of shortcode

I need to add a function to my theme to remove additional instances of a shortcode in a post. First off I wonder if i'm approaching this wrong, but I have a theme that is drastically reformats the ...
1
vote
4answers
275 views

Remove action from shortcode

There is add_action() function inside function which is callback for add_shortcode(). Any idea how to remove this action with the help of custom plugin? Should I hook to any action which is called ...
1
vote
1answer
238 views

Is there any inherent difference between add_filter() and add_shortcode() for modifying [caption]?

The context is the [caption] shortcode found in media.php which contains img_caption_shortcode img_caption_shortcode also includes these lines: $output = apply_filters('img_caption_shortcode', '', ...
1
vote
1answer
3k views

Stop auto formatting in shortcodes

Is there a way I can stop Wordpress auto formatting everything I enter inside a shortcode tag? A the moment I want to include a h2, a paragraph and another shortcode, but everytime I do Wordpress ...
1
vote
2answers
791 views

The result of a shortcode appear BEFORE page content

I have a page, with a shortcode that get all the post from a categorie and put after the content of the page. For no apparent reason, the result of a WP_Query() in the shortcode APPEAR ALWAYS at the ...
1
vote
1answer
923 views

Get the content inside shortcode and apply external function to it?

function t_shortcode($atts, $content = null){ $lang = strtolower($atts['lang']); $content = "<div id='translator' class='translate_".$lang."'>".$content."</div>"; if($lang == ...
1
vote
1answer
197 views

Use [shortcode=“value”] instead of [shortcode att=“value”]?

With shortcodes that have only one attribute, it would be much easier from a content-editing perspective to use, for example, [icon="myicon"] instead of [icon whichicon="myicon"]. Is this possible in ...
1
vote
2answers
167 views

How to return multiples lines in a shortcode?

I found this example of a shortcode on the Internet: function project_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( 'class' => '', 'id' => '', ...
1
vote
2answers
1k views

Short code to display a loop

I've been working on this shortcode w/o any success... function loop_shortcode( $atts = '' ) { '<div class="clear"></div> <div class="childs grid_12"> <?php $the_query = new ...
1
vote
2answers
858 views

How to detect if a Shortcode is being called on a page?

I'm trying to push some variables to google analytics and would like to be able to detect if a shortcode has been included on a page at all. Anybody know a smart way going about this? Thank you! ...
1
vote
3answers
353 views

Custom CSS for plugin form

I have a short code that is adding a form to a page. How do I ensure that the CSS for the form is loaded in time with the shortcode?
1
vote
3answers
1k views

Any Short code Availble for Get Post List With Thumbnail Plugin?

Any Short code Availble for Get Post List With Thumbnail Plugin? or else how to Create Short code for this Particular plugin? Thank u in Advance.
1
vote
2answers
607 views

stop shortcode stripping in category and archive pages

Using the Wordpress default theme 2010 1.1, shortcodes work on the main blog page and individual post pages, but are being stripped out on category and archive pages. For example, stick in the ...
1
vote
1answer
43 views

How resource intensive is wp_register_script()?

I'm trying to use the has_shortcode() function to only load certain scripts when there is a shortcode in the post's content, with this code: wp_register_script( 'shortcode-js-file' , FILE_URI, array( ...
1
vote
2answers
58 views

How to create shortcode to show the 2 latest posts

I would like to create a shortcode that displays the last 3 posts to any page.... It should be laid out like this Title Excerpt...Read more I've added this code in function.php function ...
1
vote
1answer
206 views

Rewriting WordPress Gallery Shortcode with Bootstrap Carousel

In a recently personal theme project for publishing travel posts, I desired a slider-style image gallery rather than the standard column/list-style one WordPress uses out of the box. I like the ...
1
vote
2answers
89 views

(solved) how to have the gallery shortcode output one single UL list instead of several DL?

I need the built-in gallery shortcode to output UL instead of DL. How can I do it? I know I can use the 'post_gallery' filter, but that means almost duplicating the media's gallery_shortcode function. ...
1
vote
1answer
38 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 ...
1
vote
1answer
206 views

Hide Default Video Shortcode Controls on PageLoad

In wordpress 3.6+ when we use default video shortcode [video], controls of video are always visible on pageload. How can we hide these controls on page load and show only when we hover over the video ...
1
vote
1answer
367 views

Get custom post type list for every category shortcode

I am trying to make a shortcode to list all custom posts under the category they are under. Here is my code and I am no expert of coding but i thought that this would work. If someone can tell me what ...
1
vote
2answers
226 views

Shortcode: display list of created shortcode in popup

I want to create a popup shortcode in admin panel. I already create the shortcode button and a popup on button click. I want to display in the popup (not in the shortcode button), all my custom ...
1
vote
2answers
279 views

How to parse nested shortcodes?

The nested shortcodes won't parse correctly: [row] [col size="6"]...[/col] [col size="6"] [row] [col size="6"]...[/col] [col size="6"]...[/col] [/row] ...
1
vote
2answers
609 views

Remove images from get_the_excerpt

I'm using a custom function to create a shortcode that displays the latest blog post on the home page of a template. But I'm trying to NOT have it display any images. I know I can use the Advanced ...
1
vote
2answers
71 views

Optimizing Query used for a Shortcode

So, I have this shortcode that produces a list of all published multisite and their pages. The network in question has about 50 sites in it. The problem is that loading the page I put the shortcode on ...
1
vote
1answer
109 views

Shortcode inserts paragraphs before and after executing shortcode

When my shortcode is executed, it inserts a <p></p> before and after the shortcode. My shortcode is the only thing in the text editor of the page. There is not a newline before or after ...
1
vote
2answers
255 views

Call Shortcode inside another Shortcodes callback

I'm using a plugin that shows content only to specific user roles. This content is surrounded by a shortcode tag to make it invisible to other other user roles. Now I'd like to call other shortcodes ...
1
vote
1answer
206 views

How to insert image and text from admin panel throughout my theme

I'd like to have an admin panel where I can upload an image and customize a line of text. Then use a shortcode throughout the theme to display the text/images. I'd also like this to be scalable so I ...
1
vote
2answers
565 views

Run shortcode at certain resolution

I've gone a roundabout way of trying to ask a question about this here: Loading shortcode with ajax but figured it might be worth asking the fundamental question of what I am trying to do without ...
1
vote
1answer
34 views

How do I write this shortcode? [closed]

I have this shortcode, I would like to write in a better and clean way: function webhosting_products_shortcode( $atts, $content = null) { $content='<h2 class="heading_blue">Eburnie Hosting ...
1
vote
1answer
448 views

Add category attribute to custom shortcode

I have created a custom post type called "faq". The custom post type uses categories. I have created a shortcode [faq] that displays all the faq posts. What I would like to do is add an attribute to ...
1
vote
2answers
155 views

unwanted P tags in shortcode, delay wpautop not working

Like others, I'm having issues with WP adding unwanted p tags in my code. I have a shortcode I created that is to simply just spit out my javascript and html when I use it. Everything works fine ...
1
vote
2answers
38 views

Secure Pages Best Practice

I am in process of writing a plugin that has front-end shortcodes that display a user's information/data. If the user is not logged in, I need to redirect to a front-end login page/form. What would ...
1
vote
1answer
38 views

Allow users of my plugin to define their own shortcode rather than use mine?

I'm creating my first plugin. So far everything is great, but my shortcode is something like this [BIMS] and that acronym might not be easy to remember, or appeal to everyone. I'd like to include an ...
1
vote
1answer
59 views

Showing a different gallery in a seperate post

i am using the [multigallery] function and I was wondering if there is a way to use the function to call attachments from another post. For example if i was writing a post about taylor swift and I ...
1
vote
1answer
679 views

Why are you using add_action for shortcode?

I would like to create shortcodes, some tutorials write about to use add_action add_action( 'init', 'register_shortcodes'); but I read tutorials where the author didn't use it, only put ...
1
vote
1answer
304 views

How to use shortcode attribute in separate function

I'm working on a WordPress site and have installed a slider plugin that registers a slider on the backend (or multiple sliders) and then displays it on the front end with a couple of simple php ...
1
vote
3answers
869 views

Execute shortcode within shortcode

I am using this plugin: http://wordpress.org/extend/plugins/worldcurrency/ Shortcode syntax: [worldcurrency cur="EUR" value="25"] However, I'm using Advanced custom fields and the shortcode for ...
1
vote
2answers
3k views

How to get gallery id inserted to a post?

Is it possible to get a specific Gallery ID inserted to a post in wordpress 3.5? I want to load gallery from post using Ajax. I use shortcode [gallery] to do it. But when I use it this way: echo ...
1
vote
1answer
44 views

Create a shortcode that creates a form for users to edit their information

I want to make it so that logged in users can edit their information on a page in my site, so that I can avoid having them go to the admin side all together. I was thinking that I could create a ...
1
vote
1answer
263 views

Shortcode output appears before post body [duplicate]

Possible Duplicate: short code output too early How can I insert my plugin code via shortcode inside post body in exact position? The problem is that wp engine inserts the plugin code ...
1
vote
1answer
2k views

Adding Shortcode to Text Widget

At the moment, I'm running WordPress v3.2.2 (soon to upgrade to v3.4.2), and am trying to insert shortcode to insert Issuu into a text widget on our sidebar. The WordPress plugin I installed and am ...
1
vote
1answer
179 views

How to display posts by current user in a drop down

I am trying to write a shortcode that works in conjunction with Contact Form 7 to display the current user that is logged in posts. I have been able to get it to work with regular posts using this ...
1
vote
3answers
608 views

shortcode_atts - one URL variable not working

I have devved a small plugin based on a shortcode. Here's a stripped down version of the code for the shortcode itself: function lishortcode($liatts) { extract(shortcode_atts(array( "li" ...
1
vote
3answers
632 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 ...