简体   繁体   English

是否有任何要创建 static 页面( html )的主题 styles 不适用于 Z1870A829D9BC24ABFEZ06F

[英]Is there any to create static page ( html ) on which theme styles are not applied in wordpress

I want to make amp based static page like html but whenever i put that in wordpress, wordpress applies its theme styles and settings I want to make amp based static page like html but whenever i put that in wordpress, wordpress applies its theme styles and settings

I want that it should not be affected by wordpress atleast not any theme based css or javascript我希望它不受 wordpress 的影响,至少不受任何基于主题的 css 或 javascript

Thank you all谢谢你们

there must be a better way to do this please help Thanks again必须有更好的方法来做到这一点请帮助再次感谢

You are looking for Page templates.您正在寻找页面模板。

Page templates are a specific type of template file that can be applied to a specific page or groups of pages.页面模板是一种特定类型的模板文件,可应用于特定页面或页面组。

You can refer to @ https://developer.wordpress.org/themes/template-files-section/page-template-files/可以参考@ https://developer.wordpress.org/themes/template-files-section/page-template-files/

In short, you can create a new page template page-{slug}.php (save at root).总之,可以新建一个页面模板page-{slug}.php (在root下保存)。 We then need to tell WordPress that this new file is a "template".然后我们需要告诉 WordPress 这个新文件是一个“模板”。 We can do so through a comment header (bellow is a minimal version of it).我们可以通过评论 header 来做到这一点(下面是它的最小版本)。 You would probably need to include the theme header and footer too.您可能还需要包含主题 header 和页脚。

<?php

/*
 * Template Name: My new template title
*/

get_header();

// Page code here...

get_footer();

You could create a dedicated PHP template file for that page, which you only assign to that particular page, and which does not contain the get_header() function.您可以为该页面创建一个专用的 PHP 模板文件,您只分配给该特定页面,并且包含get_header() function。

Since besides not calling the theme stylesheet/s, this will also exclude a lot of other (necessary) functions, you could create a copy of your header.php file (in a child theme, if the theme isn't yours) which contains all the necessary functions and links except the link to the theme stylesheet, and call that "alternative header" file in your template for that page instead of using get_header() .由于除了不调用主题样式表之外,这还将排除许多其他(必要的)功能,您可以创建header.php文件的副本(在子主题中,如果主题不是您的)除了主题样式表的链接之外的所有必要功能和链接,并在该页面的模板中调用该“替代标题”文件,而不是使用get_header()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM