Custom fields: Using ‘key’ with empty ‘value’ ???
-
Hope I can explain this correctly: Until now I had made 4 extra categories (like ‘interactive’, ‘sound’ etc.). These were not actual main categories but I used them to indicate if a post was something to read, hear, view or do. For this I have 4 little icons that, by assigning a post to one or more of these categories, will automatically appear next to a post, just like plugins of that kind. But other then in the case of the plugins that do this, my extra 4 categories aren’t ‘real’.
This works ok, but I’m alway having difficulty of excluding those 4 categories from all kinds of listings and, especially, all sorts of plugins I use.
Therefore I was experimenting with the custom fields. This also works, by using 4 custom fields with the same names as previously the categories. So when adding a post, I also add one or more of those custom fields. But it’s not really userfriendly because I also have to add something (doesn’t matter what) to the ‘values’ field, otherwise the custom field will not be excepted by wordpress.
Any idea of changing this or some other suggestion? At this moment I’m using this code:
$extravelden = get_post_custom_keys();
$aantalvelden = count($extravelden);
if ($aantalvelden != 0) {
for ($i=0;$i<=$aantalvelden;$i++) {
echo "<img src=\"plaatjes/".$extravelden[$i].".gif\" alt=\"\" />";
}
}
- The topic ‘Custom fields: Using ‘key’ with empty ‘value’ ???’ is closed to new replies.