Two Shortcodes in one page not working

I simply replaced require_once dirname( __FILE__ ) . ‘/swt_mm_single_box.php’; with define(‘__ROOT__’, dirname(__FILE__)); include __ROOT__.’/swt_mm_single_box.php’; and now its worked for me. check Here

Shortcode with no attribute but has value

When no attribute is used but a value is provided, the value is added to $atts[0]. Using $atts[0], I’m now able to get the value output doing the following: function audio_shortcode($atts) { if($atts[0] != ”) { return ‘ <div class=”audiofile”> <audio controls> <source src=”‘ . $atts[0] . ‘” type=”audio/mpeg”> </audio> </div>’; } } add_shortcode(‘audio’, ‘audio_shortcode’);

Instagram URL is converted into oEmbed

Figured it out. Embed shortcode stores the oemebd data as post meta using md5 hash. wp-includes/class-wp-embed.php // Check for a cached result (stored in the post meta) $key_suffix = md5( $url . serialize( $attr ) ); $cachekey = ‘_oembed_’ . $key_suffix; $cachekey_time=”_oembed_time_” . $key_suffix; And has a cache mechanism to fetch new data only after … Read more

How can I included CSS to a page or a shortcode? [closed]

Simply follow the link to the has_shortcode() documentation in the last answer to the duplicate question. There you’ll find: function custom_shortcode_scripts() { global $post; if ( is_a( $post, ‘WP_Post’ ) && has_shortcode( $post->post_content, ‘custom-shortcode’) ) { wp_enqueue_script( ‘custom-script’); } } add_action( ‘wp_enqueue_scripts’, ‘custom_shortcode_scripts’); For styles this would be: function custom_shortcode_styles() { global $post; if ( … Read more

How to set Contact Form 7 fields default value using shortcode attribute? [closed]

the destination-email attribute requires an additional filter to be hooked to work, as detailed in cf7 doc and this forum thread, you need to ensure you do the following 4 steps: 1) in addition to the short code attribute, [contact-form-7 id=”123″ title=”Contact Form” destination-email=”[email protected]”] 2) you need to, add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter’, 10, 3 ); function … Read more

Wrap shortcode inside custom block

First Add a normal Shortcode block and type the shortcode [foo]123[/foo] Then click More Options for the block and select Add to Reusable Blocks Then provide a name as Foo Next, time you can search and add the Foo block instead of typing the shortcode Thanks

Executing a shortcode from a “normal” text/hyperlink

Yes and no I created a shortcode named foo: add_shortcode( ‘foo’, ‘fooshort’ ); function fooshort( $atts ) { return “https://google.com”; } Then put this in a post: test [foo] The result: test https://google.com So if I take your question literally, yes, you can put shortcodes in anchor attributes. But the shortcode has no idea it’s … Read more

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