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

Placing <div> tags on wordpress visual editor using shortcodes

Hello I need to have the following code on a specific page: <div class="searchbar" > <div class="searchbar-inner" > search <input type="text" id="search" ...
1
vote
1answer
2k views

Should custom meta boxes be able to output shortcodes the same as Wordpress' native post editor?

Simply put: Should custom meta boxes be able to output shortcodes the same way as Wordpress' native post editor? Reason I ask is because Ive created my own custom meta box for inputting a shortcode ...
0
votes
1answer
399 views

Allow tags between shortcode in comments

On my personal blog, I would like commentors to be able to post code using certain shortcodes (eg [html], [css], [js], [php]). I still want to strip tags for comments for security reasons, but allow ...
0
votes
1answer
1k views

post content and shortcode content displaying out of order

I've seen a couple of questions that address this problem but I can't seem to get it to work based on the answers given. I have 2 plugins that I've written myself that output content via shortcodes. ...
0
votes
1answer
86 views

Execute Shortcodes when submitting post

I'm using shortcodes to insert some image links to my posts I grab from XML files (by an ID). As this needs to be executed just once it's not necessary to this everytime a user loads the page. So how ...
0
votes
2answers
128 views

Replacing custom field with shortcode

I've been using custom fields for my wordpress theme, but i'd like to use shortcodes now for easier posting. so before, in my index.php i have this: <?php echo get_post_meta($post->ID, ...
1
vote
3answers
1k views

How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function

I need to pass a plugin's $atts variable to a javascript function, but I'm not sure how to do it. The javascript function needs the shortcode's php latitude variable in order to build the map. My ...
0
votes
4answers
1k views

Can a shortcode included in post content add styles to the <head>?

I have a shortcode that iterates through a list of custom post types and, as part of displaying them, creates a block. In HTML5, it is illegal to have a style block outside the header (maybe in other ...
1
vote
2answers
210 views

How can I hide the Permalink/Shortlink for certain user logged in Users of a certain level?

I would like to keep logged in Users who can write and edit their own posts from seeing the Permalink/Shortcode for the post (located under the Title field). I've been able to cut out other features ...
0
votes
1answer
289 views

Default Attributes in Shortcode Not Working

I'm learning about shortcodes. My shortcode is working fine. But, I'm not getting the default values for the attributes. function csf_cap_databaseinfo($atts,$content=null) { global $wpdb; ...
0
votes
1answer
63 views

Substituting value via shortcode

function add_listing( $atts) { extract( shortcode_atts( array ( 'sslug' => '', 'jslug' => '' ), $atts ) ); global $wpdb; $qstr = ' SELECT * FROM $wpdb->posts LEFT JOIN ...
0
votes
1answer
618 views

Shortcode, Concatenating & Parse error: syntax error, unexpected T_FOREACH

I'm learning how to write a shortcode. I'm getting this error: Parse error: syntax error, unexpected T_FOREACH . I'm having problems with concatenating it properly. <?php /* Plugin Name: My ...
0
votes
1answer
186 views

Can't get default values to work with custom shortcode

I'm working on creating a shortcode to embed locally hosted Quicktime movies, but I can't seem to get the default attributes to stick. Here's what I'm working with, can anyone spot anything obviously ...
0
votes
2answers
885 views

do_shortcode() in twentyeleven theme

I observed a difference between twentyten and twentyeleven themes. Let me explain with an example: example.com/category/health-beauty/ finds one post containing just a shortcode. If I use twentyten, ...
0
votes
2answers
178 views

Shortcodes dont work online

i created some shortcodes which i have include into functions.php This is the shortcode.php code i have used: // alert box function alertBox($atts, $content = null) { ...
0
votes
1answer
1k views

get_shortcode_regex() only matches first shortcode

The Codex has an example of using get_shortcode_regex() to check if a shortcode is being called on a given page: $pattern = get_shortcode_regex(); preg_match('/'.$pattern.'/s', ...
2
votes
1answer
2k views

Why does my short code get executed before other content?

I have the following text in a page. As you can see my shortcode is right at the bottom but somehow when the code runs, the out put of my shortcode is inserted at the top of the page instead of ...
0
votes
1answer
419 views

Extract all shortcode data from post into loop variables?

My client wants to have several pages in which he can edit small, separate parts of a Wordpress page. For example, there is a callout box in the upper left corner. There is also a small piece of ...
1
vote
1answer
1k views

TinyMCE buttons that launch Ajax-generated forms

if i follow the tutorials on how to add tinyMCE buttons for shortcodes ( for instance: http://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/ ) if i create a button that launches a ...
0
votes
1answer
405 views

How to attach sidebar to shortcode's output?

I have one shortcode that should be always next to the sidebar: // [shortcode] otuput | default sidebar My theme allows me to set different sidebars for each page. So I have sidebars on a few ...
0
votes
1answer
123 views

Shortcode returns values in the wrong order

I have a shortcode function that returns: return '<ul class="list-pages">'. wp_list_pages( $args ) .'</ul>'; Of course it returns: {pages} <ul class="list-pages"></ul> ...
0
votes
1answer
299 views

Multiple Content Shortcodes

I was trying to create a shortcode for a multiple tabs panel. The user can set the number of tabs, the titles and the content for each. It would be something like : [tabs number='4'] [tab ...
-1
votes
1answer
831 views

Changing the title tag from a shortcode

I currently have a shortcode which dynamically swaps out locations on a page to make each page specific to a location. For example the url http://mywebsite.com/offers/scotland/ Would make the H1 ...
-1
votes
1answer
759 views

Calling function from within functions.php returns unwanted value

I am trying to customize the output of the [gallery] shortcode to include comment count by this plugin: Facebook Comments for WordPress plugin I found a function by Zack Austin (shown below) that ...
0
votes
2answers
908 views

Populating shortcode values dynamically in theme template

I'm trying to use a jquery toggle shortcode in a theme template. The shortcode goes like this: [sws_toggle3 title="Title"]You can now see the displayed text.[/sws_toggle3] I want to pull posts ...
0
votes
1answer
220 views

Rename Smart YouTube's httpv back to http for all posts

I've used the Smart YouTube plugin to embed YouTube videos into my blogs. The way I did it is to replace the http:// of the YouTube url with httpv:// as the plugin describes. But now I noticed that ...
1
vote
3answers
367 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?
2
votes
1answer
167 views

Create a shortcode in Wordpress, again

There're lots of examples both here and on the internet, I've tried but don't seem to be able to achieve what I need although it does feel like it should be simple enough. Basically, I want to be ...
1
vote
1answer
621 views

Help with shortcode in admin-ajax [closed]

I've been playing around with ajax in wordpress and I've gotten my efforts to work on both back and front-end without too much trouble, however I've run into a problem getting post shortcodes to run ...
0
votes
1answer
86 views

Wordpress Shortcodes - Optional Styles

i'm creating some custom shortcodes for my wordpress theme. Shortcodes are by nature optional on pages/posts, but may contain css, js or other files. My question is, how can i enqueue css styles ONLY ...
0
votes
1answer
103 views

loop on page makes shortcode fail

I have this typical WordPress page (page.php): <?php the_post(); ?> <div id="rightcol"> <div <?php post_class(); ?>> <?php the_content(); ?> </div> All works ...
0
votes
1answer
695 views

Help with Wordpress function inside a shortcode

I'm trying to spice up a theme of mine with some shortcode buttons but I'm having quite a bit of trouble when trying to call the author's name within the button itself. I tried simply including ...
1
vote
1answer
2k views

How do I hardcode a WordPress shortcode into my theme?

I am using WooTheme's Canvas theme and would like to "hardcode" in the [post_comments] shortcode into my theme. [post_comments] displays a comment link with comment count (ie Comments 10) in my post. ...
0
votes
2answers
2k views

Wordpress Shortcode wrap around div

Is there a way to wrap a wordpress shortcode around a div in a template file? Here is my code: <div id="subscription"> <?php do_shortcode('[subscribe]');?> <p>This is subscription ...
0
votes
3answers
2k views

Ajax, filters and shortcodes

could you figure out why I'm unable to get shortcode filters applied in ajax inclusion of posts? Let me explain better: I've managed to include a post from within another post, through ...
0
votes
1answer
651 views

WordPress wpautop/shortcode generating invalid markup

I notice that theres invalid markup in my shortcode. Its ok if I disable wpautop tho function shortcode_banner($attrs, $content = '') { echo ' --- ' . $content . ' --- '; $html = '<section ...
0
votes
2answers
536 views

Echoing function into Wordpress NextGen gallery

Is there anyway to echo a function into a wordpress shortcode? heres my code: <div id="subscription"> <?php echo do_shortcode('[nggallery id=$ID]');?> </div> $ID is a function ...
4
votes
1answer
613 views

explode array within shortcode

This functions at the moment but it only returns the first value from the array. I've been struggling to echo, print, explode, or whatever the multiple custom field values that share the same key ...
0
votes
2answers
323 views

how to write short code in word press

I am new in WordPress, I want to write short code with parameters in function. That is in add_shortcode('short code name','function name','parameter1,parameter2'); In add_shortcode(), I want to ...
25
votes
7answers
10k views

Conditionally Loading JavaScript/CSS for Shortcodes

I released a plugin that creates a shortcode and requires a JavaScript file and a CSS file to load on any page that contains that shortcode. I could just make the script/style load on all pages, but ...
1
vote
1answer
326 views

May i Use ShortCode in Template?

Am Using Wordpress Blog.Here i want Use Tweetmeme Plugin.I want to show the output of the Tweetmeme Plugin to Customizing place(Side of the Post[Not Before or After]).The Plugin Creators are providing ...
1
vote
2answers
1k views

How can i remove the paragraph from shortcodes content?

If you have created shortcodes in Wordpress, you may have noticed that when you get the content of your shortcode, it's wrapped in html paragraph tags. I don't know why the progammers did that. It ...
0
votes
2answers
186 views

Is there a straight-forward way to iterate over all shortcodes in a post?

I'm working with a shortcode [translate lang=eng]Apple[/translate] which will be shown only if the "current language" is eng. If the post contains, in addition to the above, the declaration [translate ...
6
votes
3answers
4k views

Check if post/page has gallery?

I'd like to run some code only if a gallery (inserted with the [gallery] shortcode) has been inserted into a post/page. I did the following: gallery_shortcode($post->ID) ? $gallery = 1 : $gallery ...
0
votes
3answers
956 views

Insert PHP code via shortcode?

I wanted to insert a form with a line of PHP code via shortcode. I am wondering if it's allowed? Has anyone tried it? Take the following for example: function get_form($atts) { return '<form ...
2
votes
1answer
263 views

How can I just get content inside a shortcode or just outside

Suppose I have content like [xxx] Here is some content in xxx [/xxx] Here is content outside xxx ... Can I somehow just get content inside [xxx] ONLY content outside [xxx] ONLY
0
votes
1answer
145 views

post var problem with shortcode loop

I have a function to display the children of the page in the sidebar php file using wp_list_pages: global $post; ?>        <div id="subChildren">        <?php if($post->post_parent) ...
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 ...
0
votes
1answer
477 views

Trouble passing attribute into shortcode function

For some reason the WP_Query instance in my shortcode function won't take the query attribute sent from the shortcode. The shortcode is like this: [postlist query="post_type=any&posts_per_page=5" ...
1
vote
2answers
411 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 ...