Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress-自定义字段&;wp_导航菜单_Wordpress_Menu - Fatal编程技术网

Wordpress-自定义字段&;wp_导航菜单

Wordpress-自定义字段&;wp_导航菜单,wordpress,menu,Wordpress,Menu,我想在主页的内容中添加特定父页面的子页面列表。为此,我尝试在自定义字段中添加wp\u nav\u菜单,但没有成功 请建议检查以下代码是否适合您 http://wordpress.org/support/topic/including-the-parent-page-in-a-list-of-subpages <?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$po

我想在主页的内容中添加特定父页面的子页面列表。为此,我尝试在自定义字段中添加
wp\u nav\u菜单
,但没有成功


请建议检查以下代码是否适合您

http://wordpress.org/support/topic/including-the-parent-page-in-a-list-of-subpages

<?php
  if($post->post_parent)
  $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  else
  $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  if ($children) {
$parent_title = get_the_title($post->post_parent);?>
<li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li>
  <?php echo $children; ?>
  <?php } ?>
http://wordpress.org/support/topic/including-the-parent-page-in-a-list-of-subpages

  • 感谢您的及时回复-但我在主页产品上有3个专栏,关于,地址,我正试图通过自定义字段来完成。对于产品,我需要查看wp_nav_菜单。