The shortcode wraps something in header tags. For the shortcode to work you need to provide that something.
Your code above works fine, you just need to set $content="My header text"; prior to echoing the shortcode in your template. currently you are not wrapping anything in the header tags.
But you shouldn’t need to use a shortcode for wrapping in HTML tags- just use the html:
<h1> My header text</h1>
rather than
<?php echo do_shortcode( '[datecode]' .'My header text'. '[/datecode]' ); ?>
Related Posts:
- Adding PHP/HTML code inside page from custom template
- How to create a shortcode for custom page template
- shortcode javascript not working on custom template file inside theme folder
- WordPress shortcode display as plain text
- Problem with multiple shortcode in page template
- Using shortcodes to communicate my page design
- Shortcode or Template Page
- Push Shortcode parameter to template
- Separating Custom Template logic
- Can not get shortcode content in function
- current_shortcode() – detect currently used shortcode
- Get shortcode name from within it’s callback function? [duplicate]
- Add Content to Page without shortcodes
- Tinymce – How to hook before or after live shortcodes rendering?
- How to customize a shortcode using the customizer
- Stray closing paragraph tag when using shortcodes
- Get post id shortcode
- Getting attribute value from shortcode
- Get shortcode attributes outside shortcode function
- How to make this shortcode work for post content
- Problem with email_exists in shortcode
- Alternate text if shortcode returns no data
- sql query in shortcode not working
- Global, network-wide shortcodes or text replace functions
- Video size and border radius using a shortcode
- How to use div class between the shortcode variable?
- wp_editor returns the shortcode and not render the output
- Prevent wordpress from rendering shortcode in post
- Error do_shortcode In WooCommerce Template
- Embedding Instagram via shortcode doesn’t work as advertised in official docs
- Execute shortcode only once in the page
- Can a shortcode return its own name?
- Order Woocommerce Products by Latest Reviewed
- $content not null in shortcode, even though it is self closing
- Nesting shortcodes results in the inner shortcode being placed AFTER outer shortcode
- i have create shortcode that work but not perfect coding
- menu item to display the most recent post
- how to format / execute post content and shortcode?
- How to get the $atts of a shortcode
- Getting the count of a shortcode that is nested
- Creating a short code with php inside
- Shortcode output appearing at the top of the page only [duplicate]
- Is it possible to modify the header with a content shortcode?
- PHP/WordPress — How do I check if Shortcode returns content?
- Add shortcode with open close function
- this simple shortcode doesn’t generate Collapse as supposed
- Shortcode outputting at top of content
- Will a shortcode placed inside a paragraph tag still be valid?
- Shortcode Strategy
- Enclosing Shortcode is acting like self-closing
- Shortcode into the same shortcode
- How do I define and register a shortcode function in a namespaced functions.php file?
- Change user meta value with shortcode
- Execute shortcodes in PHP
- Implementing a URL Shortener
- WordPress User ID as Shortcode
- Clean way of using ob_start() and ob_end_clean() in wordpress
- Theme Convert PHP code to shortcode
- find shortcode inside content of post
- WordPress Short code for List style
- Adding a cover image to video shortcode
- How to add site tags in alphabetical order to shortcode?
- WordPress post shortcode pagination not working
- Using shortcodes in the Site Title
- Shortcode do not return a value
- Problem parsing long parameter in shortcode
- How to use multiple (or array) values in $content of shortcode?
- How to display content if user meta data isn’t empty with shortcode
- How to display total user count by specific role in WordPress as statistics?
- User name in referral URLs
- How to style inline code in block editor?
- Is it possible to capture the content outside/between shortcodes?
- Add Style to text in a PHP block
- How I can add placeholder in shortcode
- I’m using rtMedia and Youzer. Can Shortcodes be used to display a video gallery?
- Help with a function to create a shortcode
- How to add new images to existing shortcode configuration?
- Content included from pagination
- Term Description Echo or Return – display problems
- Shortcode with multiple paramaters
- Running Filter or Shortcode Before Query Prevents Excerpt from Showing
- Replace custom gallery shortcode with default gallery shortcode
- Custom shortcode is not working inside tabs
- Referring to site URL in shortcode argument
- Shortcode not accepting atts
- Code auto escaping is not working when using short codes
- Shortcodes: Return different based on atts
- Shortcodes in Options Panel textareas
- How to Convert Shortcode into a link?
- wp_register_script and wp_register_style when shortcode is used
- Insert shortcode in widget area
- Good example of a short code +4346? [closed]
- Show realtime Amazon price without API using shortcode
- Identifying first and last instance of shortcode in post
- Executing a shortcode at the top of PAGE template?
- Display a block conditionally based on user input button
- Custom shortcode with < in content
- Product description is mixed in shortcodes
- Why does my JavaScript work in the browser console but does not work in my shortcode?
- add_action to only be called if uploading media from the front end