This was a tough one to figure out, but I finally got it to work. You have to use locate_template
to build the url like so:
include(locate_template('codesnippet.php'));
Related Posts:
- Can I change a variable in a content part while calling it?
- functions.php is being included twice, creating PHP fatal errors
- How do I call an external php non WordPress class into functions.php?
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Before & After Content – After Content directly below Before Content when using require_once
- PHP get_category() function redeclared
- php “use” not working in template [closed]
- Shortcode to include PHP file, pass various parameters to include?
- How to set and use global variables? Or why not to use them at all
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- Is it possible to disable a function of a parent theme?
- Hide old attachments from wp media library
- Enqueue Javascript Correctly for 3.5
- How to add active class to custom menu using while loop and wp_list_pages
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Add footer.php to WordPress child theme
- Need to get specific data from array
- WooCommerce – Display variation custom field value [closed]
- Restrict WordPress File Type Uploads by User Type
- Problems with function on function.php
- Woocommerce HTML email option unavailable
- Use template for posts with a particular category grandparent
- How to slow down server response
- Click loads template via ajax
- How to change a public function inside a class of a plugin?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Function set default image when image not present
- WooCommerce – Reset quantity input field when variation changes
- Use menu link or onClick to set a variable
- Automatically remove a canceled order in Woocommerce
- Trying to establish connection to External Database
- WordPress add post format support not working
- How to remove the cufon script from Dzonia Lite theme [closed]
- Login/logout in header
- How to put “Read more” link in Custom Excerpt inside p tag?
- Get users that likes the post
- Create highly customized submenu (possibly using wp_list_pages)
- Get the date of the className or classID
- $wpdb->wp_users returning empty value for
- WordPress Custom field Colors
- php syntax : [ && ] between commands [closed]
- My custom get_the_excerpt() can’t get excerpt by ID
- Which PHP page is the Default Posts Page
- meaning of (array)function()
- Need to put a script above tag in header.php – WP 5.7.1
- Sending a custom form data in email through WP Mail Function
- deactivating an active plugin using if page
- Isotope Drop Down Categories Filter Function
- How to use array in function to get only value I want
- How to add PHP code in functions.php wordpress
- add_filter function concatenate string and locate_template function
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- How to use the checked() function to check for a non-empty var
- get_page_templates only return templates with “home” in the filename
- Show different website layout if no sidebar added
- Add a select-option to the default widgets
- Function to call either single post or category
- Updating Metadata with Shortcode
- can’t load .po file in functions.php
- WP-Bakery – Add custom colors to buttons with template colors
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Create shortcode for metabox gallery
- Add Pre-Defined Value to Click Counter in WordPress
- How can I redefine WordPress wp-content directory programmatically?
- Trim Titles Only On Some Pages
- How to move a post from one category to another
- Show data obtained from a function and place it in a shortocode function
- get_the_author_meta( ‘ID’ ) just return 1
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- Enqueue sripts and styles only if function is called
- Site title not showing. Please help me
- WP_Query To Display Product Of Brand On Taxonomy Page
- ajaxurl usage for a custom function
- oembed facebook link?
- Open/closed function [closed]
- Need to Echo A Url path to show on a wordpress page
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- add a value to an external link query in searchform
- wordpress ajax return 0
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- site_url() returns with additional backslashes
- Overwriting a Shortcode
- How to get category pages to look like a certain archive page?
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- How to call a specific value within the functions.php file?
- A next page function with shortcode?
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Warning: filemtime(): stat failed for wp_
- Keep users logged in Without Remember Me
- How to use js variable to php in wordpress functions.php
- Dynamic Email Handler with ‘header (“Location: …’
- WooCommerce: write featured image dimensions to custom fields in product’
- Generate and upload screenshot as featured image for user-submitted post
- transition_post_status hook, works – but not if the post is new