I have put some effort into researching this topic before posting to ask for help but if I have overlooked something simple, please forgive me and point me in the right direction.
I’m using the function
wp_list_pages()to create a list for the header of my page and am using CSS to style the list elements with a background that creates a break between each of the items, by creating a line something like | in front of each item, this applies the style to all items. The problem is I don’t want the same styling on the first item as there is no need for a break line at the start of the list. This is something that should be easy to handle in CSS using something like
li:firstbut to my knowledge this hasn’t been implemented across all browsers yet.
My second best option would be to have a class applied to the first item of a list that could be used to apply a slightly different style (you could also add a class to the last item to generalise, but in my case I just need the first). I was consdering making changes to
wp_list_pages()and implementing it as my own plug-in but it seems I would need to go much deeper to add the extra class. Before I plunge into that I’d like to request some advice.
Is there another way I haven’t found yet to do what it is I want to do? If adding a class to the first item seems reasonable, are there any plugins or examples out there already where people have done this, or something similar that I might find useful?
If it all seems a bit messy there are a couple “work-arounds” (read: reconsidering the design) which may be the better option for now as I view this as a styling problem not particularly a code problem, but either way this still seems to be an issue that I think deserves an answer.
Thanks in advance.
- The topic ‘Dinstinguish first item from wp_list_pages()’ is closed to new replies.