include_once里面的回声..几乎得到了它但我需要一些帮助

时间:2015-02-19 03:05:54

标签: php wordpress include echo shortcode

我正在尝试将一个include_once插入一个echo do_shortcode,我的行是这样的:

<?php $activar = get_option("activar-pelicula"); ?> 
<?php 
if ($activar == "true") { 
  echo do_shortcode('[to_like]' .include_once "includes/single/player.php"; . '[/to_like]');
} ?>

这是我得到的错误:

  

警告:include_once(包括/ single / player.php [/ to_like]):失败了   open stream:没有这样的文件或目录   /home/novosfil/public_html/wp-content/themes/grifus/single.php上线   8

     

警告:include_once():打开失败   'includes / single / player.php [/ to_like]'包含在内   (include_path ='。:/ usr / lib / php:/ usr / local / lib / php')in   /home/novosfil/public_html/wp-content/themes/grifus/single.php上线   8

我正在尝试获取此行(原始行)

<?php 
$activar = get_option("activar-pelicula"); 
if ($activar == "true") { 
include_once "includes/single/player.php";
} ?>
用这个

在储物柜里面

<?php 
echo do_shortcode('[to_like]' HER GOES THAT PART OF THE PAGE '[/to_like]');
} ?>
好吧就是这样。 事先提前

1 个答案:

答案 0 :(得分:1)

你可以这样试试:

<?php $activar = get_option("activar-pelicula"); ?> 
<?php 
if ($activar == "true") { 
  ob_start();
  include_once "includes/single/player.php";
  $out1 = ob_get_contents();
  ob_clean();
  echo do_shortcode('[to_like]' . $out1 . '[/to_like]');
} ?>