Use a separate function to enable shortcodes in the text widget because trying to do so within the shortcode function itself is too late.
// Enable the use of shortcodes within the text widget.
function wpse249090_widget_text_enable_shortcodes() {
add_filter( 'widget_text', 'do_shortcode' );
}
add_action( 'init', 'wpse249090_widget_text_enable_shortcodes' );
// Do TimeStamper Shortcode ( timestamper() )
function timestamper( $atts ) {
$time = current_time( 'timestamp' );
return $time;
}
add_shortcode( 'timestamp', 'timestamper' );
Related Posts:
- Using wp_editor in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
- How to display the site name in a WordPress page, or post
- Native “playlist” shortcode random playing… How?
- How to display the names of users from a specific group with a shortcode?
- shortcode for logo image
- Stop strip_shortcodes() stripping content inside shortcodes
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- How to display some selected user meta data on a specific page with a shortcode?
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- How to save a shortcode in a Gutenberg custom block?
- Is shortcode_unautop() broken?
- Some doubts about gallery shortcode in WordPress
- Shortcode displays only default attribute values
- Can a shortcode function this way
- Dynamically create shortcodes using add_shortcode and a callback
- Passing attributes to shortcode dynamically
- Stop parsing shortcodes
- How can I make a shortcode from this code?
- Meta tags in shortcode
- Adding PHP/HTML code inside page from custom template
- Display post metadata: “title, category, author, date” with shortcode
- shortcode javascript not working on custom template file inside theme folder
- shortcode get thumbnail size
- Shortcodes Keep Wrapping in
- Stop auto formatting in shortcodes
- Get URL Param Plugin and Inserting Result in Widget Code
- Problem with using custom shortcode with ACF WYSIWYG field
- Add shortcode support to custom field
- Preserve shortcode content formatting
- Shortcode help: If no image entered take default
- Populate shortcodes with table data and get next row
- Running shortcode with variable that is modified
- Reloading a Mediaelement audio player
- Shortcode is not processed when added to option field using wp_editor
- How to apply an ID to Shortcode Embedded iframe
- Adding Shortcode Values to wp_head
- wp_list_pages shortcode jumps above previous content
- Shortcodes: closing shortcode not being processed
- Retrieving post excerpt as a shortcode
- Using $this from child class inside shortcode function
- Insert PHP code via shortcode?
- Trying to call dynamic content as a shortcode attribute
- What is the correct syntax to append a URL using a shortcode for an iframe?
- Shortcodes in RSS excerpts
- How to trace shortcode to its functionality
- shortcode issue in the_excerpt
- If else with shortcodes
- Using shortcodes to communicate my page design
- enqueue script with get_shortcode_regex
- Use Contact Form 7 with Ajax
- How to get_post_meta in a shortcode in excerpt on archive pages
- WordPress upgrade adding additional quote marks to shortcode output
- How to build a shortcode for tabs
- Creating tabs shortcode
- SImple Example To Update User Info From Front End [duplicate]
- How to: Simple Nested Shortcode [closed]
- get_posts not working on homepage?
- How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
- ACF repeater + group shortcode
- Custom shortcode skips every 2nd shortcode
- Wrap template code with shortcodes
- my form does not insert any data in the database
- How to cache a custom API call?
- Can Someone Help me to Correct my shortcode for displaying a category?
- Shortcode custom query not passing value
- Simulate shortcodes with javascript
- How to create custom variables in wordpress
- How to use Shortcode from one WordPress page in another WordPress page?
- Unknow shortcode read on display site
- Onclick want to call shortcode in wordpress
- Working with Contact Form 7 pipes
- How to disable cache for the content returned by a shortcode
- Hide shortcodes content from the excerpt?
- WordPress Server Time not changing/displaying correctly
- Can we create a shorcode to move next page?
- Removing text + shortcode from all posts
- Is Post-Author-Id shortocde
- Load next post by ID on a single page
- Plugin Shortcode value in post
- Add catagory attribute to custom shortcode
- Woocommerce Filter Main Loop by Tag [closed]
- Shortcodes: override a shortcode / change shortcode on the fly
- Class variables in shortcodes
- Separating Custom Template logic
- Defining the output of a WordPress Att
- Remove width and height attributes from [gallery] output
- Custom WP theme not showing shortcodes
- Shortcode for sectors
- How to not show shortcode contents if cart is empty?
- woocommerce Product shortcode create [closed]
- Help with Shortcode Functionality
- Shortcode Site include in a other
- Why is my ajax live search not working when i use a shortcode to call it?
- How do write this type shortcode? [closed]
- WordPress functions.php shortcode is not working [closed]
- My first WordPress shortcode just returning []
- WordPress shortcode select option not working [closed]