在wordpress中的另一个模板中包含一个模板

时间:2013-03-08 03:46:44

标签: php wordpress

我正在开发一个非常简单的wordpress项目。其中一个页面将包含我的项目和一些文本的缩略图,当我点击缩略图时,它将使我进入与项目相对应的页面。我创建了一个模板,我试图包含另一个只能保存缩略图的模板。我希望能够从wordpress仪表板更新两个不同页面的缩略图和文本。这就是我到目前为止......这个概念有点愚蠢......如果我正确解释的话,请告诉我

让我们说这是渲染模板

<?php
/*
Template Name: projects
* This template displays project thumbnails and introductory copy as a rendering template
*/
$options = twentyeleven_get_theme_options();
$current_layout = $options['theme_layout'];
get_header();?>

        <div id="primary">
            <div id="content" role="main">

                <?php while ( have_posts() ) : the_post(); ?>

                    <?php get_template_part( 'content', 'page' ); ?>

                    <? /*php comments_template( '', true ); */?>

                <?php endwhile; // end of the loop. ?>
                <?php get_template_part( 'projectThumb', 'true' ); ?>
            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_footer(); ?>

这是缩略图模板。

<?php
/*
Template Name: projectThumb
* This template displays project thumbnails at the project page
*/
$options = twentyeleven_get_theme_options();
$current_layout = $options['theme_layout'];
get_header();?>

        <div id="primary">
            <div id="content" role="main">

                <?php while ( have_posts() ) : the_post(); ?>

                    <?php get_template_part( 'content', get_post_format() ); ?>

                <?php endwhile; ?>

            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_footer(); ?>

0 个答案:

没有答案