do_shortcode() won’t return PHP Array

This function returns a string. So you should join the elements of the array to make a string. From the Codex: Function Reference/do shortcode Return Values (string) Content with shortcodes replaced by the output from the shortcode’s handler(s).

Adding a custom field to do_shortcode [closed]

There’s a general convention in WordPress: functions prefixed with the_ will echo a value functions prefixed with get_ or get_the_ will return a value In your case you need to use get_sub_field() instead of the_sub_field() eg: echo do_shortcode( get_sub_field( ‘slideshare’ ) ); The documentation on the ACF site is very comprehensive: http://www.advancedcustomfields.com/resources/functions/get_sub_field/ NOTE: In your … Read more

Adding YouTube button to TinyMCE editor

The problem is that the URL to your script is pointing to the Thematic theme directory, not your child theme. Instead of: $plugin_array[‘youryoutube’] = get_bloginfo(‘template_url’).’/editor_plugin.js’; …you need: $plugin_array[‘youryoutube’] = get_stylesheet_directory_uri() . ‘/editor_plugin.js’;

Add shortcode within the_content()

Here’s what I’ve used after finding something on the web (wpbeginner). It finds the fourth p tag closing and adds it after that. Originally it was to add ad banners in the middle of post content dynamically. add_filter( ‘the_content’, ‘prefix_insert_post_related’ ); function prefix_insert_post_related( $content ) { $related_code .= do_shortcode(“[divider]”); $related_code .= do_shortcode(“[bws_related_posts]”); if ( is_single() … Read more

Call Shortcode on wp_footer

Try this: add_shortcode(‘eps_pop’, ‘indtable_display_front_end’); function indtable_display_front_end($atts ) { global $post; extract( shortcode_atts( array( ‘id’ => ” ), $atts ) ); echo get_post_meta($id, ‘_my_meta_value_key’, true); } echo do_shortcode(‘[eps_pop id=”234″]’);

Content between shortcodes

An Example Shortcode:(Taken from: GenerateWP: Shortcodes Generator // Add Shortcode function img_shortcode( $atts , $content = null ) { // Attributes extract( shortcode_atts( array( ‘width’ => ”, ‘height’ => ”, ), $atts ) ); // Code // This is the line you need to study: return ‘<img src=”‘ . $content . ‘” width=”‘ . $width … Read more