treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Style Current Page in WordPress wp_link_pages

  • I'm using a modified form of wp_link_pages at http://themeforward.com/demo2/?page_id=2&page=2

    When a div is added, we can obviously style the links. But what if I want to style the non-linked current page (the number '2' in this example)... is there a way to achieve this via CSS alone?

    I should mention, I realize I can assign unique CSS to the links and then mess with the size, color, etc of the entire div to change the un-linked current page. But what if I want to add a specific background color or padding - then I'd need to target that specific page number.

    If anybody has any ideas I'd love to hear them! :-)

  • :nth-child()

  • Thanks Chris, but what the styling would have to be applied to whichever link is unlinked... no matter the page the user is on so I don't believe that would work (unless I'm completely missing something obvious).

  • @siouxfan45 - I use the built in WordPress class that is applied to each current page link and it looks something like this;

    .current_page_item {
    
    /* Insert current page styling here */
    
    }
    
  • Thanks Watson, but current_page_item is for menus. I'm working with WP_LINK_PAGES.