To put shortcode within a PHP template, use do_shortcode();
<?php
echo do_shortcode( '[like_to_read]The text that is hidden from the user.[/like_to_read]' );
?>
Edit:
<?php
echo do_shortcode( '[like_to_read]' . get_the_content() . '[/like_to_read]' );
?>
Related Posts:
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Using get_option() in JavaScript
- Shortcode empty attribute
- Shortcode outputs at the top of the_content
- Using wp_editor in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- How can I put a wp_redirect into a shortcode?
- Shortcode output always showing at top of page
- Short code to display a loop
- How to display the names of users from a specific group with a shortcode?
- How can I just get content inside a shortcode or just outside
- shortcode for logo image
- Stop strip_shortcodes() stripping content inside shortcodes
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- Using audio shortcode for .mp3 URLs with a query string
- WordPress core responsive video not working with shortcode
- Get multiple shortcode attribute values
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- Why do_shortcode is not executing the shortcode in data-* html attributes?
- How to display some selected user meta data on a specific page with a shortcode?
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Wraping $content into link with shortcodes
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- How to save a shortcode in a Gutenberg custom block?
- has_shortcode for content added after the content
- Shortcode displays only default attribute values
- Can a shortcode function this way
- Dynamically create shortcodes using add_shortcode and a callback
- Creating a Slider Shortcode Based on Nivo Slider
- Simple contact form with field validation
- Passing attributes to shortcode dynamically
- Stop parsing shortcodes
- Slow page loading when using a simple shortcode on the same page multiple times
- Remove and restore one shortcode
- WordPress auto adds p to shortcode parameters
- Remove empty p-Tags in Shortcode content before non p-Tags
- What is a short code?
- Why isn’t this youtube shortcode working?
- Gist shortcode is not working
- Using do_shortcode with variables?
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- ShortCode and extra
- Remove hyperlink on gallery shortcode
- How to change page title (from a plugin) in twentytwentyone theme
- WordPress Code Standards and Working $link Parameters In Shortcode
- How to set Contact Form 7 fields default value using shortcode attribute? [closed]
- Instagram URL is converted into oEmbed
- Shortcode with no attribute but has value
- Display post metadata: “title, category, author, date” with shortcode
- Remove wpautop from specific shortcodes only
- shortcode javascript not working on custom template file inside theme folder
- Combining similar shortcode functions?
- Shortcodes and a list of IDs?
- Check if post has gallery images/media
- Shortcode adding plugin output before post, instead of inline [duplicate]
- Stop auto formatting in shortcodes
- Convert HTML Script to Shortcode [closed]
- If you add a shortcode programmatically, but the code isn’t viewed on that request, is it still executed?
- How to build a shortcode which can insert a query string into a DB table
- Get URL Param Plugin and Inserting Result in Widget Code
- What is the Correct way to pass parameters in function
- Shortcode – Getting Categories appears on top of website
- Add shortcode support to custom field
- Visual Composer integration [closed]
- Preserve shortcode content formatting
- How to Modify WordPress Default Image Gallery Shortcode
- Passing html tags as shortcode parameters
- Registration Form Shortcode
- no content after shortcode
- Shortcode help: If no image entered take default
- Button Shortcode
- How can I escape a section of my page which contains multiple shortcodes?
- shortcode to display post by category entered by user without plugin
- Shortcodes in excerpts returning empty string
- Reloading a Mediaelement audio player
- Scripts for shortcode: concatenate or load separately? [closed]
- Shortcode is not processed when added to option field using wp_editor
- WordPress shortcodes are not working
- Adding Shortcode Values to wp_head
- How to use/enable Pagination?
- How to change the output of gallery shortcode
- Wrap Shortcodes and wpautop
- Placing tags on wordpress visual editor using shortcodes
- wp_list_pages shortcode jumps above previous content
- Shortcode attributes don’t appear?
- Shortcode called twice
- Favorite websites with shortened hyperlinks
- Best way to find all shortcodes that come with WordPress
- Shortcodes: closing shortcode not being processed
- Retrieving post excerpt as a shortcode
- Using Variables in Shortcodes
- Default Attributes in Shortcode Not Working
- Insert PHP code via shortcode?
- Replacement for gallery_shortcode function not taking all attributes
- Div-Wrap with Functions.php in Childtheme using Shortcode!