wp_list_pages

WordPress: How to dynamically modify the output of the wp_list_pages

I’ve noticed a lot of traffic to my previous post on this subject: How to style wp_list_pages, which means that there is a lot of interest in this subject.
I recommend reading the previous article as it might explain certain things which I am going to write about here.

For the template that I was recently working on, I needed a modified output of the default <?php wp_list_pages(‘arguments’); ?> tag, in a way that it would change the link into and anchor. For example, instead of this:

  • this is an example
  • into this:

  • this is an example
  • WordPress: How to style wp_list_pages

    Applying styling to dynamically generated lists (or any content) in Wordpress.
    Recently, I was in a need of changing the default outcome of the <?php wp_list_pages(‘arguments’); ?> tag in Wordpress – as you’ll see, it’s a really simple procedure. I needed to change the wp_list_pages outcome, but this technique can be applied to other tags as well.

    On default, after calling this script, we recieve something along these lines: