向 Wordpress 添加大型复杂的自定义页面?
Add a large complex custom page to Wordpress?
我有一个相当大的 html 页面,它有自己的 css 和 Javascript 我想添加到我的 Wordpress 网站,我创建了一个自定义页面,它可以工作,但是当我将自己页面中的代码粘贴到其中时,出现以下错误:
Parse error: syntax error, unexpected '<', expecting end of file in
C:\wamp64\www\wordpress\wp-content\themes\shapely\Custompage2.php on line 6
我的自定义页面看起来像这样,我不会 post 整个页面,因为它很大:
<?php /* Template Name: CutomPageT2 */
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> (this is line 6, including spaces)
<meta name="viewport" content="width=device-width,initial-scale=1">
----javascripts, css, rest of page etc
----
----
</table>
</div
</body>
</html>
?>
为您的页面顶部尝试此解决方案:
<?php
/*
Template Name: CustomPageT2
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
切勿将您的 HTML 包含在您的 PHP 中。绝不 ! ^^
编辑:
将页面名称更改为 page-custompaget2.php
。
我有一个相当大的 html 页面,它有自己的 css 和 Javascript 我想添加到我的 Wordpress 网站,我创建了一个自定义页面,它可以工作,但是当我将自己页面中的代码粘贴到其中时,出现以下错误:
Parse error: syntax error, unexpected '<', expecting end of file in
C:\wamp64\www\wordpress\wp-content\themes\shapely\Custompage2.php on line 6
我的自定义页面看起来像这样,我不会 post 整个页面,因为它很大:
<?php /* Template Name: CutomPageT2 */
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> (this is line 6, including spaces)
<meta name="viewport" content="width=device-width,initial-scale=1">
----javascripts, css, rest of page etc
----
----
</table>
</div
</body>
</html>
?>
为您的页面顶部尝试此解决方案:
<?php
/*
Template Name: CustomPageT2
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
切勿将您的 HTML 包含在您的 PHP 中。绝不 ! ^^
编辑:
将页面名称更改为 page-custompaget2.php
。