How to parse this shortcode?

shortcode_parse_atts will give you managable information. $atts = shortcode_parse_atts( ‘[soundcloud url=”http://api.soundcloud.com/tracks/67658191″ params=”” width=” 100%” height=”166″ iframe=”true” /]’ ); You will get an array that looks like this: array(7) { [0]=> string(11) “[soundcloud” [“url”]=> string(41) “http://api.soundcloud.com/tracks/67658191” [“params”]=> string(0) “” [“width”]=> string(5) ” 100%” [“height”]=> string(3) “166” [“iframe”]=> string(4) “true” [1]=> string(2) “/]” } You can the … Read more

Remove hyperlink on gallery shortcode

Update: It looks like there exists an attribute link=”none” after all 😉 For example: So we don’t need to reinvent the wheel, like in my previous answers 😉 Previous: Plugin to handle link=”no” in the gallery shortcode: Here’s a demo plugin to add the option to remove the image links in the gallery. You can … Read more

Video shortcode – autoplay all videos

I ran into this problem while trying to make HTML videos behave like GIFs. WordPress’s built-in video player uses HTML video elements but does not allow videos to play simultaneously. Instead of using the default WordPress video player (which is best used for more standard video content), I chose to manually use the <video> element … Read more

Execute shortcode twice in the same page

I believe the real issue you had was with echoing your data instead of returning it. A shortcode should return the output to be drawn, which is then drawn in place of the short code. Here is the code using HEREDOC syntax for outputs and the query. I believe this makes things much more readable … Read more

Add attribute to shortcode dynamically

Untested (and can’t test right now) but you ought to be able to add attributes with a filter… something like: function test_sc($atts,$content) { // echo ‘test_sc’; $atts = shortcode_atts( array( ‘foo’ => ‘no foo’, ‘bar’ => ‘default bar’, ), $atts, ‘testsc’ ); // var_dump($atts); } add_shortcode(‘testsc’,’test_sc’); function test_shortcode_att_add($atts) { # this filter should only run … Read more

Error do_shortcode In WooCommerce Template

I solved this with dirty way.. hope someone else can provide more efficient solution, my final working code for problem above: $shortkode=”[zendesk_request_form size=”3″ group=”extra-field” subject=”Quotation For -wkwkwk-“]”; $shortkode = do_shortcode( $shortkode ); add_action(‘woocommerce_single_product_summary’, ‘quotation_form’, 61); function quotation_form() { $produk = get_the_title(); global $shortkode; $shortkode = str_replace(“-wkwkwk-“, $produk, $shortkode); echo $shortkode; } So i move out … Read more

Pass javascript array to shortcode

You’re going to have other problems than the brackets because shortcode_parse_atts will have already parsed your attributes, and the various single and double quotes will confuse the regular expression used to do that. If you need the exact string, perhaps you could get it from a custom field. Alternatively, and better, you could specify a … Read more

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