[resolved] how can i modify the way pages widget gets displayed? (4 posts)

  1. w1n78
    Posted 3 years ago #

    i'm learning how to create my own theme. so far so good. but now i'm on the widgets part. how can i modify how the pages widget displays the list? i want to be able to apply my own css classes and support drop downs using bootstrap css. is there a way to override the default way? can someone point me in the direction where i can get more info? thanks.

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    the default 'pages' widget uses wp_list_pages() and therefore outputs this kind of markup: http://codex.wordpress.org/Function_Reference/wp_list_pages#Markup_and_styling_of_page_items

    i want to be able to apply my own css classes

    you possibly need to create a custom walker:
    (search results for 'custom walker for wp_list_pages' only; not applied or tested)

  3. w1n78
    Posted 3 years ago #

    @alchymyth thanks for the links. i didn't know what it was called but now i know it's "walker". so i tried out the tutorials in the links above for the walker but i can't seem to get it to work. i even just copied the start_el() with no modifications and i get the following error...

    Fatal error: Using $this when not in object context in class-wp-walker.php on line 185

    not sure if i forgot something or what :(

  4. w1n78
    Posted 3 years ago #

    nevermind. i figured it out. i was calling the object as a string. thanks for the links. this is a great start for me to figuring out how to customize things. thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic