WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4609 closed defect (bug) (fixed)

Default theme (Kubrick): WP 2.3 do not display all links

Reported by: albaran Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.3
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

The default theme (Kubrick) in WP 2.3 displays only the links associated with the Blogroll link-categorie. Tested with WP 2.3-alpha revision 5795.

Attachments (1)

display_all_links.patch (824 bytes) - added by albaran 8 years ago.
Patch to display all links in all categories for static and widget sidebar

Download all attachments as: .zip

Change History (22)

comment:1 @foolswisdom8 years ago

  • Milestone set to 2.3 (trunk)
  • Version set to 2.3

comment:2 @Otto428 years ago

The default theme appears to simply be calling wp_list_bookmarks(), which should display all links in any categories. Now, the default setup only *has* one category with links, and that's the Blogroll category.. But if you make a new category and put links in it, then it should display.

comment:3 @foolswisdom8 years ago

  • Milestone 2.3 (trunk) deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Based on Otto42's response, marking as WORKSFORME.

comment:4 @albaran8 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Otto42: do you have tested that? it should display ; it does't. For me it can be a real bug in wp_list_bookmarks(). Tested on a local WAMP5.

I have now 3 link-categories, the flatimport script from Dotclear to WP created 2 new link-categories (Dotclear and Wordpress) each with 2 links. All seems OK in the admin and in the database. These 2 new categories and links do not display. A link added to the Blogroll category displays.

You can easily test that using
http://cvie.free.fr/public/flatimport.zip unpack the files in wp-admin/import

http://cvie.free.fr/public/blog-backup.zip unpack the test file in wp-contents/uploads

Go to Manage / Import / click on Dotclear flatimport
It takes a few minutes only.

Or just create a new link-category with a new link and see and report, please.

comment:5 @Otto428 years ago

Okay, you keep saying "link-categories", but there are no such things anymore. There's just categories. Link and Post categories have been combined together. Categories with links in them are link categories. If a category has no links in it, then no, it's not going to display.

And yes, it does work for me. While I'm not running the trunk, it does in fact work on several sites I have, running various versions of the code all the way up to 2.2.1.

I'll try trunk out on a copy of XAMPP later, but I see no reason that it would not work.

comment:6 follow-up: @albaran8 years ago

Seems we are not talking about the same think. I am working with WP 2.3-alpha, you are working with WP 2.2. May be your are just out of subject!

There is a new classification schema (taxonomy) for WP 2.3. Categories and tags are terms with the WP term_taxonomy_id's of:

  • category
  • post_tag
  • link_category

the terms are extendibles and usable by plugins. So categories for posts and categories for links are now clearly identifiable and differents using this taxonomy.

If you want to continue, please install WP 2.3-alpha and test with it.

comment:7 in reply to: ↑ 6 @Otto428 years ago

Replying to albaran:

Seems we are not talking about the same think. I am working with WP 2.3-alpha, you are working with WP 2.2. May be your are just out of subject!

No, I am fully aware of taxonomy, and that doesn't change what I'm talking about.

So categories for posts and categories for links are now clearly identifiable and differents using this taxonomy.

No, they are not. They are still in the same table. Now, they do have a "taxonomy" column that will be "link_category" for the link categories, but that doesn't really make them different or separate. They're still in the same table. All that wp_list_bookmarks is doing is calling get_terms('link_category',...) and this gets the list of terms with taxonomy="link_category". But that doesn't change the way it's stored internally nor what's going on. The old method (in 2.2.1) was similar in nature, it just used different columns and names and such.

Now, what is the actual content of your taxonomy table? You posted something earlier, but I downloaded it, and it was an importer and so posting it doesn't make any real sense. Why don't you post the actual dump of your database so we can see the actual content of it instead?

comment:8 @albaran8 years ago

OK, I resume the whole test made. I imported a Dotclear Blog into WP 2.3-alpha (localhost with WAMP5) using the flatimport importer within the flatimport.zip file.

The import was done without problems, but the new links and associated categories do not display.

The I added from the admin a new link to the Blogroll category and a new link to a new created category.

The default template (Kubrick) displays only the Blogroll category (initial links and newly added link).

The database dump in XML format is here http://cvie.free.fr/public/wordpress.xml for links and terms.

Hope this help.

comment:9 @albaran8 years ago

one can just make this little test with WP 2.3-alpha:

  • add a new link to a newly created category and only this one
  • see what the default theme displays
  • report here

Thanks to this tester!

comment:10 @Otto428 years ago

In your database dump, the link_category is set to zero for all of the links that you have listed. But there's no term with a term_id of zero. wp_list_bookmarks() will therefore skip those link categories since they're empty of links.

Basically, it works like this:

  • wp_list_bookmarks gets all the terms where taxonomy="link_category".
  • Then it loops through those, and for each one it gets all the links that have link_category = term->term_id.
  • If it finds any, it displays them.

So, the problem is that the link_category is set to zero on all your links. Why that is so, I cannot say. Perhaps it's something to do with your importer script? Or something else being weird there. I'll try it myself later.

comment:11 @Otto428 years ago

Hmm. Okay, everything I wrote before was wrong. So, ignore all that.. :)

This term_relationships table is new, hadn't noticed it before. I'll examine it more and see if I can come up with a solution.

comment:12 @albaran8 years ago

I am trying some modifications, for wp-includes/bookmark-template.php
function wp_list_bookmarks()
replacing

$cats = get_terms('link_category', "category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");

by

$cats = get_terms('link_category', 'get=all');

gives

Blogroll

  • Alex
  • Donncha
  • Dougal
  • Matt
  • Michel
  • Mike
  • Ryan
  • Second Life

Cat_added_from_admin

  • Blog

DotClear

  • DotClear
  • DotClear 2 beta

WordPress

  • WordPress Org
  • WordPress francophone

correct display.

comment:13 @albaran8 years ago

adding &get=all in the existing $cats = get_terms... instruction works also.

comment:14 @Otto428 years ago

Yeah, but doing that breaks the normal functionality of wp_list_bookmarks, where you are supposed to be able to specify a specific category.

comment:15 @albaran8 years ago

you are right, my little test on my little sample shows only that something doesn't work somewhere. Hope you find a general solution.

comment:16 @foolswisdom8 years ago

  • Milestone set to 2.4 (future)

comment:17 follow-up: @albaran8 years ago

Why milestone set to 2.4 (future)? must be done for 2.3 ; you cannot distribute a default theme which list only the Blogroll category.

either one modify the call to wp_list_bookmarks in sidebar.php, or one modify this function.

may be this one for wp_list_bookmarks is better?

//Split the bookmarks into ul's for each category
if ($args == '') { # if empty, display all links
	$cats = get_terms('link_category', 'get=all');
} else {
	$cats = get_terms('link_category', "category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");
}

tested only to display all links, doesn't know if it is correct for a non-empty $args.

comment:18 in reply to: ↑ 17 @Nazgul8 years ago

  • Keywords needs-patch added

Replying to albaran:

Why milestone set to 2.4 (future)? must be done for 2.3 ; you cannot distribute a default theme which list only the Blogroll category.

It's set to 2.4, because nobody attached a patch so far. If you want it in 2.3, make a patch. Upload it and set the milestone to 2.3.

comment:19 @albaran8 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 2.4 (future) to 2.3 (trunk)

Attach a patch to display all links in all categories.

@albaran8 years ago

Patch to display all links in all categories for static and widget sidebar

comment:20 @ryan8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Unable to reproduce with latest svn. Resolving as fixed.

comment:21 @albaran8 years ago

Using Wordpress 2.3-beta3 6114 (WAMP5 local) and my sample database.
I am still displaying only links for the Blogroll category. Links for the sample categories Wordpress, Dotclear display only using the given patch.

Note: See TracTickets for help on using tickets.