Use a class, store the value you need in the footer in a member variable.
Sample code, not tested:
add_shortcode( 'tooltip', array ( 'WPSE_69605_Tooltip', 'shortcode_callback' ) );
class WPSE_69605_Tooltip
{
protected static $var="";
public static function shortcode_callback( $atts, $content="" )
{
self::$var="foo";
add_action( 'wp_footer', array ( __CLASS__, 'footer' ) );
}
public static function footer()
{
echo self::$var;
}
}
Related Posts:
- Why are you using add_action for shortcode?
- Using action hooks inside of a shortcode
- Pros and cons of actions over shortcodes
- Enclosing Shortcode Within Another Enclosing Shortcode Breaks Output Functionality
- How can I collect and output all attributes of all executed ShortCodes?
- Use another action instead of the shortcode API to display the last time a user logged in
- How to create shortcode for auto login after registration
- Which method to use when deleting posts from the front-end
- Shortcode outputs at the top of the_content
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- Short code to display a loop
- shortcode inside another shortcode
- How can I just get content inside a shortcode or just outside
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- Custom Shortcode AJAX 400 Bad Request
- WordPress core responsive video not working with shortcode
- shortcode to create dynamic dropdown box form shortcode attributes
- conditional shortcode not working
- Can’t seem to get [shortcode]s to work
- Wraping $content into link with shortcodes
- Print shortcode in custom action hook not where the shortcode is entered
- nested Shortcode doesn’t work
- Simple contact form with field validation
- TinyMCE get selected text and underlying HTML
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- other shortcodes in Contact form 7 MAILS [closed]
- Remove empty p-Tags in Shortcode content before non p-Tags
- What is a short code?
- How do I combine my shortcodes?
- Bulk converting shortcodes to blocks with embeds
- How to add source code into wordpress post really?
- shortcode_atts – one URL variable not working
- Caption shortcodes not including caption as attribute
- Remove action from shortcode
- Make shortcode’s Bootstrap CSS override the theme’s CSS, how?
- Passing a nested shortcode as an argument of another shortcode?
- Change the default video shortcode
- How to use shortcode in js url
- How to add AJAX in a custom PHP function using Google sheets API
- Nested Code Snippets [closed]
- How do I display “Hello username” if logged-in on the homepage
- Shortcode to show current post category with link
- Gutenberg Block with Select from JSON-File
- How to register a user via modal after clicking a link in the shortcode?
- add widget to page content (using shortcode)
- Pagination for a page created by the shortcode “Product”
- WordPress TinyMCE : Get value of popup button
- Freeze a shortcode in place?
- Unable to the get the gallery inserted between shortcodes
- Complex Slider Shortcode Help
- Using _e() on text inside video tags prints that text, instead of only showing when html5 element is not supported
- Youtube shortcode
- Shortcode will not pass attribute through to my function [duplicate]
- Displaying audio player as preview in audio post in WP3.6
- How to edit blog page in wordpress? there is no place to put shortcode
- How to transform WordPress user role code to WP shortcode?
- Does short-code slow down my WordPress site?
- redirect if shortcode exists
- Position shortcode off [duplicate]
- Video Shortcode & Video Poster Question
- How to use a nested shortcode to render the value of an attribute in parent shortcode
- ob_get_clean(); doesn’t return $value in shortcode?
- Which wordpress function is the caption shortcode linked to?
- Content between shortcodes
- Parsing a shortcode through an author meta textfield
- Adding YouTube button to TinyMCE editor
- How to find out what handler is registered to a shortcode
- Shortcode strips formatting and returns at content top
- do_shortcode within a shortcode
- tiny_mce_before_init preventing custom shortcode icon appearing
- Custom Fields – Boolean Display of True/False to Yes/No
- How to display NextGEN gallery in templates?
- Twitter bootstrap tabs
- jQuery Tabs in Shortcode API
- Echo Extra Shortcode HTML to wp_foot
- How can I use a plugin shortcode inside of a html form?
- Disable wpautop on Shortcode attributes
- remove shortcode pagination for specific url referrer
- I want to hide “sold by” on certain pages with id page 43
- If statement shortcode
- Shortcode PHP file for two conditions passed when do shortcode
- Using within a shortcode
- update_metadata() appends shortcode data for every page refresh
- Gallery shortcode is empty but magically creates a gallery
- Add audio file to post using custom term meta field as link [closed]
- Display tags cloud from a specific category ID with a shortcode
- Shortcode appeared twice on page, one time before content, one time where it’s really called
- How to list child pages with excerpts, e.g. [child-pages depth=”1″ excerpt=”1″]
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Inserting a variable into a shortcode inside php
- Shortcode for Admin Theme Option?
- Clarify: Enqueueing scripts within shortcode only loads in footer?
- What makes a placeholder resizable in Tinymce?
- Create plugin/function to catch XML-data via Shortcode
- Shortcode conversion to hrml when post is published
- Shotcode error on functions
- How to use multiple values in “Shortcode”? [closed]