Get list of shortcodes from content

Here’s one way: You can look at has_shortcode() and find the parsing there: preg_match_all( “https://wordpress.stackexchange.com/” . get_shortcode_regex() . “https://wordpress.stackexchange.com/”, $content, $matches, PREG_SET_ORDER ); using the get_shortcode_regex() function for the regex pattern. For non empty matches, you can then loop through them and collect the full shortcode matches with: $shortcodes = []; foreach( $matches as $shortcode … Read more

Nested shortcodes

You cannot use shortcodes like this. The parser would not read that like you want. But there is a workaround: Hijack the shortcode dropbox-foldershare-hyno, run the callback function for the wp-members on the link and pass the result to the original dropbox-foldershare-hyno callback. Sample code, not tested: // wait until the other plugins are loaded … Read more

Adding body class when post contains a specific shortcode

I am doing something like this in one of my plugins: function my_body_class( $c ) { global $post; if( isset($post->post_content) && has_shortcode( $post->post_content, ‘your-shortcode’ ) ) { $c[] = ‘your-class’; } return $c; } add_filter( ‘body_class’, ‘my_body_class’ ); I’m not sure it was really necessary, but I probably can’t remove it now either. TheDeadMedic is … Read more

Passing HTML in WordPress Shortcode arguments

You have used the same quotation characters in 2 different contexts. You should write the shortcode in the following way: [example text=”<a href=”http://example.com”>lorem</a> ipsum”]Lets roll[/example] Then, “unescape” HTML entities on the shortcode output: $return_string = ‘<div class=”some-class”>’. html_entity_decode($text) . $content .'</div>’;

Extending Shortcode attributes

Without seeing your code it is difficult to give you an exact answer. There is the shortcode_atts_{$shortcode} filter that was introduced in WordPress 3.6. All attributes is run through this filter. It has to be noted that the $shortcode parameter needs to be set in shortcode_atts. I haven’t seen shortcodes yet that has this parameter … Read more

Problem with email_exists in shortcode

This is a basic version of your code above which seperates the registration logic (handled on init) from the form output done by the shortcode. It will basically work, but is missing any validation so just to show the concept. $wpse_email_exists = null; function registration_form_shortcode() { global $wpse_email_exists; $output=”<form name=”registration” action=”” . esc_url($_SERVER[‘REQUEST_URI’]) . ‘” … Read more

How disable checkbox when listbox value changes in tinymce

Looking though the existing plugins, the standard tinymce way to do this is to save the popup window in a win variable: { text: ‘Vídeos’, onclick: function() { var win = editor.windowManager.open({ //etc And then use win.find(‘#name’) to target the control, eg: {type: ‘listbox’, name: ‘video_site’, onselect: function( ) { var autoplay = win.find(‘#video_autoplay’); if … Read more