The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Link categories the "before" formatting (4 posts)

  1. gyda
    Posted 9 years ago #

    I'm using different classes for lists in the Link Categories, so in the "After" formatting, I left the default, which is </li>. And in the "Before" formatting, I've added different classes, for example: <li class="blogs"> (since I have different list-styles)

    But it's not adding those classes, I check the source and it's always <li> for all the links.

    I didn't edit any php files, so I think it was suppose to work since it's something in the wordpress "cpanel" area.

    I don't know if this is a bug or it's just my files, if anyone could help me.
    Thanks in advance.

    added: I also tried changing themes, default and classic and it's not a problem from there, since it doesn't add the classes either
    might be from links.php in wp-includes folder

  2. gyda
    Posted 9 years ago #

    This is really troublesome.
    Well, looking in my links.php, in the end is something like this:

    //Display the category name
    echo ' <li id="linkcat-' . $cat['link_category'] . '"><h2>' . $cat['cat_name'] . "</h2></li>n";
    // Call get_links() with all the appropriate params
    // Close the last category
    echo "";

    in the 6th line, where it's
    is actually where I wanted the $before.
    I don't know PHP very well, but I understand some logic, the first <li> should have some variable I think.. the one getting the $before, how can I do that?

  3. gyda
    Posted 9 years ago #

    Well I got help from outside, this $before is only for before the headings in the categories name, I guess. Or is something related, but it's not doing anything anyway that before and after

    Is there anyway to have different classes (for CSS) in the lists (<li>) of each link, inside each category?

  4. ivode
    Posted 9 years ago #

    Well it hacls the core, but to get the functionality you want (and I wanted) is fairly simple. Change the following 2 lines in links.php.

    Line 552:


    Line 533:

    sort_desc, list_limit
    sort_desc, list_limit, text_before_link, text_after_link, text_after_all

    Now the before and after tags you put into link categories will show up in the code for each link in that category.

Topic Closed

This topic has been closed to new replies.

About this Topic