Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?

such an answer would likely become unworkable/unusable after a WordPress update, as TinyMCE get updated and APIs change – by @TomJNowell While I agree with Tom, there still an be a general answer that explains the general concept and the parts that aren’t moving. The PHP plugin to set the default content First there has … Read more

Get multiple shortcode attribute values

Don’t try to shove everything into a single attribute, or a single shortcode even. The string parsing you have to do will get more and more complicated. Try this: function myshortcode_cb( $atts ) { $atts = shortcode_atts( array( ‘cat’ => ”, ‘title’ => ” ), $atts ); // var_dump($atts); // debug return “{$atts[‘cat’]} :: {$atts[‘title’]}”; … Read more

Custom Shortcode and Button not Working after 3.9 update

Try like this: <script type=”text/javascript”> tinymce.init({ selector: “textarea”, toolbar: “mybutton”, setup: function(editor) { editor.addButton(‘mybutton’, { type: ‘splitbutton’, text: ‘My button’, icon: false, onclick: function() { editor.insertContent(‘Main button’); }, menu: [ {text: ‘Menu item 1’, onclick: function() { tinyMCE.activeEditor.execCommand(“myPopup”, false, { title: ‘Divider’, identifier: ‘divider’ })}}, {text: ‘Menu item 2’, onclick: function() {editor.insertContent(‘Menu item 2’);}} ] … Read more

Using audio shortcode for .mp3 URLs with a query string

The problem: The problem seems to be that wp_check_filetype() doesn’t recognize mp3 files with GET parameters. Possible workarounds: You have two options as far as I can see: 1) Override the audio shortcode with the wp_audio_shortcode_override filter. 2) or allow any audio extensions via the wp_audio_extensions filter. Here’s an example how you can implement the … Read more

How execute shortcode with javascript

to execute “ShortCode” which server side-> wordpress ->php ,by JavaScript which client side you will need use AJAX! you can use some thing like: 1-in your enqueued .js file : jQuery(document).ready(function($) { $(‘.buttonClass’).on(‘click’, function() { $.ajax({ url: Param.doShortCode, type: ‘POST’, data: { action: ‘handle_ajax_shortcode’, }, success: function() { //do something on success }, error: function() … Read more

Shortcode with parameters inside parameters

The days of the week shortcodes aren’t needed. Also, the way you’re trying to use them isn’t allowed. Why not just use the title and do what you want in the books shortcode? function books($atts, $content = null) { $atts = shortcode_atts( [ “name” => ”, “day” => ”, “title” => ”, ], $atts ); … Read more