我试图在我的模板文件中放置一个WordPress菜单.我发现使用wp_nav_menu不舒服,因为它输出的标记与我的静态HTML模板不兼容.我知道我可以使用自定义菜单walker类来修改wp_nav_menu的标记.但相反,我只想使用菜单名称及其相应的URL并将其放在我的模板中.为此,我使用此函数获取菜单的所有属性/属性的数组.
Array
(
[0] = WP_Post Object
(
[ID] = 20
[post_author] = 1
[post_date] = 2017-07-10 11:50:32
[post_date_gmt] = 2017-07-10 10:50:32
[post_content] =
[post_title] = About
[post_excerpt] =
[post_status] = publish
[comment_status] = closed
[ping_status] = closed
[post_password] =
[post_name] = about
[to_ping] =
[pinged] =
[post_modified] = 2017-07-10 11:50:40
[post_modified_gmt] = 2017-07-10 10:50:40
[post_content_filtered] =
[post_parent] = 0
[guid] = http://localhost/mySite/?p=20
[menu_order] = 1
[post_type] = nav_menu_item
[post_mime_type] =
[comment_count] = 0
[filter] = …