• Hi.

    Everybody knows of the Custom Field inside WP-ADMIN, which allows custom data to be added to each post on a post-by-post basis, which can then be processed by wordpress (and plugins/hacks) to do certain things.

    What I want to know is, how easy would it be to create a Custom Field for Categories, in pretty much the exact same manner as the posts’ Custom Field functions.

    My reasons for this are simple – it would allow the categories custom-data to be treated dynamically and individually, each with their own accompanying data held within the Custom Field, just as the posts contain their very own Custom Data, if you understand what I’m getting at. Therefore, I could for example, add Meta Tags to my Categories on an individual basis, perhaps.

    I know some people think Meta Tags are now almost redundant, but there are many search engines which still see them as important (MSN being one of them) – and I feel for this reason, the inability of a WordPress user to be able to type in their own meta tags (keywords and description, ideally), by using a Category Custom Field or two, this is a big shame.

    I have seen plugins which generate meta tags using the categories descriptions, and use a snippet of that etc, but in my honest opinion, this isn’t good enough. Unless you manually type in your exact keyword-rich meta, and absolutely perfect meta description yourself, you may aswell not be using meta tags atall. It’s about precision.

    I’m no expert on WordPress or PHP, but I’ve always managed to come very close to getting what I want out of both by sheer determination (and half a brain, of course:). But seriously, some expert advice on how to best go about this, if it can be done, and some pointers would be very useful and very appreciated by many, many WordPress users. It may not even be a case of ‘custom fields’ been used, but the general jist is, (this is how many current meta-data plugins for posts work), if theres a way to do this but for Categories, then we are all going to benefit.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • If you thought of the meta-categories as sub-categories, you might consider using the Parent/Child ability of Categories.

    Thread Starter bernie2

    (@bernie2)

    Do you mean by creating for instance 2 subcategories (which may perhaps be hidden) like so:

    Main Category
    – Subcategory 1 (Description contains Meta Keywords for Main Category)
    – Subcategory 2 (Description contains Meta Description for Main Category)

    Say the Main Category is the one which needs the meta tags: Keywords and Description, well Subcategory 1 could be assigned in its own description a set of Keywords,keywords,keywords for instance, and Subcategory 2’s description could be used for the Meta Description, and then they are called up by Main Category respectively (and I know this isn’t real code, but I’m just saying for arguments sake)

    get(subcategory_1_description) for Meta Keywords
    get(subcategory_2_description) for Meta Description?

    Like this?

    Good suggestion, but if there was a cleaner way without having to create more categories. I know there are some PHP genius’s out there who love a challenge. Who’s up for it?:)

    Thread Starter bernie2

    (@bernie2)

    Is there seriously nobody who knows how to add a custom fields option / hack / plugin for the Categories? Or if its indeed even possible without a hell of a lot of coding?

    I’ve looked high and low on Google and can’t find a thing, nor can I on here. It would be an advantageous thing to have for many people and many reasons, not simply for the Manual inputting / control of Meta Tags through the Admin section for the categories as I wish to have, but for other things also.

    2 cents are welcomed, come one come all!

    I too would love such a plugin – but rather than writing it, I’m kludging my way through by creating little text files to contain all my metadata. I’ve got this code on my sidebar, to show the “metadata” chunks of text I keep in files named for each category:

    <?php if( is_category() ) {
    $cid = get_query_var('cat');
    $name = $wpdb->get_var("SELECT category_nicename FROM $wpdb->categories WHERE cat_id=".$cid);

    $path = ABSPATH.'wp-content/text/'.$name.'-include.txt';

    if( file_exists($path) ) {
    readfile($path);
    }

    } ?>

    It’s not as elegant as doing it through the admin interface, but it’s easier than hard-coding a different template for each category.

    I guess you could use the category description of every category to store those data and much more just by placing some tags like the <!–more–> tag in posts and each tag should delimit a certain type of data.
    Say there could be a tag for meta keywords like <!–key–> or simply <key> …</key> and then you read the description in an array which has the $key = the tag you wrote and the value the string from the tag to the next tag. It’s just a rudimentary ideea but it can be elaborated. You could write any tag there and the function would recognize it and fill the right key-values in every value of the array. And after that with some plugin you could place that info where it belongs.
    After all, this is some sort of describing that category…meta keywords and so on, even the filename and/or path to the image associated with that category.

    I was looking for something like this and couldn’t find anything so I wrote my first plugin. If anyone is interested email me and i’ll send it to you.

    DISCLAIMER: It’s a piece of crap, but it might be a starting point for you.

    Screenshot: Click to see screenshot.

    email: herrin @ gmail.com

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom Field for Categories / Category Meta Tags’ is closed to new replies.