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
- How to redirect to post if search results only returns one post
- How to override admin-bar style
- 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 use get_media_embedded_in_content function
- 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
- WordPress Change Post Templates,but not drop down, but Image selection
- how to create shortcode in wordpress
- 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
- Problem with extract() with custom shortcode
- Displaying a random user with a shortcode
- Adding body class when post contains a specific shortcode
- Why isn’t is_page_template() adding a body class?
- Query children and parent title
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- creating shortcode to pull json array
- Pass Shortcode Attribute to footer Script
- Detect Safari desktop browser and include the detection in a shortcode
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- List child pages of specific page using shortcode
- How to create function from code?
- Display first name of logged in user?
- WordPress shortcode attributes for database SELECT?
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Retrieve tags data in post body
- Shortcode inserts paragraphs before and after executing shortcode
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Setting youtube size in functions.php
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Add button to kitchen sink toggle
- Optimizing a WordPress site
- Help With Creating Shortcode
- I have problems with loading javascripts
- Pass variable from action back to template
- Shortcode parse error – wrong syntax
- wp_nonce_field is breaking form for reasons unknown
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Best way to handle lack of titles in microblogging
- Echoing function into WordPress NextGen gallery
- Output loop to function return?
- Run a jquery script on on a certain template page
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- How can I pass a shortcode value to the head in wordpress functions.php
- Native gallery custom html output
- Need to convert image url to a Base_64 data url with wordpress function..
- dynamic site link for future migration in echo do_shortcode()
- Shortcode question
- Using functions.php to include code that’s processed inline
- Modify shortcode to work with custom post types
- shorthand syntax for custom fields
- Show admin page, only if function is being used
- show all the posts thumbnails
- Simplest Way to Build Custom Archives Page?
- Display ACF category image on archive and single template files
- How to require a config file in a template and in function.php?
- How to add if statement on WordPress shortcode output
- Passing function arguments via a shortcode
- Customizing the wp_video_shortcode output with add_filter
- Probleme shortcode with list author
- Function to function shortcode help [closed]
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- Shortcode to insert default text and change one word throughout it?
- WP Enqueue Script Error
- Shortcode Initialization in a Custom Theme
- WordPress function with attribute pass to template
- Show users last read posts for each user?
- Hide disclaimer from summary excerpts
- Function not receiving string from shortcode
- Javascript and Stylesheet in child page
- Shortcode to eliminate and replace with
- How to pass a variable from a template page to the child theme functions.php
- Problem in outputting shortcode
- Problem in shortcode outputting content
- Pull random comment from specific post, display on homepage with shortcode
- Set thumbnail from URL, by grabbing image in functions.php
- using enqueue_script in a shortcode isn’t working
- Gallery Shortcode Function Help
- Echo custom field value in shortcode function
- Shortcodes not outputting in correct divs
- How do grab the main loop, with conditions, and output via shortcodes
- PHP error in shortcode [closed]
- multible shortcodes (for differnt values) with one function