[wordpress插件] Child Page Templates子页面模板

wordpress 插件 文章 2020-03-22 23:00 528 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Allows theme authors to include templates that will be automatically used based on the page’s parent.

允许主题作者包括将根据页面的父级自动使用的模板。

For example, adding the file “page-123.php” to the “child-page-templates” folder in your theme directory will define the template for all pages that are children of the page with ID #123.

例如,将文件“ page-123.php”添加到主题目录中的“ child-page-templates”文件夹中,将为ID为#123的页面的所有子页面定义模板。

You can also do the same thing with the post’s slug.

您还可以对帖子的内容进行同样的操作。

This template file will be used for all pages that are children of the page with ID #123:

此模板文件将用于ID为#123的页面的子页面的所有页面:

/wp-content/themes/your-awesome-theme/child-page-templates/page-123.php

/wp-content/themes/your-awesome-theme/child-page-templates/page-123.php

This template file will be used for all pages that are children of the page with the “team” slug:

此模板文件将用于所有带有“ team”子句的页面的子页面的页面:

/wp-content/themes/your-awesome-theme/child-page-templates/page-team.php

/wp-content/themes/your-awesome-theme/child-page-templates/page-team.php

安装步骤

    1. Extract the zip file and drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the plugin from the “Plugins” page.
    2. 解压缩zip文件并将其内容拖放到WordPress安装的wp-content / plugins /目录中,然后从“插件”页面激活插件。

    3. Create a folder in your theme (or child theme, if you use one) called “child-page-templates”
    4. 在您的主题(或子主题,如果使用子主题)中创建一个名为“子页面模板”的文件夹

    5. Add a PHP file named after the slug or ID of the parent page you want to use a custom template for.

    6. 添加一个PHP文件,该文件以您要使用自定义模板的父页面的子段或ID命名。

        • For example: If you want every child page of your “Portfolio” page to use a particular template file, name that template file “page-portfolio.php”
        • 例如:如果您希望“ Portfolio”页面的每个子页面都使用特定的模板文件,则将该模板文件命名为“ page-portfolio.php”

下载地址
https://downloads.wordpress.org/plugin/child-page-templates.zip
-EOF-

AI助手支持GPT4.0