Create Links From Custom Fields
-
Hi,
I want my custom fields to behave more like tags. So for example, on this page http://codex.ww.wp.xz.cn/Custom_Fields they give the example of ‘Mood: Happy’.
How would I be able to make that a link so that when clicked it would take you to a page listing all posts that include the mood custom field as happy?
Thanks!
Matt
-
Hi Matt,
This is an interesting question. I guess the first question to ask is, how many different entries would this custom field have?
For example, if it were the “mood” field, would there be a unique answer each time or would you like to choose from a list?
I recently did something using Advanced Custom Fields and their Taxonomy field. Basically, I made a bunch of tags for the posts and had them loaded into a custom field. The user could then select whichever ones they wanted when writing a post via a checkbox list.
I think ideally you would want to use tags or taxonomies because they are built-in ways to categorize this type of data. But using custom fields, you could then create an easier-to-use way for someone updating the site to select them.
Hi!
Thanks for your response. There will be quite a few. I basically want to create a catalogue (there may well be plugins out there ready to handle this).
So let’s say I want to track all my favourite films that I’ve seen, I may want to put a release date with each one and that be linked, so quickly I could see all movies from 1989. Then also list the director for each movie, so you could then see all Spielberg movies at once.
I’ve installed ACF. Would this be able to achieve this?
Thanks!
MattIt would be fairly easy to create tags for all of these items. You could either use the included tags meta box included with WordPress or just run them through ACF as I mentioned before with the Taxonomy field.
The main advantage of using the built in WordPress meta box is that you can easily create new tags as you are writing a post. Plus you don’t have to mess with customizing templates like you would with custom fields.
It really depends on how comfortable you are working with the existing tags meta box and working with themes. You could, if you like, use something like Simple Tags to make that meta box a little nicer to use.
I guess this is my long-winded way of saying that what you want to do is built in to WordPress and how you manage it is really up to who will be updating the site π
So basically use tags instead of custom fields?
I would recommend Tags because it will be much easier to setup.
You can go as wild as you want with elaborate setups, but that’s sort of like reinventing the wheel for something like this.
Great thanks!
I suppose the only issue then is pulling out relevant tags in relevant places? So I could tag something: 1989, Spielberg
However, in my template I’d want it to say:
Released: 1989
Director: SpielbergAm I right in saying that would be a problem?
MattHmmm, if you wanted to do something like that for your template, you might want to create categories or taxonomies instead. You can separate those out into categories and sub-categories, for example.
So you could have categories or taxonomies that are something like this:
Year
-1989
-1988
etcDirector
-Spielberg
-Kubrick
etcDoes that make sense?
It does make sense, though then you lose the functionality of quick adding.
So if I come across a film that uses a director for the first time, then I have to go to categories, add the category and then go back to the post. So not as easy as tags or custom fields.
Never thought it’d be so confusing! π
You can add categories right from your post, using the Categories meta box:
Categories
The general topic the post can be classified in. Generally, bloggers have 7-10 categories for their content. Readers can browse specific categories to see all posts in the category. To add a new category, click the “+Add New Category” link in this section. You can manage your categories by going to Administration Panels > Posts > Categories.
The topic ‘Create Links From Custom Fields’ is closed to new replies.