-1
A
回答
0
與wp_list_pages解決它:
功能build_navigation_menu(){
// Get contact page by title
$contact_page = get_page_by_title('Contact');
// If exists get ID
if ($contact_page) {
$contact_id = $contact_page->ID;
}
// Get home page by title
$home_page = get_page_by_title('Home');
// If exists get ID and fetch home page link
if ($home_page) {
$home_id = $home_page->ID;
$args = array(
'include' => $home_id,
'title_li' => '',
'depth' => 2
);
$home_page = wp_list_pages($args);
}
// Get all links except contact and home
$args = array(
'exclude' => $contact_id . ',' . $home_id,
'title_li' => '',
'depth' => 2,
'walker' => new pdc_walker()
);
$pages = wp_list_pages($args);
// If contact page exists fetch link
if ($contact_page) {
// Add call me now link
$call_now = '<li class="call-now"><a href="#">Call now</a></li>';
$args = array(
'include' => $contact_id,
'title_li' => '',
'depth' => 2
);
$contact_page = wp_list_pages($args);
}
$navigation_pages = $home_page . $pages . $contact_page . $call_now;
return $navigation_pages;
}
相關問題
- 1. ZF2導航訂單
- 2. 更改了Wordpress中的導航點
- 3. 用Javascript更改導航CSS的WordPress的
- 4. 更改WordPress主題導航欄定位
- 5. 導出WordPress導航菜單
- 6. wordpress博客文章訂單更改
- 7. Wordpress WP_Query訂單不能更改爲ASC
- 8. WordPress導航菜單不再更新
- 9. WordPress的 - 自定義字段的分類單導航訂單
- 10. 更改導航
- 11. 如何更改WordPress的導航菜單的默認ID和類
- 12. Wordpress-如何更改導航菜單的默認字體?
- 13. Django CMS - 導航訂單
- 14. 更改訂單
- 15. 更改訂單
- 16. 更改訂單
- 17. 更改訂單
- 18. Wordpress導航菜單圖片
- 19. 導航菜單中的WordPress
- 20. WordPress導航菜單溢出
- 21. 刪除WordPress導航菜單
- 22. WordPress的:在導航菜單
- 23. Wordpress導航菜單問題
- 24. WordPress的導航菜單
- 25. Eclipse M2E /更改訂單和導出
- 26. 如何更換另一個導航菜單WordPress的導航菜單?
- 27. 點擊更改導航抽屜菜單
- 28. JavaFX8 DatePicker:更改導航菜單
- 29. 更改導航抽屜清單onstart
- 30. listview更改訂單
是的,這是可能的CSS或JS。你目前的頁面代碼是怎樣的?你可以發佈代碼或鏈接到頁面? –
我通過使用wp_list_pages構建自己的導航函數來解決此問題。 – Kris
很高興你解決了它。您可以發佈解決方案,以便其他人可以從中受益嗎? –