模板调用函数:get_template_part()

举例1:
<?php get_template_part( ‘content’, ‘blog’ ); ?>
意思是说,如果content-blog.php存在,则调用content-blog.php,否则,就调用content.php
举例2:
<?php get_template_part( ‘template/content’, get_post_format() ); ?>
<?php get_template_part( ‘template/content’, get_post_format() ); ?>

 

举例:

 

Leave a Reply

Your email address will not be published. Required fields are marked *