Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress快捷码返回另一个php页面_Php_Html_Wordpress_Plugins_Shortcode - Fatal编程技术网

Wordpress快捷码返回另一个php页面

Wordpress快捷码返回另一个php页面,php,html,wordpress,plugins,shortcode,Php,Html,Wordpress,Plugins,Shortcode,我的自定义wordpress插件快捷码在我刚返回某些内容时起作用。但我想返回另一个php页面,其中包含html 这是我的map.php 我的意思是短代码有效;当我尝试只显示像“abc”这样的简单字符串时,它可以正常工作,但我想在返回函数上显示另一个页面。要使用WordPress快捷码显示HTML视图,可以使用ob\u start和ob\u get\u clean函数 要使用WordPress快捷码显示HTML视图,可以使用ob_start和ob_get_clean函数 如果您想包含css

我的自定义wordpress插件快捷码在我刚返回某些内容时起作用。但我想返回另一个php页面,其中包含html

这是我的map.php


我的意思是短代码有效;当我尝试只显示像“abc”这样的简单字符串时,它可以正常工作,但我想在返回函数上显示另一个页面。

要使用WordPress快捷码显示HTML视图,可以使用ob\u start和ob\u get\u clean函数


要使用WordPress快捷码显示HTML视图,可以使用ob_start和ob_get_clean函数


如果您想包含css/js文件,我建议您使用wp_enqueue_scripts函数将它们包含在functions.php文件中。如果您想包含css/js文件,我建议您使用wp_enqueue_scripts函数将它们包含在functions.php文件中。
<?php 
function example($map){
    echo "Hello!"; 
    }
?>


add_shortcode( 'map_shortcode', 'map_shortcode' );
function map_shortcode() {
    wp_enqueue_style( 'my-css' );
    wp_enqueue_style( 'meyer-reset' );
    wp_enqueue_style( 'tooltipster-bundle' );
    wp_enqueue_script( 'mypluginscript' );

    return $map;}
?>

<?php
function map_shortcode() {

    ob_start();
    ?>  

    <!-- Your HTML codes here ...  -->

    <?php
    return ob_get_clean();
}
add_shortcode("map_shortcode", "map_shortcode");
?>