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
- shortcodes output before content [duplicate]
- WordPress adds br in between my shortcode
- Shortcodes, HTML tables, and multiple rows
- Shortcode to Gutenberg-block: additional text on front-end and conditional display
- How navigation works in custom loop within shortcode?
- Use [shortcode=”value”] instead of [shortcode att=”value”]?
- I dont want to show shortcode in tag
- Post loop created via shortcode not displaying shortcode in content
- Shortcodes: Pros and Cons
- WordPress shortcode doesn’t working on HomePage
- Can’t understand $atts in functions?
- Are .MP3 files with capital letter extensions allowed in [audio] shortcode?
- Add attribute to shortcode dynamically
- Execute shortcode twice in the same page
- How to parse this shortcode?
- Shortcode parsed incorrectly because of heredoc
- Shortcode “post_per_page” not working
- Shortcode is running in page editor
- Creating shortcode with parameter
- Video Shortcodes not working in WordPress
- Create shortcode in Child Theme?
- Get post object in shortcode function
- How to insert image and text from admin panel throughout my theme
- Create a short code to display a specific loop
- Use shortcodes in terms description? [closed]
- How to add shortcode to HTML file (not showing on website)
- Custom Shortcode: define cursor position/insertion point?
- Buddypress shortcode for tabs [closed]
- show shortcodes in editor
- Image Shortcode from ACF ID
- Page code showing in WP Dashboard
- echo do_shortcode just prints the shortcode name and not its content
- How to create a shortcode with html and php code
- Insert shortcode between ”
- Create a shortcode to use in visual editor
- do_shortcode doesn’t work on some pages
- Custom youtube shortcode that uses $content
- How to build dynamic pages?
- How to reload the shortcode content when the database is changing
- Best way to include reusable sections in page content
- Regenerating WordPress shortcodes based on value with AJAX
- Custom shortcode to display posts, first post is full
- Form shortcode with multiple options as attributes
- How to add data attributes to the wordpress audio shortcode
- Beginner’s question about shortcodes
- How to execute a shortcode outside the post content/entry in a theme?
- Multiple instances of the shortcode on the same page
- Shortcode from admin textarea to page
- get data with shortcode
- Replace shortcode with output in database?
- Wrap php in shortcode
- Adding my own custom woocommerce shortcode to child theme, how?
- contact form 7 :create shortcode usable in email message [closed]
- Excerpt Length & List Category Posts Plugin
- Iteratively add sub shortcodes to php array
- How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post
- Execute Shortcodes when submitting post
- Substituting value via shortcode
- Create shortcode for each form field in contact form 7
- Can’t render shortcode when html tag contains hyphen
- Auto embeds don’t work for attachment descriptions
- Shortcode to appear and show the date not code in Title and description of Social Media sites
- Not to escape a text
- how to add shortcode widget at end of main blog page
- Shortcode result appears above page content
- Shortcode is not showing content when placed in editor (post_type = page)
- How to set up posts per page on WP
- How to insert a short code into Contact Form 7 in WordPress that will call a function once the submit button is pressed
- How to Call Related Post based on Categories Inside Post Content with Shortcode?
- Unable to make shortcode, what is wrong?
- Multiple shortcodes only use attributes from one of the shortcodes on custom plugin
- Cannot modify class property from shortcode handler function
- How do i remove Business feeds Shortcode fatal error
- Can’t place endwhile in the loop properly in a shortcode
- How to reduce the image size inside an icon? [closed]
- How to insert visual compser post grid shortcode in a custom page template? [closed]
- latest posts shortcode with image
- Shortcode tags appear on mobile themes
- Video shortcode inside tabs shorcode NOT working
- Manipulated shortcode output
- Where is escaped the shortcode?
- How to add meta slider lite or other slider to main page header in pinboard theme
- Str_replace using shortcode with multiple changes
- Changing layout of defaul gallery output to masonry
- WordPress do_shortcode first iteration
- Add a short code to a plugin
- Add widget/shortcode to sidebar OUTSIDE of the theme
- How to remove https:// from shortcode generated url
- How to enable on custom shortcodes
- Nested ShortCode works inside the_content, but not outside of it