• Is there a way to stop wordpress from putting pages in li’s when using wp_list_pages. I checked the codex for info but there doesn’t seem to be anything.

    Id like it to be in a definition list. Any ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter colincameron

    (@colincameron)

    Any ideas?

    I use a “custom functions” ‘plug-in’ where I add my little overly-retentive-inspired code bits. I just copied the wp_list_pages function, renamed it the fuctions and then made it do what I’d like. Then you just call your customized function like you would the regular wp_list_pages one. Like most things I do, I doubt it’s the easiest way, but it works for me!

    Cheers,
    Michael.

    Thread Starter colincameron

    (@colincameron)

    Oh boy, I hope thats not the easiest way. There has to be some fancy way of changing the tag around.

    I will give that a shot though. Btw, do you know where to get that plugin you mentioned?

    My “custom functions” plug-in is just one I made up, I use a few little pieces of code, so I just made it into a ‘plug-in’. Just use the following as the template for the plug-in:

    <?php
    /*
    Plugin Name: Custom Functions
    */

    CUSTOM FUNCTIONS HERE

    ?>

    There ya go, a custom functions plug-in! Let me know if you 1) find an easier way! or 2) if you’re stuck and I’ll post the section for you. I’m off to bed, but I’ll check back here tomorrow.

    Good luck,
    Michael.

    Thread Starter colincameron

    (@colincameron)

    OK cool, thanks for the help niziol

    I don’t know a lot about CSS myself, but I think another method is to put a CSS wrapper around your list_pages section… and in the CSS for that, you can set li to display:inline or any other way you want it to look.

    Colin,

    I’ve posted the code that I use for the wp_list_pages without CSS here: http://pastebin.ca/46250

    Line 100 is the one you’ll need to modify to get the output you’d like. Currently it will output a horizontal nav text like this: | Home | About | Contact | and so on, for all parent pages (no children, just the main parent pages) and it will add the <strong> attribute around the currently selected page making it bold – see my wp site for an example (the text nav part in the footer). I just used my initials to prefix the function names for myself, change them as you wish, but be sure to change all of the function calls within the modified functions (anything that says mjn_ or _mjn_ just change to whatever names you’d like). Then you can just add your code into the “plug-in” format I posted above and then you should be good to go. Let me know if you’re stuck with something and I’ll try to help you out!

    Cheers,
    Michael.

    Thread Starter colincameron

    (@colincameron)

    Oh wow! thanks for the help niziol. I was playing around with the function last night but didnt get it to work.

    Thanks again.

    Thread Starter colincameron

    (@colincameron)

    BTW, isn’t there support for a function file in the templates now? This could make it easier to implement your technique instead of having a plugin.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom formatting for wp_list_pages’ is closed to new replies.