Version 2.x for WordPress 2.8+

[Grouped Links Widget, version 1.x for WP 2.7 and below is available here]

Grouped Links Widget can use an unlimited number of widget instances to group links by their associated link categories. This adds a bit more CMS functionality to WordPress.

If the blogroll is grouped into link categories and each category contains internal tag references, then you can flexibly group link categories and put these link groups into your sitebar(s). This, of course, works with traditional external links put in a blogroll too.

Here is a picture about how this works:

Using Grouped Links

Using Grouped Links Widget (Note: the second group is reverse sorted)

Each group of link categories can be sorted by name acending or decending. If simple sorting doesn’t fit to your desired order to appear in the sidebar, then create more than one link group and place them in the sidebar as you wish.

Options

In order to adapt Grouped Links Widget to different HTML theme codes, HTML tags can be set for each link group and for each title within the link group. However, default values should work with most themes.

Update from 1.x

Please save your link groups on paper (or what else), because given configurations of link groups will not be taken over from version 1.x to version 2.x.

Coding

Grouped Links Widget is a simple widget, it mainly uses wp_list_bookmarks. Version 2.0 was completely refactored in order to adapt to the new WordPress 2.8 multi widget technique. If you want to add more functionality, don’t hesitate to modify the code ;-)

Download

Download of Version 2.0.1: grouped-links-widget.2.0.1.zip

Installation

  1. Unzip grouped-links-widget.zip inside the /wp-content/plugins/ directory; a sub-directory grouped-links-widget is created
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Place and configure your Grouped Links widgets via ‘Design / Widgets’ menu

Version History

[2.0.1] — Adapting to WP 3.0, fixing »empty list bug«

[2.0.0] — Refactoring to adapt WP 2.8 multi widget functionality

[1.x] — see version 1.x

35 Responses to “Version 2.x for WordPress 2.8+”

  1. baron Says:

    Works great, thank you..

  2. Herbert Says:

    Feines Plugin! Danke für die Arbeit!
    Du hast es ja als Widget konzipiert. Ich würde gerne eine ganze Linkseite so gestalten. Kann ich da z. B. einen Code in ein Page-Template eintragen, so dass die Infos statt in einem Widget auf einer Page erscheinen?

    Viele Grüße!

    Herbert

    • StefanMz Says:

      Ja, das ist recht einfach (wenn du eh schon am Code bist): Du verwendest dafür pro Link-Gruppe die Funktion wp_list_bookmarks. Diese Lösung hat dann mit dem Grouped-Links-Widget allerdings nichts mehr zu tun, du musst also Änderungen stets am Code vornehmen.

  3. Michael Says:

    Hallo,

    dein Plugin macht der Beschreibung nach genau das,was ich suche. Leider nur bei mir nicht. Plugin aktiviert, Widget platziert – nada.
    Haste du einen Tipp?

  4. Michael Says:

    Hoppla, nun geht’s doch. Einmal das Theme gewechselt und wieder zurück, dann erscheint das Widget. Leider ist der Abstand zwischen dem Titel und dem ersten Eintrag riesig.

    • StefanMz Says:

      Abstände und so’n Kram bitte in deinem CSS einstellen. Wenn du dafür spezielle Auszeichnungen brauchst (Überschrift-Tags: manchmal hilft schon ein Wechsel von h3 nach h2 oder umgekehrt), kannst du die in den Optionen setzen.

  5. sanket Says:

    Grouped Links in word press dynamic content updated need all Grouped link code in sidebar.php is it possible ?

    • StefanMz Says:

      I am not sure, that I understand what you want to do: You don’t need to put any code in sidebar.php directly, you only have to add grouped links widgets in your wordpress widget admin interface to the sidebar you wish. The presentation is done by wordpress automatically.

      If you aim to put the grouped links widget code directly into the sidebar.php, then I have no idea how to do this. Anybody?

  6. Ravi Matah Says:

    how do we link the grouped links title to a page, … when i create categories, there is a box called slug,…. i want to use that slug to link to a page which has all the links in that category.

    for example, im showing only 10 links in one grouped links widget with category called “my publications” ,… rest of them i have put on a page, i want to link the title (TITLE ) of the widget to this page.

    please advise.
    Ravi.

    http://bedtea.in

    • StefanMz Says:

      Ravi, I am sorry for the late answer, but your comment was captured by the spam filter which I just saw today.

      And second sorry: I don’t see any possibility to do your task, because the WP-function http://codex.wordpress.org/wp_list_bookmarks used by the widget does not allow to do that (using the slug to create a link using the title of each category).

  7. troydavisfilm Says:

    Hi
    I installed the widget, and it works well. However all the other items in the sidebar disappear when I activate it.
    Please can you tell me how I can resolve this problem? I had it in the left hand sidebar

    Many Thanks

  8. troydavisfilm Says:

    Please note that the url of the site that I want to use the widget on is http://ss-designs.co.uk/troyblog

  9. troydavisfilm Says:

    I have now resolved the above problem. However, I now have my links showing in their categories, but I also have my original links listings showing up. Please can you advise how to get rid of the default links list so that only your categorized links show. My blog is listed above.
    Many thanks
    Sarah

    • StefanMz Says:

      Hi Sarah, sorry for my late reply, I was in holidays. I am not sure, that I understand your problem correctly, because my answer sounds too simple: If you want to get rid of the old links being displayed, then you have to remove the respective old links widget, because now the links are displayed by grouped links widget.

      Please clarify if I didn’t get the point (e.g. which widgets you are using and what is displayed).

  10. sarah sellers Says:

    Hi
    Thanks for you reply. I have now stopped using this widget as I could not see what to do. However I would still like to know as I have other sites that need to be created.
    My original links were part of my blogroll and are added via the administration panal. It is there I allocated categories to them. Once I installed your widget, I had by blogroll links showing which were duplicated by your widget. I do not have another links widget installed and I believe the blogroll is part of the structure of a wordpress site.
    I hope O have explained it a bit better now?
    Many thanks
    Sarah

    • StefanMz Says:

      The blogroll is nothing else than a link list having the category “Blogroll” (or “Linklist” in older WP-versions). Thus you can remove the blogroll-widget (named “Links”) and let the blogroll-links being displayed by grouped links widget.

      The other option is, that you use the standard blogroll widget (“Links”) and check out the link category “Blogroll” in the grouped links widget.

      Please make sure, that you have customized all sidebars, otherwise a default set of widgets will be displayed (e.g. including the blogroll in the left sidebar).

  11. sarah sellers Says:

    Thank you. Now I understand! I will definitely use the plugin on my next project!

  12. tracey Says:

    Hi Stefan,

    I’m getting the following error in the latest wordpress version:

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/grouped-links-widget/grouped-links-widget.php on line 41

    Can you suggest what the problem might be?

    • StefanMz Says:

      Do you have link categories used by published and visible links?

      At the given point where the error raises, all link categories are looped, but I did not check before, if there is any at all. However, I tested this with “no links” and “private links” etc. and everything works (no groups had been displayed as expected).

  13. tracey Says:

    Ok, that seems to have resolved itself. Weird.

    However I do have another question. Is there any way of adding a dynamic class to a surrounding div so that I can style the categories differently (add a category icon)?

    Something like this is what I’m after:

    Category1

    Link Here
    Another Link Here

    Category2

    Link Here
    Another Link Here

  14. tracey Says:

    crap. try again

    div class = Category1
    h4 Category1 /h4
    ul
    li Link 1 /li
    li Link 2 /li
    /ul
    /div

    div class = Category2
    h4 Category2 /h4
    ul
    li Link 1 /li
    li Link 2 /li
    /ul
    /div

    • StefanMz Says:

      (It’s WordPress which removes the tags in the simple commment fields).

      Yes, using different classes for the displayed groups is a good idea. Will look after that, but I can not say, how long this will take.

      • StefanMz Says:

        Ok, here’s a quick hack for you: edit grouped_links_widget.php and comment out lines 52 and 53 (with “category_before…” and “category_after…”) by putting ‘#’ in front of these lines (like already done in line 51).

        Now, each link group defaults to <li id=”[category id]” class=”linkcat”>

        Have fun!

      • StefanMz Says:

        The same effect can be reached by putting the following tag code into the opening tag field for “each link group” at grouped links options:

        <li id="%id" class="%class">

        Save it, and that’s all.

  15. Amanda Says:

    Is there any way to have the links sort by date the page the link is referencing is published? I have them dated by date with month then year and of course with alphabetical sorting it’s not working right.

    • StefanMz Says:

      You can try to modify the code. Have a look at lines 50 and 51 in grouped-links-widget.php. Comment out line 50 by putting a ‘#’ in front of the line (as 51 has). Then enter a new line after 51 saying

      orderby => ‘updated’,

      Don’t forget the comma at the end of the line. Then remove the comment character (‘#’) from line 51 (order => $cat_order,). This could work if I understand you correctly, but I didn’t test it.

      For more usage details of wp_list_bookmarks have a look at http://codex.wordpress.org/wp_list_bookmarks

      • Jamie Martinez Says:

        I attempted to do this but I couldn’t successfully achieve the desired results. I am trying to sort the links by rating. Has anyone figured out a way to do this with this plugin? I really would like to use this plugin as it works great but I really need this feature. Any help would be greatly appreciated.

      • StefanMz Says:

        Jamie, as far as it is described by http://codex.wordpress.org/Function_Reference/wp_list_bookmarks you have to do the same as explained above, however, enter the new line with

        orderby => ‘rating’,

        Don’t forget to comment out line 51 (‘category_order’ => $cat_order,) using ‘#’. I did not test this.

      • Jamie Martinez Says:

        I now have it working thanks. The problem was in the description you mentioned to remove the comment from order => $cat_order,. When I made the change by adding that line if I remove that comment it doesn’t work. But if I leave teh comment for that line then it works fine. Thanks for the help and for replying.

  16. Jim Says:

    Hello, This plugin seems to operate great on my wordpress 2.9.2 installation, however I checked my server logs and there are pages of this error:

    Invalid argument supplied for foreach() in /home/wordpress/wp-content/plugins/grouped-links-widget/grouped-links-widget.php on line 72

    Any ideas? Thanks in advance for your help.

    • StefanMz Says:

      If the error is thrown from line 72 then this happens during configuring the widget in the admin widget area. Thus you should have observed this error during handling with the widget. Users of the frontend should not be annoyed by receiving an error.

      Nevertheless, there is an intermittently appearing error. Unfortunately I can not reproduce this error. If you find a way to reproduce the error, then please tell me.

    • StefanMz Says:

      I fixed this bug, please check out version 2.0.1.

  17. Matt Says:

    How is WordPress 3.0 compatibility with this plug-in? I’m trying to make sure all of my plug-ins are compatible before upgrading. [wordpress.org/extend/ currently has no stats for this plug-in with 3.0 users]

  18. StefanMz Says:

    Yep, the plugin also works with WP 3.0!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: