4

I have set some custom field 'artist' and 'song-name' displaying like:

Artist: <user input>
Song Name: <user input>

My question, how do you make the on artist and song name into a clickable link? Such that when the artist name is clicked for example, it will bring up the page with all posts of that artist name? Thinking about it, its kinda like the_category() or get_category_link, only I am using custom fields.

4
  • Have you thought about using a custom taxonomy instead? At least "artist" would fit it's purpose perfectly.
    – Michal Mau
    Commented Feb 29, 2012 at 22:05
  • Yes, but taxonomies are kinda limited to looking like a category box or tag cloud. If they can be customized to look like a text field input, that will be better. It's mostly for presentational purposes on why I chose custom fields.
    – John
    Commented Mar 1, 2012 at 5:23
  • hmm.. I think I might use category-like taxonomy. But taxonomies are always positioned on the right. Anybody know how to position them on the left side of the edit screen?
    – John
    Commented Mar 1, 2012 at 5:43
  • Ok, nevermind. I researched and repositioning can be done via removing and re-adding meta box.
    – John
    Commented Mar 1, 2012 at 10:54

2 Answers 2

4

This is better accomplished by registering a new taxonomy. You get all of the advantages of categories and tags without the hassle of custom fields.

Codex: register_taxonomy

Tutorial: How to Create Custom Taxonomies in WordPress 3

1

These are two very different data relationships: Each song may be assigned to more than one artist – it is a 1:n relationship. But each song has just one title – a 1:1 relationship.

So use a basic meta field (post meta) for the title or even just the title field.

And use a custom taxonomy for artists. Look at the very similar question about quote authors to get an idea how this could be done.

1
  • Thanks for pointing the link out. I will check it out. Actually, though, in my case, the song title can be linked to multiple artist who sang the song, so having it as a taxononmy does help. I only which there is a text field taxonomy for presentational purposes.
    – John
    Commented Mar 1, 2012 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.