这是在Question and Answer Forum plugin 对于Wordpress:
[question_form width=\\\'x\\\' bordercolor=\\\'x\\\' style=\\\'x\\\']question form title[/question_form]
此短代码称为:
//allow short codes [question_form]
function question_form($atts,$content = "")
{
global $questionformid;
include "askquestionform.php";
return $html;
}
add_shortcode(\'question_form\',\'question_form\');
这是askquestionform。php:
<?php
load_plugin_textdomain( \'qna-forum\', false, \'question-and-answer-forum/languages\' );
if(get_option(\'q_loginrequired_ask\')=="TRUE" && !is_user_logged_in())
{
$html = "<p>".__("Please login to ask a question",\'qna-forum\')."</p>";
$html .= q_loginform(get_permalink());
return $html;
}
//STYLING INFORMATION=============
$formstyle = "";
$introstyle = "";
if(isset($atts[\'width\']))
{
$formstyle .= "width:" . $atts[\'width\'] . ";";
}
if(isset($atts[\'style\']))
{
$formstyle .= $atts[\'style\'];
}
if(isset($atts[\'bordercolor\']))
{
$formstyle .= "border: 2px solid " . $atts[\'bordercolor\'] . ";";
$introstyle .= "background-color:" . $atts[\'bordercolor\'] . ";";
}
if(!isset($_POST[\'title\']) || $_POST[\'title\'] == null)
{
$qtitle = __("Enter Question Title",\'qna-forum\');
}
else{
$qtitle = $_POST[\'title\'];
}
if(!isset($_POST[\'question\']) || $_POST[\'question\'] == null)
{
$Qtext = __("Enter Your Question Here",\'qna-forum\');
}
else{
$Qtext = $_POST[\'question\'];
}
$html = \'<form class="questionform" name="questionform-\'. $questionformid . \'" id="questionform-\' . $questionformid. \'" style=\\\'\' . $formstyle. \'\\\'>
<div class="question-form-intro" style="\' . $introstyle . \'">\';
if($content != "")
{
$html = $html . $content;
}
else
{
$html = $html . __("Use the form below to ask a question",\'qna-forum\');
}
$html = $html . \'</div>\';
include_once (ABSPATH . \'wp-content/plugins/question-and-answer-forum/coreform.php\');
$html = $html . \'</form>\';
$questionformid = $questionformid + 1;
我创建了一个名为,
question-form-page.php, 我粘贴了
askquestionform.php 但不显示任何内容(空白)。
我还尝试在question-form-page.php:
question_form($atts,$content = "")
以及
global $questionformid;
include "askquestionform.php";
return $html;
但我得到了同样的结果。
有什么建议吗?