【发布时间】:2014-08-01 18:40:59
【问题描述】:
大家好!根据我的阅读,将 PHP 代码添加到 wordpress 页面的最佳方法是通过自定义模板。所以我从主题中取出 page.php 并使用 html 代码对其进行自定义,没有任何问题。问题出在 PHP 代码上。无论我在哪里添加它,它都不起作用。
我的问题是在哪里添加用于表单验证的自定义 PHP 代码?
页面如下所示:
/*
Template Name: example
*/
<?php
get_header();
if ($tempera_frontpage=="Enable" && is_front_page()): get_template_part( 'frontpage' );
else :
?>
<section id="container" class="<?php echo tempera_get_layout_class(); ?>">
<div id="content" role="main">
<?php cryout_before_content_hook(); ?>
<?php get_template_part( 'content/content', 'page'); ?>
I added the HTML code here:
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?> " >
.....
</form>
<?php
endif;
get_footer();
?>
【问题讨论】:
标签: php wordpress forms templates