I have had a customs script made to output a certain phone number depending on where a user has come from. I have been able to set this up within the header of a website using the simple snippet of:
<?php include 'TelephoneNumber.php';?>
I now need to create a shortcode so that I can call this within the Wordpress test editor. I have created a very simple shortcode but I cannot work out how to include the filename above.
custom_shortcodes.php (placed in the wp-content folder)
<?php
function telephone_number(){
return 'PHONE NUMBER HERE';
} // End telephone_number()
?>
function.php (themes)
include(WP_CONTENT_DIR . '/custom_shortcodes.php');
add_shortcode( 'telephone_number_sc', 'telephone_number' );
At the minute the shortcode does output the text PHONE NUMBER HERE. However, this is useless as it's not calling the script I need.
How can I use the include file function?