2012-12-25 79 views
0

我做了一个wp菜单,列出了一堆帖子。 我可以列出这些帖子的标题,但不能列出它的内容。显示来自wp_nav_menu的帖子内容?

wp_nav_menu(array('menu'=>'Compatibility Matrix'));

如何显示每个项目的内容(帖子标题)?

回答

0

您不能使用wp_nav_menu函数列出帖子内容,该函数仅用于创建包含分配菜单项的帖子/页面标题或自定义标题的导航菜单。

您需要使用循环来显示内容。这是一个非常基本的循环:

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

    <?php the_content(); ?> 

<?php endwhile; ?> 
<?php endif; ?> 

您可以修改它以满足您的需求。这里有几个资源来帮助你:

http://codex.wordpress.org/The_Loop

http://wp.tutsplus.com/tutorials/theme-development/a-beginners-guide-to-the-wordpress-loop/