WordPress.org

Ready to get started?Download WordPress

Forums

CSS for styling wp_list_bookmarks current link (6 posts)

  1. tr123
    Member
    Posted 5 years ago #

    I am trying to see if I can use wp_list_bookmarks to create the navigation on the top of my wordpress CMS website (instead of using wp_list_pages as I want to specify the word links). I would like to be able to style the current active link and wondered if there was a set class for this? Or any other way of doing it?

    Thanks

  2. moshu
    Member
    Posted 5 years ago #

    That's a nonsense: once clicked a link from your bookmarks, you leave the site. Don't forget, the "bookmarks" are external links, so once you left the blogsite, what is "current"?

  3. tr123
    Member
    Posted 5 years ago #

    What I am trying to do is use the bookmarks for internal links, because if I use wp-list-pages as far as I can work out I have to have the link name the same as the page title so if my page title is "Welcome to or company" that is what the navigation link will be. I want the navigation link to be something short like "welcome".

    I know I could create the links by hand using HTML but I want to be able to highlight the current link a user is on. I have read the section on codex about dynamic links but can't get this to work. (I don't know PHP)

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    wp_list_bookmarks does not create any sort of "current" class like the other pages do, because it is designed primarily to link to external sites instead of internal ones.

    So yes, you can use it in the way you are thinking, but it's not the best way to do it, and you can't get "current" links out of it at all.

    On the other hand, while wp_list_pages does make you use the "Title" as the link name, maybe you should make the Page Title into "Welcome" and then use a Page Template that does not show that Title. In other words, make a "No Title" Page Template, use it for your Pages, and then as the first thing in the content of the page, put the real title you want, like <h3>Welcome to our site</h3>.

  5. moshu
    Member
    Posted 5 years ago #

    I have read the section on codex about dynamic links but can't get this to work. (I don't know PHP)
    You don't need php for that, just advanced copy/paste skills...

    Using the bookmarks would require really advanced PHP knowledge.

  6. tr123
    Member
    Posted 5 years ago #

    Hi Otto

    Thanks for the suggestion, that's an option. Ideally I would like for my client to be be able to edit everything but I may have to try that.

    Hi Moshu
    I have tried my advanced cut and pasting skills :) but I run into problems as I am setting a page to be my home page instead of my blog, but when i tried that method the blog and home page links seemed to highlight at the wrong times.

Topic Closed

This topic has been closed to new replies.

About this Topic