It is that simple. Code away!
if it’s in a plugin I do this:
$plugin_url = plugin_dir_url( __FILE__ );
include_once($plugin_url . 'inc/twitter.php');
if it’s in a theme file
include_once(get_stylesheet_directory_uri().'inc/twitter.php');
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
- PHP help get_template_directory + PHP include
- 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
- 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?
- external wordpress pages using wp-blog-header
- How do I enable HTML5 prefetching on this page?
- user_id error: Only variables should be passed by reference
- Is it necessary to upgrade to php7? [closed]
- How can I add pagination and how can I change thumbnail size?
- Call External Object in Class Function During Callback
- WordPress to end support for PHP 4?
- Why do WordPress rewriites seem to work differently for posts vs pages?
- Performance impact of rewriting WordPress URLs
- Mute Debug Messages from Plugins
- Reprinting tags with all attributes
- wp_ob_end_flush_all and wp_suspend_cache_addition()
- edit_comment_link is not showing for comment author
- Css loads very slow [closed]
- Why is image hard cropping for one image using add_image_size not working?
- database sent to a JSON file
- how to test for all children (including multilevel grand-childern) of page
- Dilemma of Populating all the categories in a drop down list
- Add item to top of menu using a filter in functions.php
- How to include seperate PHP file to class in callback function
- Password minimum length in personal subscription [closed]
- echo something inside a shortcode
- Double jQuery loaded
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Liking a facebook page from wordpress website?
- How do I define a lookup table that will work across all PHP elements of the template?
- Why does the Woocommerce grouped template prints the unpublished products?
- How to use two meta_compare in an array?
- Custom post type category not displaying category ID
- Convert canvas to image and upload image to server
- How to get the filename from file system and create a download link?
- Toolbar Hidden in a Virtual Page
- Conditional for Post Format
- How to Insert Ads After Every X Paragraph PHP
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Dynamically added custom fields not displayed on WooCommerce email notifications
- How to set a parrent page to single-post
- Run PHP 24hrs After Event Trigger
- Ajax result show in console if is called outside function and not showing in array
- Can I split a huge wp_postmeta table across different databases or servers?
- ACF – Custom image for Product Tags not displaying
- Does WordPress disable system functions?
- WordPress AJAX PHP(html) file that is within WordPress Loop
- Parsing webhook from Shopify in WordPress
- How to add text before posts
- Issue adding featured image option to functions.php
- What to create new post using wp_insert_post, but it repeat the post infinitely
- Allow the execution of an external PHP script for logged users
- Get terms of the posts with one query
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- Get unique post in parent category
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- a problem in class in class-wp-hook.php
- How do I a custom search form by taxonomies?
- WordPress REST API – Custom field not added to pages
- Woocommerce – add tracking code to another email template