例如:<?php get_sidebar(); ?>   
      <?php get_sidebar(); ?> : 调用Sidebar模板 为何可以直接调用该函数 ,不需要引用?

解决方案 »

  1.   

    get_sidebar()是在wp-includes\general-template.php这个系统文件中定义的
    function get_sidebar( $name = null ) {
    do_action( 'get_sidebar' ); $templates = array();
    if ( isset($name) )
    $templates[] = "sidebar-{$name}.php"; $templates[] = "sidebar.php"; if ('' == locate_template($templates, true))
    load_template( get_theme_root() . '/default/sidebar.php');
    }
      

  2.   

    wp-includes\general-template.php系统文件中已申明了