• Hi, I’ve learned a lot from codex and the forum and feel ready to create a “Page” template. I’ll have a sidebar that includes links to pages. Thanks to this strong community, I’ve decided to focus on WP as a blog and CMS instead of drupal and mambo.

    Using wp_list_pages outputs page titles. For example, wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Menu') . '</h2>' ) will allow me to sort by their rank.

    Is there a way to do this using Slugs? It will produce a cleaner menu without clunky titles. …I’ve searched forum and couldn’t find anything…

    TIA!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Or, you could try https://codex.www.ads-software.com/Template_Tags/wp_get_linksbyname

    Manage/Links/Add Links or Creat Link Category

    You actually control the output of the link to be displayed. There is a bit of manually insertion – namely URL to where the page will go, but otherwise a dream to use.

    I use this method for practically all my links in my sidebar so they render exactly how I want them to.

    Hope this helps

    @katie1
    Do you mean youi use the Links Manager to display your WP Pages? – interesting…

    ah… yes [very prudent in my non-emotional, non-frustrated, non-offended, non-irritated reply]

    I use it for About, Disclaimer and eventually I will add to the list with Copyright, Plagiarism, etc, because I wanted the links to render in aphabetical order, and because I, well, can… ??

    Further: I also wanted to separate my pages into distinct category-like structure in my pages-sidebar.

    Thread Starter mainewebworks

    (@mainewebworks)

    katie1 – Thanks!

    I thought about using the Links Manager b/c the concept appeals to my static page xhtml/css side of the Brain (pre-wp).

    The only drawback might be adding in the URL manually. It’s ok for most of us; this project is for a client that may or may not be able to do it.

    The list_pages tag will add the link for each Page created under the sidebar block for wp_list_pages() automatically.

    I looked at the wp_list_page for ‘post_name’ – I think it would be coded as –
    wp_list_pages('post_name=menu_order&title_li=<h2>' . __('Menu') . '</h2>' )
    which will grab the Slug yet lists the pages alphabetically.

    I’d like the best of both worlds: a list by slugs ranked by their page order:
    • Home
    • Products
    • Contact

    Or,…? I’m sure there’s a work around. If not, I like your Link Manager suggestion.

    Cheers!

    If your client can copy & paste a URL from the address bar, then its dead easy to do.

    Once I make a page: Disclaimer, I hit save and continue editing, then Preview to generate the exact URL.

    I copy the URL from the address bar into an open text file I always have running, then save my Disclaimer page.

    I then go to Manage/Links/Add Link and in this instance I put all my pages (a whopping 3) under “Communication” Link category.

    This will change as I copy & paste more stuff into my site and I will have more Page link categories, like HelpDesk, Account Info, Submission Guidelines, Communication, etc.

    But I digress…

    I open “communication” and then paste the URL into the URL space, type a name for it and save. Done. Then I test the link which sits in my sidebar on my homepage, and presto!
    It works.

    This may not be suitable for some viewers, because I don’t generate a lot of pages. I do, however, generate different ‘category’ pages, which I want to categorize in my sidebar without fussing overly with php code.

    There was another thing I found niggly with Pages – I couldn’t generate a dynamic breadcrumb trail to suit my site using Pages, as it refused to pick up deep level subcats and put the title categories in appropriate order, and, of course, we can’t run php code in pages ??

    Namely for my bookstore:

    Books/romance/regency/author/single book title/excerpt

    I had to make them categories for it to work, which is fine.

    Thread Starter mainewebworks

    (@mainewebworks)

    Cool – I’ll be implementing this suggestion today –
    I’ll post back here b/c I’m sure others (those that search first) may have some use for this.

    Thanks again!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Using Slugs for wp_list_pages’ is closed to new replies.