Echo out element to another page.

Well, writing echo ninja_forms_field_submission_left_display( $field_id, $data ); into a template should do it, if $field_id and $data is correct. Creating a shortcode should be equally trivial: function field_sc_wpse_145003($atts,$content) { if (!isset($atts[‘field_id’])) return; return ninja_forms_field_submission_left_display( $atts[‘field_id’], $atts ); } add_shortcode(‘fieldfc’,’field_sc_wpse_145003′); echo do_shortcode(‘[fieldfc field_id=”abc” default_content=”def”]’);

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″]’);

Shortcode won’t execute

You’re using your shortcode function to directly output something (using echo). Shortcodes are supposed to return the desired output rather than echo it directly. You could use output buffering to “catch” anything that’s outputted (for example, via echo) in an output buffer instead of directly outputting it, and retrieve the content of the buffer afterwards. … Read more

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

Shortcode for a Series of Elevating Image Files, Excluding a Range?

You can try the following code snippet: /** * Shortcode for a series of elevating image files, excluding a range * * @link http://wordpress.stackexchange.com/a/151408/26350 */ add_shortcode( ‘episode’, ‘episode_shortcode’ ); function episode_shortcode( $atts = array(), $content=”” ) { //———————– // Settings: // $path=”/path/to/files”; $ext=”jpg”; //———————– // Shortcode input: $atts = shortcode_atts( array( ‘num’ => 0, ‘title’ … Read more

Putting a space between the buttons [closed]

This is less of a WordPress question and more of a styling questions but here is some feedback anyway. You could create a class and use your themes style.css or for examples below, inline CSS. You can either use the word-spacing property or left/right padding on some span elements to get the desired spacing. <?php … Read more

Change Spaces to Dashes?

You could simply use str_replace: str_replace( ‘ ‘, ‘-‘, $name ) In your code, this would translate to: return ‘<img src=”https://wordpress.stackexchange.com/images/flags/” . str_replace( ‘ ‘, ‘-‘, $name ) . ‘.gif” alt=”‘ . $name .'” title=”‘ . $name . ‘” class=”flag tooltip” />’;