小编sol*_*our的帖子

在侧边栏中添加页面

所以我有一个名为"最新消息"的页面并使用自定义模板t_latest_news.php

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="latest-news" id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
<?php edit_post_link('Edit this page','<p class="edit-link">','</p>'); ?>
</div><!-- /.latest-news -->
<?php endwhile; endif; ?>

我创建了一个页面项目并将一些内容放入该页面.现在,我想在侧边栏上显示内容.我该怎么办?

我尝试过类似的东西:

<?php include(get_query_template('t_latest_news.php')); ?>
<?php include(TEMPLATEPATH . 't_latest_news.php'); ?>
<?php get_query_template('t_latest_news.php') ?>
<?php get_template_part( 't_latest_news.php' ); ?>

但它们都不起作用.救命!


<?php query_posts('page_id=76'); ?>
<?php while (have_posts()) { the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
<?php } ?>
<?php wp_reset_query(); ?>

它适用于"page_id"但不适用于pagename.任何的想法?

wordpress

5
推荐指数
1
解决办法
1932
查看次数

标签 统计

wordpress ×1