【问题标题】:Wordpress shortcode inside shortcode not working简码中的Wordpress简码不起作用
【发布时间】:2014-12-18 16:45:53
【问题描述】:

我正在使用允许您通过短代码创建选项卡的插件。 我为表单创建了一个短代码,但是当我将此短代码放在生成选项卡的插件的短代码之间时,表单不在选项卡中。

简码形式:

<?php
function test()
{
?>
<h1>Datos de Usiario</h1>
<form id="" action="" method="" >
<fieldset >
<legend>User Data</legend>
<input type='hidden' name='id_wp' value="<?php echo $user_id ?>" value='1'/>
<label for='nombre' >First Name*: </label>
<input type='text' name='nombre' id='' maxlength="50" />
<label for='apellido' >Last Name*: </label>
<input type='text' name='apellido' id='' maxlength="50" />
<label for='email' >Email Address*:</label>
<input type='text' name='emaild' id='' maxlength="50" />
<label for='ciudad' >City*: </label>
<input type='text' name='ciudad' id='' maxlength="50" />

<input type='submit' name='Submit' value='Submit' />

</fieldset>
</form>
<?php
}
?>

和 shorcode

function _test_() {

    return test();
}
add_shortcode('test', '_test_');

我在页面上放了这个

[fusion_tabs design="classic" layout="horizontal" justified="yes" backgroundcolor="" inactivecolor="" bordercolor="" class="" id=""]
[fusion_tab title="Datos Usuario" icon="fa-user"]

Hello!!


[/fusion_tab]
[fusion_tab title="Registrar Pedido" icon="fa-plus-circle"]

[test]

[/fusion_tab]
[fusion_tab title="Estatus Pedidos" icon="fa-question-circle"]

any!!

[/fusion_tab]
[/fusion_tabs]

这就是结果

image click here

【问题讨论】:

  • 这真的是你的简码吗? return rest();? rest() 是什么?
  • 对不起,测试不休息
  • 为什么不干脆去掉test(),把html放到_test_()里面呢?如果没有,你需要有test()return所有的html...
  • 在此下的新帖子中回答

标签: wordpress shortcode


【解决方案1】:

您需要在回调函数中返回 html,例如:

function test()
{
    $html = '';
    $html .= '<h1>Datos de Usiario</h1>';
    $html .= '<form id="" action="" method="">';
    // etc.

    return $html;
}

【讨论】:

    猜你喜欢
    • 2014-01-11
    • 2013-03-01
    • 2015-02-01
    • 2023-01-22
    • 2023-03-16
    • 2011-06-13
    • 1970-01-01
    • 1970-01-01
    • 2019-07-13
    相关资源
    最近更新 更多