get_template_directory()
and get_stylesheet_directory()
both pull form the wp-content/themes
directory. The difference being that the former always pulls from the parent theme directory.
Neither take parameters, so you just concatenate the rest of the path to the string returned from the appropriate function. That is:
include get_template_directory().'/inc/social.php';
If your file is not in your theme directory, you cannot use those functions. They are very specifically theme functions.
Related Posts:
- Include WP_Query in my own PHP file?
- Include a external PHP file into a WordPress Custom Template
- Include files in functions.php
- load/require specific php files for specific pages/templates/post types
- ob_get_clean returns empty string, ob_get_flush outputs string
- where to include a php file
- Include Class File in WordPress
- nowplaying.include.php Will Not Display Results
- integrating external php library into wordpress- the right way
- Change title and meta description in included page (not template)
- Can I change a variable in a content part while calling it?
- the_author() not working outside the loop
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Put CSS inside a PHP file and include it the right way
- functions.php is being included twice, creating PHP fatal errors
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- code is skipping a div
- Why does abstracting html from plugin code result in loss of access to wordpress functions?
- PHP include is only working in certain places in my custom WP theme
- Correct and safe way to include php content in my page
- What is the proper way to include a PHP framework into my theme?
- php include not working in custom page
- Post’s ID pattern?
- Using WP functions such as the_title() in an included php file
- What’s the best way to include PHP code in pages?
- How to include custom PHP file both in header and footer files
- Include a file that has a function in it
- 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
- loading a php file to a specific page id
- How do I fetch a data from an external database into my wordpress homepage
- How do I fetch a data from an external database into my wordpress homepage
- PHP get_category() function redeclared
- How do I / Is it possible to execute an external PHP file / function inside WordPress?
- Include a php file that is above WP installation hierarchically?
- How can I include a file related to blog URL? Nothing seems to work
- WordPress blog set up
- Shortcode not passing variable to included file
- php “use” not working in template [closed]
- How to include a php file in every post and page [duplicate]
- Shortcode to include PHP file, pass various parameters to include?
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- Should I use include(_once) or require(_once) for loading php-file with customizer settings?
- How to get the registered sidebar’s name by its id?
- Prevent publish status/date saved on transition_post_status hook
- WordPress php filter admin_body_class not working
- Mute Debug Messages from Plugins
- Reprinting tags with all attributes
- database sent to a JSON file
- Display css ONLY on most recent post of specific category?
- Calling PHP Titles inside Javascript Markup
- add the value of a variable returned in a while loop [closed]
- How do I edit the terms output args or array data?
- Gutenberg Blocks and get_option() for styling
- WP_QUERY post_in problem
- custom taxonomies not working
- Should I set a page as “No-index” if I include it’s content within the front-Page.php via this method?
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Is this correct get_template_part() in WordPress?
- How to show value from ACF plugin field in e-mail?
- how to display tables via ajax
- Login user into magento using wordpress account
- save array of objects with update_option
- What is the best way to reset the site? Different fails while set up
- How to conditionally concatenate and translate two very long strings?
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?
- seo meta description issue in google search
- Redirect loop upon installation of my plugin
- Find owner of coupon
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- REST API custom endpoints for metaboxes
- Add default block css when the block has been added with php?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Custom Post Type doesn’t have template content when creating programmatically in PHP but does when created in WP Admin
- Use of undefined constant issue
- Themeco Looper Provider Query String for current user posts [closed]
- Remove colon from CTP UI “Singular Label”
- Customize create table SQL statement in any WordPress plugin
- Deprecated: stripos(): Error in WordPress After Updating to php 8.1
- How can I display all these movies in DESC order by modified?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- WordPress Query – Blog Cards Duplicate issue
- PHP Works only for logged in users: [closed]
- WordPress wp_remote_request() – How to do async await in wordpress php?
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload
- Need help with conditional logic for menus
- Disabling User Email Notifications for Erase Personal Data Utility
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- generate excerpt from the part of big text dump that contains keyword
- How to sort search result by post_title, then by post_content
- Custom Admin Menu Report for Specific User ID
- how can i link threejs in my functions.php file in understrap theme
- WordPress / PHP: Check if column has value and then check if value in array
- How can add alt tag in following code. Image are showing dynamic in wordpress
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb
- How to modify default tags in wp_head()
- Can’t insert into a database wordpress
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress