Support » Fixing WordPress » Give Pages Widget its own "class" or "id" for custom CSS

  • Resolved Rb1368

    (@rb1368)


    Is there a way to single out the pages widget to give it its own CSS rules that wont apply to the other widgets? For instance If I want to change the pages lings to a bigger font size and color and I edit the css .sidebar a{} its going to change all the links in the side bar that color. What is the most recommended way for separating the sidebar widget from all the other widgets in the sidebar?

    Next thing that comes to my head is to just “view page source” and then use the ID or CLASS wordpress is giving the menu when it renders it out? not sure…

Viewing 2 replies - 1 through 2 (of 2 total)
  • This can be done, basically…

    What I did was rather simple on my sites. In the right sidebar I have some pages listed. This is one of the two Menus. These are created using the WP Menu, but adding a CSS style. When you add an item to a Menu, you can expand that item to see a location to enter the style to be used. On the left are widgets using the my theme’s defaults.

    Your theme must support Custom Menus…and you could use a theme that also supports custom widgets.

    Thread Starter Rb1368

    (@rb1368)

    Thank you for your response SwansonPhotos. However I found a different work around. Your advice will and does work, but this is what I did.

    On my sidebar.php file I put this code:

    <li id="page_links">
    	<?php wp_nav_menu(); ?>
    </li>

    then in my style.css file I put this code:

    #sidebar #page_links {
        /*your rules here*/
    }

    Just in case someone needs advice on this I thought I would post what I did.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Give Pages Widget its own "class" or "id" for custom CSS’ is closed to new replies.