php Wordpress儿童页面模板

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Wordpress儿童页面模板相关的知识,希望对你有一定的参考价值。

There is no specific template for child pages, but you can do this pretty easily with the get_template_part() function.

First create a file called "content-child.php".

Second create a file called "content.php".

Next, inside of page.php, place this:

<?php
  if( $post->post_parent !== 0 ) {
      get_template_part('content', 'child');
  } else {
      get_template_part('content');
  }
?>

Anything that you want displayed on a child page will be placed inside of content-child.php. Anything you want displayed on non-child pages will be placed in content.php.

以上是关于php Wordpress儿童页面模板的主要内容,如果未能解决你的问题,请参考以下文章

css WordPress - 儿童主题模板(适用于网络代理商)

将 PHP 页面添加到 Wordpress 模板

php WordPress ::主题:: Divi儿童主题

php Wordpress页面模板使用Elementor与任何模板

php 页面模板(Wordpress)

php wordpress:从插件加载页面模板