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
1answer
99 views

Custom shortcode being executed when saving page in wp-admin

I'm working on a custom shortcode: [abuzz-store slug="woolworths" fields="description,level,phone" more="true"] The shortcode is working correctly on the website frontend. However, I can no longer ...
1
vote
2answers
80 views

Change Wordpress Shortcode added in to post

Problem: I am using a plugin that turns the wordpress gallery into a cool slide show. How ever, every time I make a gallery - Wordpress add this code to the post . [gallery ids="334,332"] I need ...
1
vote
1answer
36 views

'&' causes an error in my shortcode when I list the content of the page

I would like to list the specified pages with my shortcode, but the problems are with the '$' charachters. function get_page_func( $atts ) { extract(shortcode_atts( array( ...
1
vote
1answer
218 views

basic shortcode - Why 1st paragraph not wrapped in p tag, but 2nd is

I'm working on a basic plugin that adds shortcodes for columns, buttons, panels, ect. Nothing new here. I haven't altered wpautop in anyway; I've tried removing it and delaying it - no change. What ...
1
vote
2answers
274 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
1answer
221 views

has_shortcode() - how to detect nested shortcode

I'm using has_shortcode() to detect a shortcode, it works but not at all. If I put this specified shortcode inside another one the has_shortcode() function stops working. has_shortcode( ...
1
vote
1answer
94 views

Videos via the video shortcode are always 640px wide?

I've run into a particular problem with the Video Shorcode of WP. I can't seem to change the size of the player with the attributes of the Shortcode. This happens on multiple sites with multiple ...
1
vote
2answers
545 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
2answers
394 views

Localize variable for multiple Shortcodes

I have this code for flexslider Shortcode add_shortcode('flexslider', function($atts){ global $post; $ids = explode(',', $atts[ids]); $uniqid = uniqid(); wp_enqueue_script( 'shortcode_flexslider'); ...
1
vote
1answer
94 views

How to generate CSS from a shortcode within a plugin

I'm struggling to generate CSS 'on fly' from a shortcode that is within a plugin using class. Here is the shortcode function: public function shortcode($atts, $content = NULL) { $data = ...
1
vote
1answer
196 views

IF statement in a do_shortcode

Is it possible to do a if statement in a do_shortcode? <?php echo do_shortcode("[table width='500'] " . if ( have_posts() ) : while ( have_posts() ) : ...
1
vote
1answer
37 views

detect when shortcode ran for the last time

I'm wondering, given this code: add_shortcode( $tag , $func ); Is there a hook I can use that will always be called AFTER the last time $func was called, but soon enough, so I can still call ...
1
vote
2answers
402 views

Place the page title into the short code

I have created a short code called [contianer-narrow][/container-narrow] which wraps your content in a twitter bootstrap class: .container-narrow the issue is that the page title is not included. is ...
1
vote
1answer
93 views

Shortcode for a link and thumbnail

<?php // Add Shortcode function blog_shortcode( $atts ) { // Attributes extract( shortcode_atts( array( 'id' => '', ), $atts ) ); // Code if (has_post_thumbnail()) { $url ...
1
vote
1answer
741 views

Add htmlentities and/or shortcode into data-attributes

I realize this is crazy but, I built up a filtered gallery with quicksand and it pulls in a larger image, title and description when you click the smaller image it shows the data-img in a larger form. ...
1
vote
1answer
490 views

How can a shortcode can take the place of the featured image in a post?

When there is a specific shortcode in a post (example [sc]anything[/sc]), I want to hide the featured and take it's place. How can I do that? I add this on my theme function // TopWide Shortcode ...
1
vote
2answers
804 views

Wordpress Gallery shortcode: Display one category ID only

Good Day. I am using a Gallery shortcode in my wordpress site to display images. Problem is that I wasnt the gallery to show only images from a certain category, for example category id 35. How do I ...
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
83 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
54 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
1answer
205 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
499 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
216 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
1answer
754 views

shortcode outputs first before the page content [duplicate]

Possible Duplicate: Shortcode always displaying at the top of the page I have a wordpress site with wp e-commerce plugin and gold cart plugin. I have created a worpdress page with ...
1
vote
3answers
8k views

Include PHP file in Content using [shortcode]

Here is what I have I am not having any lucking finding how to simply include a file in the content editor using a shortcode. For Example if I wanted to include form.php inside my Contact Page how ...
1
vote
4answers
284 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
250 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
901 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
1k 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
204 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
196 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
2k 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
3answers
1k 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
358 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
1answer
1k views

Can shortcodes contain conditional statements? Even without them my shortcode renders blank page

The following code is supposed to allow for a shortcode that includes many attributes, but not all of the attributes may always be present in which case I do not want the containing element to show ...
1
vote
3answers
2k 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
619 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
54 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
166 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
763 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
182 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
53 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
417 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
476 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
1answer
240 views

Calling a shortcode in the backend

I'm using TablePress to make some backend tables. What I want to do is show these tables in a different admin menu than the TablePress menu, because they'll be available to lower user groups. So I ...
1
vote
2answers
676 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
1k 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
80 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
138 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 ...