Tag Info

Hot answers tagged

4

I removed all that duplicated and unnecessary stuff, take a look at otto's or kaiser's answers for the very simple solution. Trac ticket: #29629. Codex entry for Playlist Shortcode.


4

It looks like there is a both a bug and that the documentation was written incorrectly in the core code. However, there is a workaround that should work for the future and for any fixes that may be made to core. It's a simple one too: Use orderby="rand" in the shortcode. Just that easy. [playlist orderby="rand" tracklist="false" images="false" ...


3

Random order From what I can read in source, there's one argument responsible for this: 'order' => 'RAND', In the case you use this, the orderby value will be set to none. Edit Ok, core code tells that this should work: if ( 'RAND' == $atts['order'] ) { $atts['orderby'] = 'none'; } But this is not true. In fact, you have to set the orderby ...


3

Here's a shuffle add_action( 'wp_footer', function () { ?> <script> jQuery(function ($) { var playlist = $('.wp-playlist'); // Tune this if more than one. var tracks = $('.wp-playlist-tracks .wp-playlist-item', playlist); var last_shuffle = -1; var shuffle = function () { var i = Math.floor(Math.random() * tracks.length); ...


2

Theory It might have been hard to word for you, but is actually quite clear what you are trying to accomplish. A shortcode is a good way to insert dynamic content into a page (or post), the point at which your idea fails is the notion of a "dynamic shortcode". Use the shortcode to insert the form into your content and have the callback handle what happens ...


2

There are a couple of things to check here One: Is your plugin activated. Two: Is your shortcode in your main plugin file. If that code is in another file inside your plugin, did you make sure to include that extra file into your main plugin file Three: Don't you have any type of error in your plugin file that deactivates your plugin after activation. ...


2

Okay, I finally found it the answer. You need to add two filters to your functions.php file in order to run shortcodes through it. add_filter( 'the_excerpt', 'shortcode_unautop'); add_filter( 'the_excerpt', 'do_shortcode');


1

I believe esc_url() is what you're looking for? here's shortcode code: add_shortcode('urlencode','shortcode_urlencode'); function shortcode_urlencode($atts,$content = '') { return esc_url(do_shortcode($content)); } not tested, but should work.


1

I would rather pass the variable to the id attribute inside the shortcode. You can even decide to remove the id attribute inside the shortcode and make it a static value that you pass to your custom query For examples and more info about how shortcodes operate, check out the Shortcode API


1

You should try this on a default theme (without any plugins), to see if that makes any difference. Your shortcode example: [caption id="my-caption-id" class="my-caption-class" align="alignnone" width="399"] <img src="whatever.jpg" alt="whatever" width="399" height="600" /> My caption text [/caption] gives this output: <div ...


1

Auto-generate shortcodes from an array: You can try the following Shortcode Automat: /** * Setup the Shortcode Automat * */ function shortcode_automat_setup() { $settings = array( "get_address" => "mg_admin_address", "get_phone" => "mg_admin_phone", "get_fax" => "mg_admin_fax", "get_email" ...



Only top voted, non community-wiki answers of a minimum length are eligible