The locate_template()
function is intended to be used to locate/include template files, not functional files.
Just use include()
and/or require()
to include functional files in functions.php
.
Related Posts:
- How to extract the variables out from “add_shortcode” function?
- How to include any template using Shortcode fuction?
- Load templates, pass arguments, and render output from functions.php
- Shortcode to output get_header not working
- Creating mixture of shortcodes to use in the visual/text editor
- Solution to render Shortcodes in Admin Editor
- Use AJAX in shortcode
- How to redirect to post if search results only returns one post
- Include PHP file in Content using [shortcode]
- How to override admin-bar style
- Shortcode producing headers already sent error
- How to add attributes to a shortcode
- How to display random users with avatars
- wp_get_attachment_image returns different image size
- Enabling shortcodes for custom fields
- Passing variables to templates (alternatives to globalizing variables)
- Load post with a different template?
- How to customize search result page title?
- How to use get_media_embedded_in_content function
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- Shortcode with parameters inside parameters
- Creating a table from shortcode avoiding wpautop for each row
- How to fix a theme with page.php Default Template that accidentally deleted?
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Stripping shortcode from custom excerpt function
- WordPress Change Post Templates,but not drop down, but Image selection
- how to create shortcode in wordpress
- What is wrong with this Shortcode? I get it in a wrong place inside the content
- Display random text from a file with the WP built-in AJAX API
- Set first oembed in post to a global variable or function
- Formatting post content to exclude gallery
- Remove images from get_the_excerpt
- Shortcode with custom content attribute?
- Problem with extract() with custom shortcode
- Shortcode to insert menu in page body?
- Displaying a random user with a shortcode
- Passing HTML in WordPress Shortcode arguments
- Adding body class when post contains a specific shortcode
- Can I use require() function in a template file?
- How to set global variables in template page?
- Why isn’t is_page_template() adding a body class?
- Dequeue script in template isn’t working
- Function to show only first instance of shortcode
- Display a text message if the shortcode is found?
- Query children and parent title
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- Adjust which tempalte a page uses with a function?
- How to change menu icon which is overriden (i.e. by WooCommerce) [closed]
- Make “sidebar template” the default template for new pages
- creating shortcode to pull json array
- Retrieve post modified date for specific post by post ID
- Custom Shortcode, functions PHP WP_Query loop
- Pass Shortcode Attribute to footer Script
- Super simple shortcode not working
- Attach parent category template to all subcategories
- Detect Safari desktop browser and include the detection in a shortcode
- Add class or ID to any WordPress function
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- Display gallery on top before content
- List child pages of specific page using shortcode
- How to remove howdy dropdown menu content
- How to include local menu based on page id?
- How to create function from code?
- Display Password Protected external RSS in wordpress template
- Default Gallery Edit/Template Editable?
- Display first name of logged in user?
- How to enable template page only for a post id page
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- Selective Product Category for Carousel
- How to change login labels
- WordPress shortcode attributes for database SELECT?
- Shortcode pagination not advancing
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Modify a function without editing template
- Retrieve tags data in post body
- Having issues with a foreach inside of a shortcode with ACF gallery
- Shortcode inserts paragraphs before and after executing shortcode
- Display post shortcode content in the sidebar?
- How to get the index number of the posts?
- Using shortcode content with nested shortcode
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- How to filter $content in shortcode function
- Functions For Calling Specific Elements
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Setting youtube size in functions.php
- Full page template function
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Display gallery on bottom after content
- Add button to kitchen sink toggle
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Optimizing a WordPress site
- Help With Creating Shortcode
- wordpress use single ajax in place of multiple ajax requests in a smarter way