detect when shortcode ran for the last time

Not sure about the last time, but you can hijack every shortcode and either call wp_localize_script() here or register an action for wp_footer that runs earlier than the footer script handler. Let’s say, this is the original: add_shortcode( ‘foo’, ‘original_function’ ); Now you can overwrite it with: add_shortcode( ‘foo’, ‘new_function’ ); function new_function( $atts, $content=””, … Read more

unwanted P tags in shortcode, delay wpautop not working

The simple solution is to not give wpautop anything to chew on. function contact_us() { $str = “<p>Here’s the low down on what to do</p>”; $str .= ‘<link rel=”stylesheet” type=”text/css” href=”http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css”/>’; $str .= ‘<link rel=”stylesheet” href=”http://studiocloud.com/css/validationEngine.jquery.css” type=”text/css”/>’; // etc $return $str; } Your generated code won’t be formatted, but there is no reason it should … Read more

Creating a shortcode in a plugin that includes JS

Hook function name should be same. You are using “tweets” function name as a parameter for the add_shortcode() function but actual function name in your code is “tweet_code” so it should be “tweets” as shown in the following code. <?php add_shortcode( ‘tweet’, ‘tweets’ ); function tweets( $atts ) { $tweet_text = <<<‘EOD’ <!– Tweet JS. … Read more

Call Shortcode inside another Shortcodes callback

tl;dr Find where the shortcode is registered. Find the shortcode output function. Pray for a filter. Report as a bug. Remember: All of the functions below are made up. The point of the first two steps is finding the right values to plug into the snippets. Find where the shortcode is registered Use a program … Read more

How to add source code into wordpress post really?

Since you are self hosting the blog, you will need to: Install the SyntaxHighlighter Evolved plugin. Make sure that you enable the plugin on your blog (this is not done automatically after install). You should now be able to add the code to a post or page via either the visual or text editor. [code … Read more

Shortcode return $content vs do_shortcode($content)

This is useful if you don’t know if the $content contains unknown shortcodes. Example Your shortcode add_shortcode( ‘foo’, ‘shortcode_foo’ ); function shortcode_foo( $atts, $content=”” ) { return ‘Foo!’ . do_shortcode( $content ); } Now your user might write something like this: [foo][bar][/foo] You have no idea what [bar] does or that it even exists. So … Read more

Shortcode: display list of created shortcode in popup

You get all shortcodes, there are registered in WordPress with the default function in the global $shortcode_tags. You can loop about this shortcodes and filter via tag or functiion. foreach( $shortcode_tags as $tag => $function ) { } If the $function is a array, then can also read the parameters. See the source below. I … Read more

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