Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#18781 closed enhancement (duplicate)

Idea - Links as a post type

Reported by: sanchothefat's profile sanchothefat Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: dev-feedback
Focuses: Cc:


I don't know if this has come up before but given the way WP is now would it make sense for links to be a post type?

I already have a drop-in which does this that I use in my projects. Essentially permalinks are created from post meta using the get_permalink filter and checking the post type. In a standard loop you get the title and so long as the_permalink() or get_permalink() are used the link url is written out rather than a link to the post page.

There are a couple of advantages to this:

  • categorisation: adding or removing taxonomies etc... is possible
  • adding post meta or custom functionality is easier
  • featured image functionality
  • templates for links would be far more configurable eg. a file called loop-links.php could be used by the built in function if available. archive-links.php would be the links page etc...
  • link categorisation UI would be consistent with post type categorisation UI

While my drop in works for me there is more code relating to it for listing items so there would be some extra work to do to put this into core:

  • alternative or rewritten functions to wp_list_bookmarks() - I'd say a new set of functions eg. wp_list_links() etc...
  • a conversion routine from old style links to the post type
  • consideration of how best to make link templates easy to work into themes
  • new/rewritten links widget

I'm just looking for your thoughts on this and any feedback, caveats, advantages, things to consider, +1s etc... before I code this up and submit it for possible inclusion in the core.

Change History (12)

#1 @interconnectit
13 years ago

  • Component changed from General to Post Types

Excellent idea - it's been something that's left me a little bemused in the past. I even went in recently *expecting* that links were a post type and spent a good few minutes confused that they weren't there. Why I thought it, I don't know.

I guess it's a bit late for 3.3 but 3.4 anybody?

#2 @SergeyBiryukov
13 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Closed #14339 as a duplicate.

#3 @nacin
13 years ago

  • Keywords needs-patch removed

The links feature has mostly run its course. Whenever this comes up in conversation, someone always says, "But links should probably just be a widget." And it's true. Unfortunately, widget management isn't at the point where you could easily manage an entire list of links from there. And then we give up and move on to other topics.

I'm thinking about a way to leverage a post type internally for a text widget -- bigger screen, built-in revisions, and the like. Maybe something similar could be done for links.

#4 @sanchothefat
13 years ago

I think enough people still use links that it's worth keeping, certainly within if not There's too much UI involved eg. the rel attribute stuff for it to be managed as a widget only. For my purposes I've used featured images, link categories, and link descriptions before now so I disagree with the notion that it should just be a widget based on my own real-world usage.

That said one aspect of the work could be a simplified link widget that allows you to build a list of links with a very limited UI eg. title and URL only. These could then also be available to edit further in the links section of the admin.

If nothing else it would be a step towards removing the links table.

PS. @nacin It's interesting you mentioning using a post type for a text widget too - I wrote a plugin called spots that does exactly that with a few extra goodies including templates and a simple way to call bits of boilerplate text without the need for a widget area. DM me your email on twitter (@sanchothefat) and I'll send you a zip of the pre-release to try out.

#5 @dd32
13 years ago

I think enough people still use links that it's worth keeping

I agree, that enough people probably use it to keep it around (even if I've never seen anyone using anything other than the default list, or for their main menu)

There's too much UI involved eg. the rel attribute stuff for it to be managed as a widget only

I'd be willing to bet 90% of people (who use the Links functionality) use literally nothing other than URL + Title.. Like Nacin said, the widget interface certainly doesn't cover what would be needed for using it, but it's probably the only thing in the menu which I would gladly throw into a Plugin and leave.
In other words: Anything more than a basic list UI is probably used by less than 10% of people, and IMO, falls outside of the 80:20 vision - That being said, I don't expect to see any movement there any time soon.

Removing the Links table all together is going to happen sooner or later, It's something that's been talked about since CPT's were introduced (or even before..), just a task that no-one has really wanted to take on IMO..

#6 @sanchothefat
13 years ago

I can see your point there. A plugin might be the best bet for more advanced link management in which case I can develop what I have already separately to core and just add the conversion tool and some template tags.

I can still build a simple link listing widget for core. In terms of a conversion script it would require checking existing link widgets, grabbing the links in the category chosen and creating the data. Any other links not accounted for in an existing widget would be lost.

Should I create a new ticket for the widget and close this one or keep it here?

#7 @thee17
12 years ago

I use the Links for Ads on pages. Also I use the image for icons to my social networks.

#8 @thee17
12 years ago

  • Cc charles@… added

#9 @MadtownLems
12 years ago

I'm thinking about a way to leverage a post type internally for a text widget -- bigger screen, built-in revisions, and the like.

Does "the like" also include rich text and media upload buttons, finally?

As far as the Links widget is concerned, my opinion is the 3.0 menu system and Custom Menu Widget have made the Links widget pretty unnecessary and would have no issues seeing it go away. And it would have the side benefit of having Pages get one step closer to Posts on the admin menu :)

#10 @thee17
12 years ago

  • Cc charles@… removed

Related: #21307

#11 @azizur
12 years ago

  • Cc azizur added

#12 @nacin
12 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I think it is fair to close this as a duplicate of #21307.

Note: See TracTickets for help on using tickets.