• ISSUE
    I want to assign unique IDs to each of my blogroll categories’ headlines, while wrapping those same headline with <span> tags, so that I can employ the common technique of hiding the headline of each category (the text which falls between the SPAN tags) while replacing the background of the headline element with custom graphics. The CSS coding is a breeze… I just can’t figure out how to get WordPress 2.5’s blogroll widget to set a category_before value with a unique ID for each DIV.

    EXAMPLE
    Let’s say that we have three categories in a blogroll: planes, trains & automobiles. The WordPress blogroll widget currently generates this code:

    <div class="side-widget widget_links">
       <h3>planes</h3>
          <ul>
             <li><a title="plane one" href="https://www.example.com">Plane One</a></li>
             <li><a title="plane two" href="https://www.example.com">Plane Two</a></li>
             <li><a title="plane three" href="https://www.example.com">Plane Three</a></li>
          </ul>
    </div>
    
    <div class="side-widget widget_links">
       <h3>trains</h3>
          <ul>
             <li><a title="train one" href="https://www.example.com">Train One</a></li>
             <li><a title="train two" href="https://www.example.com">Train Two</a></li>
             <li><a title="train three" href="https://www.example.com">Train Three</a></li>
          </ul>
    </div>
    
    <div class="side-widget widget_links">
       <h3>automobiles</h3>
          <ul>
             <li><a title="auto one" href="https://www.example.com">Auto One</a></li>
             <li><a title="auto two" href="https://www.example.com">Auto Two</a></li>
             <li><a title="auto three" href="https://www.example.com">Auto Three</a></li>
          </ul>
    </div>

    Note that all three categories have the same class tags wrapping them?

    I’ve looked in the functions.php code unique to my theme, but I’m uncertain as to what value I might insert into the code for the before_widget setup….

    'before_widget' => '<div class="side-widget %2$s">'

    …though I suspect that if I understood what the code %2$s invoked I’d be halfway home to finding my answer.

    ::sigh::

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Adding Unique Classes or IDs to Blogroll Widget’s Category Headlines’ is closed to new replies.