【发布时间】:2016-06-08 17:53:09
【问题描述】:
我制作了一个海关脚本,用于根据用户的来源输出某个电话号码。我已经能够使用以下简单的 sn-p 在网站的标题中进行设置:
<?php include 'TelephoneNumber.php';?>
我现在需要创建一个简码,以便我可以在 Wordpress 测试编辑器中调用它。我创建了一个非常简单的短代码,但我无法弄清楚如何包含上面的文件名。
custom_shortcodes.php(放在 wp-content 文件夹中)
<?php
function telephone_number(){
return 'PHONE NUMBER HERE';
} // End telephone_number()
?>
function.php(主题)
include(WP_CONTENT_DIR . '/custom_shortcodes.php');
add_shortcode( 'telephone_number_sc', 'telephone_number' );
简码会在此处输出文本 PHONE NUMBER。但是,这没用,因为它没有调用我需要的脚本。
如何使用包含文件功能?
【问题讨论】: