How to detect if a Shortcode is being called on a page?

I have sometimes wondered the same thing – whether wp maybe checked on save and kept a register etc I had a quick look at the code, and it seems not. There is however a global $shortcode_tags, and wp has this function function get_shortcode_regex() { global $shortcode_tags; $tagnames = array_keys($shortcode_tags); $tagregexp = join( ‘|’, array_map(‘preg_quote’, … Read more

Organizing shortcodes. How to display all of them and their attributes?

Inspect the global variable $shortcode_tags: print ‘<pre>’ . htmlspecialchars( print_r( $GLOBALS[‘shortcode_tags’], TRUE ) ) . ‘</pre>’; Output: Array ( => img_caption_shortcode => img_caption_shortcode => gallery_shortcode => __return_false [contactform] => Array ( [0] => T5_Contact_Form Object ( [debug:protected] => [base_name:protected] => t5-contact-form/t5-contact-form.php [prefix:protected] => t5c [address:protected] => [nonce_name:protected] => t5_contact_form_nonce [hidden_field:protected] => t5_no_fill [option_name:protected] => t5c_default_address … Read more

Shortcode output always showing at top of page

I think your problem is with the $output = include …. statement. include() returns true or false based whether it was successful – not the content of the file being included. Use output buffering to get the content. function service_shortcode_index() { global $content; ob_start(); include ( TEMPLATEPATH . ‘/service.php’ ); $output = ob_get_clean(); return $output; … Read more

Nested Shortcode Detection

From: http://codex.wordpress.org/Shortcode_API#Limitations The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode() It will not let you nest the same shortcode inside another though: However the parser will fail if a shortcode macro is used to enclose another macro of the same name Assuming you won’t … Read more

List of all inbuilt WordPress shortcodes

You can actually list all of the available shortcodes for your WordPress installation by using the following code: <?php global $shortcode_tags; echo ‘<pre>’; print_r($shortcode_tags); echo ‘</pre>’; ?> It will show the main WordPress shortcodes plus any shortcodes for installed plugins which can be handy too!

How to Output HTML tags in do_shortcode?

Yes it is possible. There are two ways that I can think of at this moment. First follow what the codex says Shortcodes. Basically you just wrap your html in ob_start(); this will return the html as a string so you can echo it. function my_shortcode() { ob_start(); ?> <HTML> <here> … <?php return ob_get_clean(); … Read more

Tinymce – How to hook before or after live shortcodes rendering?

Well, yes, you can do that: //replace live edited content to display html editor.on(‘BeforeSetcontent’, function(event){ event.content = tinymce_to_html( event.content ); }); //Transform your html content to raw content editor.on(‘GetContent’, function(event){ event.content = html_to_tinymce( event.content ); }); Let’s explain that: Under the hood, tinymce use a plain-text editor to store content, use in forms, etc etc. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)