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)

0
votes
3answers
164 views

return unformatted content in encosing shortcode

I've written a little shortcode, following basic instructions on Wordpress Codex: function myshortcode( $atts, $content = null ) { extract( shortcode_atts( array( ..., ), $atts ) ); ...
0
votes
0answers
623 views

Shortcode not working in custom post types

I have created a shortcode and placed it in my functions.php and registered it with: add_shortcode('featured-attribution', 'gteh_author_shortcode'); It works fine on posts and pages. I created a ...
0
votes
0answers
157 views

Passing a location-dependent array via wp_localize_script within a shortcode

I have created a shortcode that is intended to be inserted into custom field of a music custom post type. The shortcode is coverted into an audio playlist using the jplayer jquery plugin (and it's ...
0
votes
1answer
57 views

What is the best way to include a template file within a shortcode?

I'm writing a shortcode for a child-theme. I want to load a php template file to generate my HTML and then output this HTML in a string to return this string. But I don't know the best way to do ...
0
votes
1answer
501 views

What is the difference between Null vs Empty (Zero Length) string?

In a shortcode context, is there any difference here? array( 'slideshow' => '', ), and array( 'slideshow' => NULL, ), Is there a best practice for that?
1
vote
2answers
2k 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 ...
0
votes
1answer
3k views

Loading shortcode with ajax

I'm trying to load a slideshow if the browser is a certain screen size - i.e. I don't want the slideshow to load on smaller, mobile screens. The slideshow plugin provides a shortcode: <?php echo ...
0
votes
1answer
48 views

Where to place PHP for shortcodes

My custom plugin is broken into two parts: a frontend.php and admin.php for loading code conditionally. Here is a rough outline of the code: <?php /* My plugin info here */ if (is_admin()) { ...
0
votes
1answer
313 views

Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script

Short version: I'm able to get a PHP variable into a JS file using wp_localize_script. On JS file i'm able to echo the variable using console.log, but I cannot get it echo into the jQuery plugin's ...
0
votes
1answer
285 views

Flipping Book PHP Code? Any experience?

Hi there guys quick question, using FlippingBook and calling a gallery within a page or post is with something like this: [book id='1' /] but I want to call the gallery directly from my code, so is ...
0
votes
1answer
510 views

Displaying audio player as preview in audio post in WP3.6

I'm testing the new Wordpress 3.6 Release Candidate 2 and it's [audio] shortcode and there is something I can't figure out. The post contains the following content: [audio ...
5
votes
6answers
3k views

How to add stylesheets only to pages with specific shortcode?

I'm running a function on pages where the shortcode [make-me-a-map] is used. It enqueues javascript to the page and makes a map. That part works fine (woot!) but I'm having trouble with adding the ...
0
votes
2answers
247 views

Shortcode or placeholder for theme options page?

I'm writing a theme options page that provides a space for the user to enter code for social buttons e.g. <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php ...
0
votes
1answer
685 views

Pass a comma separated shortcode attribute to a function

I've been trying to create a shortcode for the Category Ajax Chain Selects plugin so that I can display the chain selects within a chosen post/page easily, but for now I've only been able to hardcode ...
0
votes
1answer
9k views

Adding my own custom woocommerce shortcode to child theme, how?

So I bought a theme at themeforest.com that has some custom templates to use with the Woocommerce plugin. I made a child theme so I don't have to edit anything in this original theme. What I was able ...
0
votes
3answers
79 views

Is there any way to inject text onto pages?

I run a network of sites that get updated constantly, and the content they cover is updated frequently itself. So on each page we have a "updated for [text we want injected]" Is there a way to edit ...
0
votes
1answer
867 views

contact form 7 :create shortcode usable in email message [closed]

i have this (test ) function that adds a redirection bouton function bouton($atts, $content = null) { extract(shortcode_atts(array( 'lien' => '#', 'couleur' ...
0
votes
1answer
3k views

Registration Form Shortcode

Is There any way to create a shortcode for registration form using <?php do_action('register_form'); ?>
0
votes
1answer
97 views

How to show custom taxonomy child posts through shortcode in WordPress

My question: I have custom taxonomy in WP named Videos and childs of this taxonomy named music-videos and game-videos. In my WP theme this is shortcode which shows ALL video posts from main taxonomy ...
2
votes
2answers
200 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 (= ...
0
votes
1answer
914 views

How to parse this shortcode?

I have a shortcode like this [soundcloud url="http://api.soundcloud.com/tracks/67658191" params="" width=" 100%" height="166" iframe="true" /] How can I get the content of the URL part or extract the ...
0
votes
1answer
157 views

Could use some help with Shortcodes

So I am starting with shortcodes and this is my first time trying to make one, I am using it to make css/js tabs for information and basing off code I got from themeforest.. So I will do the best to ...
0
votes
1answer
28 views

Need to change contact email depending where user is from

I work for a company that has multiple sites, but one of them has all of the content. I am using Contact-Form-7 for the little contact forms at the bottom of the page, but what I need is for them to ...
-2
votes
1answer
588 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 parameters to the_widget but I don't see any changes ...
2
votes
1answer
564 views

how to show database content in wordpress post

I'm a beginner for WordPress. I have a database app written in PHP and MySQL and I need to convert it to WordPress and also I what to post the database rows info by shortcode were id="x" like: ...
1
vote
1answer
39 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 ...
2
votes
1answer
1k views

How do i get (unique) page name?

Like from the page of http://localhost/wordpress/about_us/ how do i get only the "about_us" ? Thanks
2
votes
0answers
394 views

Wp_localize_script from Shortcode [closed]

I've been trying for hours and tried several answers from here and Google but still no luck.. need help. I am making a shortcode (slider) and trying to execute a javascript file (for the slider's ...
0
votes
1answer
487 views

load plugin with ajax [duplicate]

is there a way to load plugin with ajax? I want to load Quick Chat plugin which supports initializing with PHP and Shortcode [quick-chat height="400" room="default" userlist="1" ...
0
votes
1answer
180 views

Overriding Attributes values in Shortcode Plugins

I have made some shortcode plugins according to my need. But this time I am getting a strange problem. My attributes in the shortcode are not getting the values written in the shortcode while ...
0
votes
1answer
170 views

Nested loop called with shortcode duplicating the content above the main loop

I'm trying to use a shortcode to call one post from a custom post type and display it inside another page's content. (Basically, we have a custom post type called 'testimonials' and we want to display ...
0
votes
1answer
945 views

Add number in increment of one to DIV ID

I'm using a shortcode to display a custom post type. The shortcode contains an attribute to display only posts of a specific category within the custom post type e.g. [faq category="travel"] For each ...
1
vote
2answers
1k 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
1answer
99 views

Display gallery on bottom after content

How to execute the gallery shortcode after any other content no matter where the shortcode is in the post HTML? Thanks.
0
votes
0answers
305 views

Str_replace using shortcode with multiple changes

I am using a feed importer plugin which gives the option to use a short code in case I need to change data (in this case data for a custom field) on import, using for example: ...
1
vote
1answer
421 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 ...
0
votes
1answer
368 views

Custom field within shortcode

I'm currently using the 'WP Simple Paypal Shopping Cart' plugin to get up a simple paypal e-commerce site, it's super easy to use, but to save the client having to write shortcode, I've set up custom ...
1
vote
1answer
337 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() ) : ...
0
votes
1answer
82 views

Executing a shortcode at the top of PAGE template?

I need to execute a shortcode at the TOP of contents area in specific PAGE template. Notice that I'm talking about "pages" as there are lots of plugins for 'posts' Preferably inserting the shortcode ...
0
votes
2answers
50 views

Custom field in a shortcode?

I cannot get the image from one of my fields into a shortcode. (it works with get_the_post_thumbnail($post->ID, 'thumbnail') but I need the value from the field udstiller logo. function ...
1
vote
2answers
250 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
votes
1answer
265 views

custom post types shortode stays on top of other page contents. Is there a bug?

I have created a custom portfolio post type for my wordpress theme, and I have made a shortcode for it too. But when I create a page and use the shortcode to display limited number of my portfolio ...
1
vote
1answer
373 views

Turn a snippet of HTML and PHP into a shortcode

the code is <div class="huili-relevant-left"> <a href="<?php echo get_post_meta($post->ID,"taobao_value",true);?>" hidefocus="true" target="_blank" ...
0
votes
1answer
67 views

How can I achieve this, using shortcodes

I have a plugin that restricts contents for registered users only, on the other hand I have created a shortcode for showing a chat and I want to hide it using the restrictive shortcode; ...
0
votes
1answer
633 views

Shortcode strips formatting and returns at content top

Using the Advanced Custom Fields plugin and I've got a shortcode going for a repeater field, but it returns the list at the content top. I changed it from an echo to a return, which I understood would ...
0
votes
2answers
37 views

div having different appearances in different themes

I have a shortcode in a plugin that is supposed to display a div. The div can be styled in the settings. The problem is: the div has different appearance in different themes. This obvious is caused ...
1
vote
0answers
121 views

Add button to kitchen sink toggle

I have created a simple function along with a shortcode, my goal is now to add a button in the sink toggle of wordpress so that the user doesn't have to type anything. Is this hard to achieve? how ...
0
votes
1answer
209 views

do_shortcode within a shortcode

This may sound a little confusing but I'll try my best to explain. I've made a shortcode that grabs the content of a post (when given the id), it looks like this: $post_id = $id; $queried_post = ...
0
votes
0answers
27 views

php within a shortcode within php

I've been trying for ages to get this work, but to no avail! Any help would be greatly appreciated. <?php echo do_shortcode("[thumb]'".bp_profile_field_data('field=3')"'[/thumb]"); ?> ...
0
votes
1answer
28 views

Custom shortcode that writes to file

I'm trying to maybe do too much in a shortcode call. Here's the code I have: //[rand] function randnumber_func( $atts ){ $digits = 4; $randnumber = rand(pow(10, $digits-1), pow(10, ...