Shortcode insertion in tab

Sounds like you need to wrap your shortcode contents in ob_start()and return ob_get_clean() require_once(dirname(__FILE__).’/post-type.php’); //file that registers CPT function wporg_shortcodes_init(){ function wporg_shortcode($atts = []) { extract( shortcode_atts( array( ‘term’ => ‘columns’ ), $atts ) ); $custom_taxonomy = $atts[‘term’]; ob_start(); // <- works like magic // add query of custom post type board_members $recentPosts = new … Read more

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

is_page “range” for if statement?

I think you should create range as variable and set it to is_page() something like this should work. $range = range(310, 326); if(is_page($range)){ // your code.. } is_page() function can accept array as argument. And range() function return array. This example works fine for me.

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

Add custom variable in Contact Form 7 mail body

You should do it like so: add_action( ‘wpcf7_init’, ‘custom_add_form_tag_my_source’ ); function custom_add_form_tag_my_source() { // “my-source” is the type of the form-tag wpcf7_add_form_tag( ‘my-source’, ‘custom_my_source_form_tag_handler’ ); } function custom_my_source_form_tag_handler( $tag ) { return isset( $_COOKIE[‘my_source’] ) ? $_COOKIE[‘my_source’] : ”; } See the documentation for more details. Or you can also try this, to parse regular … Read more