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)

3
votes
2answers
465 views

Using get_option() in JavaScript

Previously, I used the get_option() function to get an option in PHP, like this: $width = get_option('my_width'); This is inside a shortcode function. Now, I want to have an option in JavaScript. ...
0
votes
2answers
495 views

Custom registration form in shortcode getting internal server error 500

I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below /* Custom shortcode */ function ...
7
votes
2answers
1k views

Use AJAX in shortcode

I have the following code to the shortcode to display a random quote. Question: how to make a button display a new random quote? I mean, that would hit the button and show you a new quote (without ...
0
votes
2answers
33 views

Dynamically create shortcodes using add_shortcode and a callback

In the example below, $shortcodes is a multidimensional array with shortcode data. foreach( $shortcodes as $shortcode ) { // Here we have the shortcode name, could be 'custom_person_john'. ...
0
votes
1answer
14 views

Display random text from a file with the WP built-in AJAX API

I want to use a solution by @toscho to display and rotate some quotes. The unchanged code works very well, but if I replace the protected function get_rand() { return rand( 1, 1000 ); } with ...
1
vote
2answers
396 views

Custom Shortcode and Button not Working after 3.9 update

I have added a new button that creates a short code but it seems that after the newest WordPress update, the button is not working any more. The button is visible but when someone clicks it, nothing ...
0
votes
0answers
21 views

Shortcode does not show if my wordpress has the WP-editor Plugin Activated [on hold]

After a long time I am posting here my doubts. I am using "WordPress Shortcodes" to show some short codes in the post or page editor, what I see in the visual editor the shortcode works well but when ...
0
votes
2answers
20 views

Can I use a function to return HTML and the result of another function?

I have a very simple function to create a shortcode to get the name of my page. I was using this shortcode in a form, but WordPress changed the Shortcode API and that no longer works. So I was ...
0
votes
1answer
26 views

Use WP_Query in shortcode

I'm trying to get meta information from the first four posts that have a meta key equal to Sedan, then format that posts meta in order to set up gallery type display boxes. I believe it has something ...
0
votes
0answers
11 views

Wordpress: Trying to echo taxonomy slugs of individual downloads, but limit them to the $atts[category] selected from shortcode from post

Note: I'm a reasonable newcomer to .PHP, starting with this project. I understand the concept of it, but I'm not yet skilled enough to figure out what functions I need to use for something a bit ...
0
votes
1answer
27 views

Formatting post content to exclude gallery

I have this code which takes the first gallery for a post's content, and formats it with more code preparing it for slideshow usage with css and js. $gallery = get_post_gallery_images( $post ); ...
2
votes
2answers
383 views

Stray closing paragraph tag when using shortcodes

I'm using a basic shortcode to wrap some text in an expandable div. What appears to be happening is that the wpautop is inserting a stray closing paragraph tag at the beginning and a stray opening ...
0
votes
1answer
515 views

Adding shortcode to the main menu

Is it possible to add shortcode to a main menu? I tried the following but no luck? add_filter('wp_nav_menu_items','add_nwadcart_widget_to_menu', 10, 2); function add_nwadcart_widget_to_menu( ...
0
votes
2answers
71 views

Why do_shortcode is not executing the shortcode in data-* html attributes?

This is on Vanilla installation. I've made a shortcode:- /** * Creates a shortcode for shortcode_use_here * @author Omar Tariq <XXXXXX@gmail.com> */ function callback_banana_abc( $args ){ ...
0
votes
1answer
372 views

Passing postid of Testimonial Custom Post in Shortcode Parameter

I am trying to create Testimonial custom post and display using shortcode function create_post_type() { register_post_type( 'testimonials',//new post type array( ...
0
votes
1answer
32 views

Onepage with shortcodes

i build a onepage wordpress theme , and for showing all my pages in one page i use a loop , but shortcodes don't work (Ex : contact form 7 : the form is showing but don't work at all) this is my code ...
0
votes
0answers
10 views

Displaying WP Job Manager Expired Listing

Anyone experience with the WP Job Manager? I tried to create the shortcode to display it, but seem not working. this is what i did: function jobexpired() { return '<div class="job_listings" ...
1
vote
1answer
544 views

Shortcode in AJAX popup

I am trying to use a shortcode from Ultimate Facebook plugin to display a FB connect button in an AJAX popup and can't seem to get it work properly. I searched and used the solution given by djb in ...
0
votes
1answer
33 views

Shortcode not working inside html input

I'm using Wordpress 4.2.3 The shortcode is added with the following: function upsellxid_shortcode() { return '9eaa86d1a36a126313aa752c2ff8e16c'; } function upsellxid_shortcode_2() { return ...
1
vote
1answer
510 views

Shortcode are not working in Option tree textarea

I am using option tree. In textarea, i place shortcode [layerslider id="1"] its not working, i also found same post replied by plugin author allow shortcodes in textarea in option tree applied ...
0
votes
3answers
1k views

Shortcodes not working

I have WordPress 3.2.1 and I have created a personal shortcode, everything works fine until I change the Permalink Settings from Default to Custom Structure. The shortcodes stop to work permanently, ...
0
votes
1answer
27 views

How to protect own PHP code from Wordpress updates

I have written several own shortcode scripts which I place in the shortcodes.php file. My Wordpress installation is set to update to new Wordpress versions automatically, which is a good thing. But ...
3
votes
2answers
2k views

Customizing gallery shortcode in 3.5

I'm trying to customize the gallery shortcode using the new gallery system in 3.5 and I'm having a bit of trouble and can't figure out where I'm going wrong. This is what I've got at the moment (in ...
0
votes
2answers
15 views

How to pass parameter that ends up being part of a class name with wordpress shortcode

This is the resulting html I want to produce with a shortcode - when editing page content in WordPress: <div class="shadow-wrapper half-shadow im-centered"> <div class="box-shadow ...
0
votes
0answers
23 views

Modify content if has shortcode

I have a post or page , the content of that post or page is similar to the following Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et ...
0
votes
1answer
490 views

Wpautop stops working after get_the_excerpt

function pre_process_shortcode($content){ global $shortcode_tags, $shortcodes; // Backup current registered shortcodes and clear them all out ...
1
vote
1answer
577 views

wp_specialchars and wp_specialchars_decode in a shortcode plugin

I have written my first plugin, a shortcode plugin. I have read about wp_specialchars and wp_specialchars_decode but I'm not sure how to use them. The plugin read a shortcode allowing some parameters ...
0
votes
1answer
513 views

Unable to add TAB character to post?

I am using the CodeColorer plugin to display source code in my WordPress. I am trying to have my code indented so that it displays properly on the website. However, when I try to add the following ...
0
votes
0answers
49 views

Visual Composer creating own shortcodes with vc_map() to return simple Image

I am using the Plugin Visual Composer with in a new Theme I develop. My question is about mapping shortcodes to Visual Composer arrays. The problem I get, when I try to make a custom element for an ...
0
votes
0answers
13 views

Is it possible to get Wordpress shortcode output with ajax

I'm trying to develop a booking system with a plugin. There is a couple of "book now" buttons with unique ids. What I want to do is to create a popup box (a div which shows when the "book now" button ...
0
votes
0answers
367 views

Creating tabs shortcode

<div id="tab-side-container"> <ul> <li><a href="#side-tab1">Tab 1</a></li> <li><a href="#side-tab2">The Second Tab</a></li> ...
0
votes
1answer
806 views

echo do_shortcode for Contact Form 7 from within dynamically loaded php file

I am loading a php file containing echo do_shortcode('[contact-form-7 id="568"]'); using jQuery .load() but the shortcode returns nothing. I have seen this question and answer and understand that ...
1
vote
1answer
25 views

Hide Post comments when displayed via WP_Query

I've written a shortcode which displays 'x' number of posts on the homepage of my site when I write [blog posts_per_page-"3"]. Here it is: function getBlogPosts($atts) { ...
0
votes
1answer
397 views

Display MP3 as media using an URL from a custom field

I created custom field and placed this inside the loop: <?php echo get_post_meta($post->ID, 'ses', true); ?> But now the link is all text. I would like it to be like my theme does when I ...
1
vote
1answer
266 views

How to display the comment_form with a shortcode while removing it from its default position?

I was already able to have the comments form show in the post content area with this code, which allows me to use the [wpsites_comment_form] shortcode: add_shortcode( 'wpsites_comment_form', ...
5
votes
6answers
2k 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
922 views

Insert wp gallery shortcode into custom textarea

Is there a way to insert wp gallery shortcode into custom metabox textarea ? I would like to have something like this: New metabox in post/page with textarea and below textarea there are a button to ...
-2
votes
0answers
27 views

All shortcode wordpress plugins not working [duplicate]

Installed all new and active plugins, their shortcodes are not working anymore. It only displays plain text shortcode in a page. This has happened, after I remove the existing WordPress files from a ...
0
votes
0answers
16 views

myCRED do_shortcode issue

i found a code to create a timer. I want to use it for delaying a do_shortcode commands but i don't work... the shortcode is execute when the timer is to 1:00 and i want to execut it when the timer is ...
0
votes
1answer
36 views

Shortcode not working after move wordpress website files

After I migrate the existing wordpress website files in public_html, the all new plugins installed, there shorcode are not working anymore on any pages. Here's the page that I put a shortcode from ...
0
votes
1answer
3k views

Auto gallery from folder contents

I want to create a WordPress shortcode that will add an automated gallery of the contents in a folder. I am currently trying to implement this in a site that publishes 12 annual magazine issues, so as ...
0
votes
1answer
8 views

WooCommerce shortcode displaying strangely [on hold]

I am working on a WooCommerce build at the minute, and I'm having trouble with the WooCommerce shortcodes (and potentially a clash with my theme). See this page: ...
0
votes
1answer
559 views

Display custom post type with shortcode

I have made a custom post type for my WordPress Theme and a page where the custom post types are displayed. But does anyone know how to make a shortcode that displays posts of a custom post type?
0
votes
0answers
26 views

Shortcode At top of Page - PHP 5.5 vs 5.4 - ob_start();

add_shortcode( 'recent-events', 'recent_events' ); function recent_events( $atts ) { ob_start(); $atts = shortcode_atts(array( 'count' => '2', 'columns' => '1' ...
0
votes
1answer
341 views

tiny_mce_before_init preventing custom shortcode icon appearing

I'm using the following to trim the TinyMCE editor // Restrict buttons on the rich text editor function formatTinyMCE($in) { $in['remove_linebreaks'] = false; ...
1
vote
1answer
1k views

Audio and video shortcodes not working properly

I'm having some trouble with Wordpress's built-in shortcodes for audio and video. When I embed a video, it basically gives me a black box and has a link to download the file at the top; when I embed ...
3
votes
1answer
1k views

TinyMCE popup windows using WP functions

In my editor I would like to use a TinyMCE generated popup to insert in the textarea some complex shortcodes. I use the TinyMCE API to show the popup (bottom of this question). The popup is a PHP file ...
1
vote
1answer
117 views

Multiple loops on page only show taxonomy name of first loop

I have a page with a custom post type called 'books', with taxonomy 'booktypes'. The books are ordered/divided in a loop per taxonomy-item, and added via shortcode to the page editor like this: ...
0
votes
2answers
25 views

how do you get the author's username?

how do you get the author's username? I'm using this code "get_the_author()" I wanted to change this into author's username, instead of author's name. Thankyou
1
vote
0answers
32 views

How to prevent shortcode preview from breaking in tinymce editor?

I am creating visual preview for shortcodes (just like captions). I have don't most of the parts but my preview html is getting broke by the editor when post is saved. I have investigate it further ...