Actually it depends. If you’re adding the functionality through a custom plugin or any third party solution rather than theme then the shortcode is best, otherwise you can use a template. You also can use template file with plugin, but then the theme and the plugin will be tightly coupled. That’s kinda not preferred. But you can still do it.
Remember for shortcode, it’s better to clean the output buffer.
Related Posts:
- Add Content to Page without shortcodes
- Adding short codes from a page’s content on header and hiding the same from page’s content
- Adding PHP/HTML code inside page from custom template
- How to create a shortcode for custom page template
- Error do_shortcode In WooCommerce 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
- Print shortcode in defined area
- Adding a template part as part of a shortcode
- Using shortcodes to communicate my page design
- When are Shortcode Attributes Available in Template
- Enclosing Shortcode not working in a Template
- Getting Shortcode Attributes befor content is displayed by the template
- my form does not insert any data in the database
- Use atributes of shortcode in get template part
- Push Shortcode parameter to template
- Separating Custom Template logic
- Using shortcodes that wrap around code
- Can not get shortcode content in function
- Enclose article’s body with default shortcode
- Create a shortcode to display the “the_content ()” in my post [closed]
- wp:shortcode works in block theme template file but not PHP include file
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Combining shortcode and get_template_part
- Using a page template without a page
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- shortcode inside another shortcode
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- shortcode to create dynamic dropdown box form shortcode attributes
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Can’t seem to get [shortcode]s to work
- Accessing $post variable from template part
- nested Shortcode doesn’t work
- How to override Category rendering mechanism
- Slow page loading when using a simple shortcode on the same page multiple times
- TinyMCE get selected text and underlying HTML
- Remove and restore one shortcode
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- Using do_shortcode with variables?
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- Advanced Custom Fields – display when specific template used?
- Remove hyperlink on gallery shortcode
- Combining similar shortcode functions?
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- Convert HTML Script to Shortcode [closed]
- What is the Correct way to pass parameters in function
- Shortcode – Getting Categories appears on top of website
- Passing html tags as shortcode parameters
- Registration Form Shortcode
- Remove shortcodes that are different (but same pattern) in each post
- displaying category and subject posts
- Conditionally Loading JavaScript/CSS for Shortcodes
- wp_list_pages shortcode jumps above previous content
- Custom post type pages return 404 page?
- Adding wrapper elements in the_date() like in the_title()?
- Using $this from child class inside shortcode function
- Div-Wrap with Functions.php in Childtheme using Shortcode!
- How to trace shortcode to its functionality
- shortcode issue in the_excerpt
- If else with shortcodes
- How to check if a post has any one of many shortcodes?
- Use Contact Form 7 with Ajax
- Is it possible to add a shortcode’s content to a table?
- How to build a shortcode for tabs
- Creating tabs shortcode
- SImple Example To Update User Info From Front End [duplicate]
- Plugin renders in preview but shortcode shows when published
- How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
- Wrap template code with shortcodes
- Can Someone Help me to Correct my shortcode for displaying a category?
- Simulate shortcodes with javascript
- How to use Shortcode from one WordPress page in another WordPress page?
- Unknow shortcode read on display site
- the_excerpt displaying code inside style tag
- WordPress Server Time not changing/displaying correctly
- How to make a shortcode with a line break in it parse correctly?
- Plugin Shortcode value in post
- Create dynamic content from one WP page to multiple other pages
- Woocommerce Filter Main Loop by Tag [closed]
- Shortcodes: override a shortcode / change shortcode on the fly
- woocommerce Product shortcode create [closed]
- A number appears inside a div called wpb_wrapper, when I use a custom shortcode
- Shortcode Site include in a other
- Why is my ajax live search not working when i use a shortcode to call it?
- WordPress functions.php shortcode is not working [closed]
- My first WordPress shortcode just returning []
- WordPress shortcode select option not working [closed]
- Hook into existing shortcodes to manipulate the attributes?
- How can I hide the ACF shortcode when empty
- Using variable as shortcode parameter
- How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. ‘post-type’)?
- How to use Shortcodes?
- What’s the syntax for embedding a Goggle sheet in a shortcode?