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]
- How to add content region to a post or a page
- What hook runs wpautop on template content?
- wp:shortcode works in block theme template file but not PHP include file
- convert it into short code & explan how? [closed]
- Create custom page templates with plugins?
- Enqueue Scripts / Styles when shortcode is present
- Conditionally Loading JavaScript/CSS for Shortcodes
- What does extract( shortcode_atts( array( do?
- Custom templates not showing up in template dropdown
- How do I escape a ‘]’ in a short code?
- Pass boolean value in shortcode
- Show shortcode without executing it
- Shortcode always displaying at the top of the page
- Redirect function inside a Shortcode
- How to create a shortcode with 1 parameter (atts)
- Return HTML Template Page with PHP Function
- how to show the syntax of a shortcode
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- current_shortcode() – detect currently used shortcode
- How can I load a page template from a plugin?
- shortcodes output before content [duplicate]
- WordPress plugin shortcode not working
- How to add stylesheets only to pages with specific shortcode?
- Is there a WordPress plugin that registers a plugin file as a custom page template?
- Using get_option() in JavaScript
- Page editor missing Templates drop down
- Is it possible to stop selected plugins from loading on certain template pages?
- Passing parameters to a custom page template using clean urls
- Shortcode empty attribute
- How does a shortcode work?
- Shortcode outputs at the top of the_content
- the_excerpt and shortcodes
- Using wp_editor in shortcode
- Remove wpautop from shortcode content / remove whitespace in buffering
- Get current post id witout passing in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- How to add multiple buttons to TinyMCE?
- How to edit contents of dynamic_sidebar()?
- Check if post/page has gallery?
- How to check if a shortcode exists?
- Get first video from the post (both embed and video shortcodes)
- Get shortcode name from within it’s callback function? [duplicate]
- How to move page templates to custom folder?
- Setting a custom sub-path for blog without using pages?
- Ways to have multiple front-page.php templates that can be swapped out?
- Wordspress add into my javascripts
- Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
- How do I create a Shortcode that returns text if domain is .com, not .co.uk
- Using preg_replace to separate gallery from the_content?
- Remove specific shortcode from get_the_content()
- How to display the site name in a WordPress page, or post
- How to get IDs for objects in menu branch?
- Hide/show content starting in the middle of a paragraph
- Combining shortcode and get_template_part
- How can I put a wp_redirect into a shortcode?
- Escaping quotes from shortcode attributes
- Run visual composer code in php page
- short code output too early
- Shortcode in shortcode: How to append variable?
- Is there a way to parse shortcodes in PHP?
- Remove wptexturize from a shortcode?
- How can i put an array as variable in shortcode_atts?
- Autoembeds don’t work with paragraphs
- Table of Contents with a shortcode
- Is it possible to manipulate the list of page templates?
- Create custom [sourcecode] shortcode, the right way?
- TED talks shortcode not working
- Allowing shortcodes inside attributes
- What is the best way to enable nested shortcodes?
- Tinymce – How to hook before or after live shortcodes rendering?
- Using a page template without a page
- How to customize a shortcode using the customizer
- Native “playlist” shortcode random playing… How?
- How to Output HTML tags in do_shortcode?
- List of all inbuilt WordPress shortcodes
- Nested Shortcode Detection