Multiple Parameters for a Shortcode

Lets look at the shortcode [SH_TEST var1=”somevalue” var2=”someothervalue”]THE SHORTCODE CONTENT[/SH_TEST] the shortcode handler function accepts 3 paramters $atts – an array of attributes passed by the shortcode in our case: $atts[‘var1’] is set to ‘somevalue’ $atts[‘var2’] is set to ‘someothervalue’ $content – is a string of the value enclosed with in the shortcode tags, in … Read more

WordPress transients for a shortcode

Use this instead of the line in wich you define $days (your second line): $transient = get_transient( ‘your_transient_key’ ); if( !$transient ): $days = file_get_contents( ‘json_file’ ); set_transient( ‘your_transient_key’, $days, DAY_IN_SECONDS*7 ); else: $days = $transient; endif; $days = json_decode( $days ); … May be a bit rough but you get the idea.

Enabling shortcodes for custom fields

Normally WordPress does not run shortcode that you put into a custom field. By default, Custom Fields display whatever value you enter, as plain-text, so if you try entering a shortcode, (in the format [shortcode] VALUE [/shortcode]) you’ll end up displaying the entire text, including the tags. Add the following in your template file, it … Read more

shortcode inside another shortcode

I usually apply the_content filters to $content to do this. I think you can aslo use do_shortcode($content); // Column ShortCode Description function column_scdescription($atts, $content=”null”) { return ‘<div class=”description”>’ .apply_filters(‘the_content’, $content) . ‘</div> <!– description ends here –>’; } add_shortcode (“product-description”, “column_scdescription”); Read up on Nested Shortcodes in the codex.

Removing Shortcodes from Child Theme

Try this out. Remove the already added shortcode then add the new shortcode on the init hook. function shortcode_cleaner() { remove_shortcode( ‘entry-twitter-link’ ); // Not exactly required add_shortcode( ‘entry-twitter-link’, ‘my_remove_shortcode’ ); } add_action( ‘init’, ‘shortcode_cleaner’ ); function my_remove_shortcode(){ return ”; }