简体   繁体   中英

Wordpress Link Items to Display in Parent Sidebar

I have created a menu like so... http://tinyurl.com/p5xr852

You can see I have added links under "What's Happening?" which I want to use as page anchors from a sidebar.

What I need to do is have these items list in a sidebar when on the parent page.

I have done a heap of research and found that wp_get_links is now deprecated (see here http://codex.wordpress.org/Function_Reference/get_links )

Apparently this has now been replaced with wp_list_bookmarks()

Is there any way what so ever to do this? I don't want to go down the route of creating a heap of multiple menu's as I will be adding these links under post pages to act as page anchors.

I hope I understood correctly. You want that list of links displaying on the sidebar, when the user is in "What's Happening" -page OR any of it's child-pages?

If I didin't understand then just skip this but.

Create a new text widget that has your pages as a list like this:

<ul>
    <li><a href="#">Overview</a></li>
    <li><a href="#">Schedule</a></li>
    <li><a href="#">etc</a></li>
    <li><a href="#">etc</a></li>
    <li><a href="#">etc</a></li>
    <li><a href="#">etc</a></li>
</ul>

Then get the Widget Logic plugin: http://wordpress.org/plugins/widget-logic/ This plugin allows you to choose where widgets appear, for example in certain pages, in archives, in certain languages, in child-pages etc. Check out: http://wordpress.org/plugins/widget-logic/other_notes/ on how to make this link-list-navigation-widget to appear on the pages you want it to.

It's something like

global $post; return (is_page('15') || ($post->post_parent=="15")); 

You put the ID of the page on which you want the widget to appear on. And its child-pages with the latter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM