Forums

2.1 - Restrict # of links shown in each category? (46 posts)

  1. noxdineen
    Member
    Posted 5 years ago #

    I have a ton of links and I like to show a random 5 for each category, but I can't seem to figure out how to set the number of links displayed now that link and post categories have been blended.

    Am I just overlooking something, or is this feature gone?

  2. crmiller
    Member
    Posted 5 years ago #

    I am seeing the same behavior. Is there a way to reinstate this feature without downgrading WordPress?

  3. Ephemeriis
    Member
    Posted 5 years ago #

    I'm in the same boat... Had a category called "Random Links" and was displaying a random selection of 10 links on my blog. Now I've had to turn off the display of links altogether because the list is 30+ links long.

    Haven't found a workaround or plug-in yet either...

  4. muskie
    Member
    Posted 5 years ago #

    I too was using this option, prior to upgrading to WordPress 2.1 yesterday. I was disappointed to discover today that option is gone.

  5. Otto
    Tech Ninja
    Posted 5 years ago #

    Change your template to use the new wp_list_bookmarks code.

    See here:
    http://codex.wordpress.org/Template_Tags/wp_list_bookmarks

  6. muskie
    Member
    Posted 5 years ago #

    You provided the same answer in two threads. I'm not sure that will work for me, nor replace the functionality I used to have. Maybe I am wrong.

    Here is the other thread:
    http://wordpress.org/support/topic/103800

  7. Otto
    Tech Ninja
    Posted 5 years ago #

    Yes. You are wrong.

  8. moshu
    Member
    Posted 5 years ago #

    Yes. You are wrong.

    I am also curious if you can, please, show us how can we set
    - the number of links different for each link category
    - the display order, again, different for each link category
    FROM the admin panel in 2.1.

    Thank you!

  9. Otto
    Tech Ninja
    Posted 5 years ago #

    You cannot set those from the admin panel. Who said you could? Setting them from the admin panel makes no sense. That's one reason such things were removed from 2.1. They were inconsistent and weird and badly supported.

    You can specify those as parameters to the wp_list_bookmarks function, which is why I pointed them to the codex page for it above.

  10. moshu
    Member
    Posted 5 years ago #

    It worked like that in pre-2.1 versions. I said so, because I am looking at the (2.0.7)admin panel in another window :)

    And that's why users are confused: because a familiar setting has disappeared from their admin panel; now forcing them to edit template files instead of doing it from the admin.

  11. moshu
    Member
    Posted 5 years ago #

    You can specify those as parameters to the wp_list_bookmarks function,

    No, you can NOT for each category a different setting. Unless you use the template tag many times...

  12. Otto
    Tech Ninja
    Posted 5 years ago #

    I would have thought they would have been more confused with those options in 2.0.7, since they never actually worked with most themes. Any theme that used get_links or get_links_list (which was most of them), ignored the before/after/between settings, ignored the show images, ordering, ratings, limits, all that stuff. So those never worked unless you changed it to use wp_get_links instead, and even then it was a bit haphazard and weird.

  13. Otto
    Tech Ninja
    Posted 5 years ago #

    No, you can NOT for each category a different setting. Unless you use the template tag many times...

    Why would you not use it multiple times? If you're displaying two different categories in two different ways, you would kinda *have* to use it multiple times.

  14. moshu
    Member
    Posted 5 years ago #

    I can do it. But your question takes us back to the initial issue: average Joe User is forced to edit template files - quod erat demonstrandum.

  15. Otto
    Tech Ninja
    Posted 5 years ago #

    I wouldn't say he's *forced* to edit template files. He could use a sidebar widget that offers those as options. Or he could use a plugin that adds a screen to configure that stuff as complex as he wants it to be. Whatever. The fact that it's new is the only reason those things don't currently exist. Nobody's made the widget, nobody's made the plugin.

    But having a screen in the core where you can put in options that a) usually don't work, b) are highly theme dependent and not obvious (before/after/between), and c) are inconsistent in design from the rest of the system... that made no sense.

    The bookmarks functions can do what's being asked here. That's as far as I was really going with it. Yes, those options are gone from the admin area. But that's a good thing. I didn't think it necessary to explain why when all they were asking for was how to get something to actually work the way they wanted it to work.

  16. Vince2006
    Member
    Posted 5 years ago #

    Average Joe user is most of the users I know that use WP. Be that as it may, perhaps an upgrade is in order for 2.1 to at least get back to the less complex way of organizing links.

    [Edit after reading Otto's last post which was being published as I was writing this]

    I agree with you Otto, in that editing template files will be better in the long run especially when it comes to so many different themes that were / are unable to utilize the previous links manager features (by previous, I am talking about previous to 2.1 Ella of course)

    However, I am also of the belief that non code friendly users should have the simplicity that previous versions of 2.1 had regarding being able to order links as needed from within the admin panel and if they so decide to choose a theme that doesn't work with the old style links manager, then they'd need to get an alternate theme, widgetize, get a plug-in or alas, modify the theme's template. While I don't have the expertise in writing plug-ins (yet) - I am sure we will see a 2.1 plug-in that addresses 'ease of use' for ordering links that will hopefully not require editing template files... One of the great features of WP has been it vast array of plug-ins and so I am sure one is on it's way.

    My contribution to those that want to customize their links --

    With my very limited knowledge of PHP, I was able to set 2.1 to have only a certain number of links in a category. Now of course I am using the K2 theme so this fix will be a bit easier than having to modify an actual template file - and K2 itself is not perfect (yet!)

    Basically I wanted 5 links to be randomized from my Blogroll - (Category 2) so within K2's sidebar modules, I enabled 2 PHP modules, labelling the first module, Blogroll (merely as a point of reference within K2's sidebar modules but I did not allow the name of the module to be visible since the category is defined in the code anyway.) - and in the Module's code:

    <?php wp_list_bookmarks('category=2&before=<li>&after=</li>
    &show_images=1&show_description=0&orderby=rand&limit=5'); ?>

    Which returns only category 'Blogroll' and a maximum of 5 links chosen randomly.

    Next module I named 'Links' - and in the module's code:
    <?php wp_list_bookmarks('category=3&before=<li>&after=</li>
    &show_images=1&show_description=0&orderby=url'); ?>

    Which returns ALL links in category 'Links'.

    This IS a pain to have to do - but you only need to do it one time - and yes it is a very temorary fix and it does rely on wanting to use K2 but the idea can just as easily be inserted into a sidebar template (I think - since I have not tried as yet...) or perhaps another sidebar widget will give you similar results...

    If you are running 2.07 and don't want to have to mess with this type of modification - JUST wait on 2.1 and read the support each day and see if there are any intentions for the WP developers to change things to make adding links as easy as it was in old versions.

    Personally I like 2.1 - It is faster than previous versions and aside from the links issue mentioned in this topic and a few minor bugs that I am sure will be worked out in future releases... it works well and is still as customizable as ever before if not even better.

    Vince

  17. muskie
    Member
    Posted 5 years ago #

    I'll try what Vince said. I have no plans to roll back to pre 2.1. I purged a few plugins which never quite worked right or as well as I would have liked concerning comments. I tried updating them first, but I think I'm done with OpenID and possibly Gravatars too.

    I still think having to add three complicated lines of PHP to my template to replace one simple line is a step backwards. I built my own theme based on advice and examples from others and it used:

    <?php get_links_list(); ?>

    This wasn't a philosophical decision, this is probably what someone else did and I just did the same. I'm also surprised how many people posted so quickly on this thread. There must be people who liked the pre 2.1 way and prefer clicking things rather than pulling out a text editor and an ftp client.

  18. Otto
    Tech Ninja
    Posted 5 years ago #

    The assumption that the "2.1 way" requires editing the template by hand is unfounded. It does *now* because 2.1 is still new. The paint isn't even dry yet. Eventually, it will not require such things, because plugins and sidebar widgets will fill the gap. And the template code will be better able to specify consistent design because of it.

  19. muskie
    Member
    Posted 5 years ago #

    I tried using the category_name argument instead of categor number and it didn't seemed to work. The category is named Blogroll and the slug is blogroll. I tried it with and without capitalizing the B. I think using name is superior to having to look up the number and I don't like mixing link categories with blog posting categories at all.

    Unless you look to the right and notice that there are 0 posts but 10 links how do you tell the two types apart? They should at least be visually distinctive or in seperate lists or something.

  20. muskie
    Member
    Posted 5 years ago #

    Any thoughts on why the third category has no title, though the CSS styling is partly there. It should be titled "Links".

    My URL: http://blog.muschamp.ca/

    My PHP snippets:
    <?php wp_list_bookmarks('category=55&before=
    <li>&after=</li>
    &show_images=0&show_description=0&orderby=updated'); ?>
    <?php wp_list_bookmarks('category=57&before=
    <li>&after=</li>
    &show_images=0&show_description=0&orderby=rand&limit=5'); ?>
    <?php wp_list_bookmarks('category=56&before=
    <li>&after=</li>
    &show_images=0&show_description=0&orderby=name'); ?>

    Damn less thans and greater thans. PHP has fugly syntax IMO.

  21. moshu
    Member
    Posted 5 years ago #

    Backticks!!!
    (why nobody ever reads how to post code? - just below the text input area)

  22. Otto
    Tech Ninja
    Posted 5 years ago #

    ... and I don't like mixing link categories with blog posting categories at all.

    Unless you look to the right and notice that there are 0 posts but 10 links how do you tell the two types apart? They should at least be visually distinctive or in seperate lists or something.

    You're making an assumption that they are separate things. Why do they have to be separate? I think they should be better integrated. What if I wanted to make posts and links in the same category?

    All a category really is is a name that can be applied to an entry. Whether that entry is a link or whether it is a post shouldn't make any difference.

    I grant you that 2.1 is still inconsistent in this arena. Hopefully it will be better integrated in later revisions, and this separation will no longer exist.

  23. muskie
    Member
    Posted 5 years ago #

    I have to disagree with you here. Stop thinking WordPress and start abstracting. A link is something everyone is familiar with it is text (or an image) with a URI pointing to a resource. A post is an article consisting of text, images, embedded video, and links.

    Quite different beasts which is why I think they should visually distinctive at least.

    Now a third object is present a category. What is a category? Is it a link? No. Is it a post? No. A category is an attribute, a grouping, a tag, maybe a set is the best way to think of it. Following your logic a link and a post could belong in the same set so that makes them not homogenous. Sets could however consist of just links or just posts. Posts can be in more than one category, can links? But none of this is a reason they can't be visually distinctive in the admin UI at the least.

    A category is neither a link nor a post. So you have three object/tables/concepts. I've never taken a close look at the database structure in WordPress but I assume these three concepts are not all in the same table, that wouldn't be good relational database design.

    Categories can contain links and posts apparently, but posts can contain links. I know they are HTML links and not the wordpress concept of links, ie bookmarks or blogrolls, but links have become ubiquitous and something needs to be done whether visually or verbally to make the bookmarks or sidebar links distinctive and illuminate how they interact with categories become more apparent, especially considering an entire screen seems to have been removed from the program.

  24. Otto
    Tech Ninja
    Posted 5 years ago #

    Posts can be in more than one category, can links?

    From the perspective of the database, yes, they can, now. Don't know if the UI has adapted to it yet though.

    As for the rest of your post, I just disagree. I think that some work needs to be done to it, but not the same work you seem to think needs to be done there.

    The Links page has always been the backward child in WordPress, IMO. It's been largely underutilized because it never made much sense. Most people only use it for the rather limited purpose of having links on their sidebars. But from a wider perspective, it's really a generic URI library. A place to put a bunch of URIs, organize them, and then to display them in whatever way is appropriate. I do like the name "Bookmarks" better, because that has the association with Browser bookmarks, and to a wider extent, something like del.icio.us.

    From that perspective, separating categories from it and merging with the normal categories makes a lot of sense. It brings the lowly Link up to the same level as the Post. It's another type of item you can enter into the system and then have automatically displayed and categorized with the rest of the things on your blog.

    I think it would be neat, for example, to be able to insert bookmarks directly between posts, as part of the normal blog-flow. You could use them for links that you find interesting but don't feel like writing a full post about. Kinda like "Asides", but just the URI and a brief description.

    The "RSS" field has always been underutilized in the Links as well. If you could have it autodetect blog links and grab the feeds, then your Blogroll could not only show links to the blogs you have there, but also the title of their latest posts. Could even order the list by the time of their latest posts.

    In other words, I'm happy that finally the links are getting a revamp. It could turn into something very nice. Better than leaving it stagnant and dead, like it was.

  25. jabecker
    Member
    Posted 5 years ago #

    The problem as I see it is not in the Bookmarks functionality. It's much the same as the old "Links" worked. The problem is in the way that post categories and link categories have been combined into one "category" attribute with no way to differentiate between what is a post and what is a link.

    If "category" can be an attribute of either post or link, it's just a valid to say that something called "type" (i.e. post or link) is an attribute of category.

    Personally, I liked it that way. It worked exactly the way I wanted it to.

    Posts are posts and links are links. I'm not too happy about having to modify my template to exclude something from my list of post categories every time I add a new link category. But that's seemingly the only way that I can list only post categories without stray link categories getting into the act.

    Telling unhappy customers to go back to 2.07 (hope you backed up your database first) and wait for vaporware in the form of widgets or plugins doesn't seem like very good customer service.

  26. jabecker
    Member
    Posted 5 years ago #

    And while we're on the subject, if category is such a universal attribute, why is it still not possible to assign a category to a page? Being able to do that would allow me to get rid of at least one plug-in.

  27. Otto
    Tech Ninja
    Posted 5 years ago #

    Posts are posts and links are links. I'm not too happy about having to modify my template to exclude something from my list of post categories every time I add a new link category. But that's seemingly the only way that I can list only post categories without stray link categories getting into the act.

    This appears to be an oversight that may or may not be remedied in the next new release. I can see a couple of possible solutions, but I'm uncertain what changes would be necessary to make it work right there. Categories are not finalized, I'm guessing.

    Telling unhappy customers to go back to 2.07 (hope you backed up your database first) and wait for vaporware in the form of widgets or plugins doesn't seem like very good customer service.

    Good job you didn't pay for any of this then, isn't it? Complaining about "customer service" when the software is free and the people who volunteer to answer questions on this forum don't get any compensation... well, it just makes me kinda want to ignore what you're saying. If you were actually paying money for any of this, then you'd have more room for that sort of thing. As it is, you're quite free to modify the software yourself or go find somebody else to do it for you. The code is free as in speech.

    And while we're on the subject, if category is such a universal attribute, why is it still not possible to assign a category to a page? Being able to do that would allow me to get rid of at least one plug-in.

    There is no technical reason. The database would allow for it with no troubles. It's just that the UI kinda assumes that pages are standalone and hierarchical in terms of other pages. They are undated as well, you'll notice. If you could categorize a page, would that page content show on the category archive pages? If you could put a date on it, would it show up in the date-based archive pages? Questions like that are unanswerable because there are valid reasons to do it either way. So Pages don't get dates and they don't get categories. They are meant for static, standalone, content which lies outside of the rest of the date and category based hierarchical organization.

  28. muskie
    Member
    Posted 5 years ago #

    I'd forgotten about 'Pages' as I don't use them. My static stuff is still done by hand, I created a WordPress theme to match it...

    I still think there is some confusion in the user and developer community about what the basic concepts are and what they are used for. There appear to be two types of links, links that I just type in while composing a post or a page. ;-) And links that are important enough to be in the sidebar or between posts and assigned a category. With the exception of a category is there any real difference between the links? Does the category from the post envelop the links inside the post?

    Posts can have multiple categories while links can not and apparently pages can't have any.

    Then there are links built into the themes themselves. The over use of the term link is problematic, but using blogroll isn't an improvement as a link can be to so many other things than a blog.

    I'm not losing any sleep over all this, I have much bigger problems. I edited my template, I didn't care to have to look up the category number not when I knew the name and expected it work given that instead. It is still not working correctly for the third link category which was titled "Links". I viewed source it creates an H2 tag, but puts nothing in it. It works for my other link categories. It isn't a rendering issue, nothing gets put in the H2 tag, not even white space.

  29. Otto
    Tech Ninja
    Posted 5 years ago #

    Posts can have multiple categories while links can not and apparently pages can't have any.

    I would like this to be something added as well, to allow Bookmarks to be in multiple categories.

    I still think there is some confusion in the user and developer community about what the basic concepts are and what they are used for.

    You're right on with that there. And that confusion has existed for a long time. I think the changes going in are a start to ending that confusion.

    And it would really help if everybody would stop calling them "Links". Use the term "Bookmarks" instead. It distinguishes them from "links" in a post, which are nothing at all. They're just part of the post, not separate from it in any way, not treated special by anything except the pingback mechanism.

  30. crmiller
    Member
    Posted 5 years ago #

    In programmer-ese... One of the great things I've noticed about the 2.1 release is, overall, a move more toward the Model-View-Controller architecture. The bookmarking feature used to have settings for its view in the administrative interface. Due, as you say, Otto, to confusion among theme developers (and even a misuse of some tags), these controls were removed as they were not in use. Having said that, I would argue that they were in use, and properly too, by some subset of themes, as many of us immediately noticed the new functionality. While I certainly thank you and the other developers from the bottom of my heart for making such a fantastic free product, I think the main grumbling comes from this perceived functionality gap from the previous version. As a developer myself, I carefully read through the change notes and didn't see anything warning me in advance that I'd lose functionality I had before, so I (and obviously others) made the assumption that this was a bug or oversight. Obviously this was an error on our part. To preserve the harmony between users of the fine product and its heroic developers, perhaps you could point us to the appropriate documentation to review before we start asking about what we see as missing features?
    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags