WordPress.org

Ready to get started?Download WordPress

Forums

Request: Custom fields for categories (36 posts)

  1. esmi
    Forum Moderator
    Posted 5 years ago #

    It would make semi-intelligent displays so much easier, more flexible and less prone to breakage. Right now, there's only the slug, title and description to check against - all of which could be subject to change.

  2. stvwlf
    Member
    Posted 5 years ago #

    agree

    there is a partially fleshed out plugin called category-custom-fields I used on one site. Its not ideal but it works.
    http://www.flairpair.com/blog/wordpress/category-custom-fields
    Perhaps someone would be willing to refine it further.

  3. esmi
    Forum Moderator
    Posted 5 years ago #

    Thanks for the link. I'll have a look at that and see if I can persuade my friendly plugin developer to take it further.

  4. stvwlf
    Member
    Posted 5 years ago #

    Hi

    Yesterday I went to that site for the first time in months and was able to see again the plugin is still there. Today I went back to it, to check for someone else, and was blocked from seeing the site by a Google malware screen. I don't know if that is valid or a mistake - the site would have been hacked if it is valid as it is a legit developer.

    At any rate, if you can't get the plugin from that site let me know - I have a copy here & can upload it somewhere so you can get it.

  5. esmi
    Forum Moderator
    Posted 5 years ago #

    Guess what? The plugin developer's site is currently flagged up as suspicious by Google. 8 exploit(s). 5 scripting exploit(s). :-(

  6. stvwlf
    Member
    Posted 5 years ago #

    Hi

    I put it on one of my sites - you can download here
    http://mtncomp.com/uploads/category-fields.zip

  7. stvwlf
    Member
    Posted 5 years ago #

    Here's another one worth checking out by the way - needs a plugin developer to integrate but creates the underlying structure
    http://coffee2code.com/wp-plugins/custom-fields-for-anything/

  8. esmi
    Forum Moderator
    Posted 5 years ago #

    Got the second one, thanks, but the link to one of your sites is giving a 404.

  9. stvwlf
    Member
    Posted 5 years ago #

  10. esmi
    Forum Moderator
    Posted 5 years ago #

    Got it, thanks.

    Meanwhile, work has started on turning the Custom Fields for Anything plugin into one specifically for adding and managing custom fields for categories. The alpha is complete and I'll start testing it over the next few days.

  11. MichaelH
    Member
    Posted 5 years ago #

    esmi -- since 2.8 will have expanded capability to create 'custom taxonomies' you might consider making that plugin 'portable'. Meaning, support more than just 'category' taxonomy but also the 'post_tag', 'link_category', or any other new taxonomy.

  12. elfin
    Moderator
    Posted 5 years ago #

    gee thanks.

    I've coded, or rather rejigged the category-fields plugin. But hadn't planned on releasing it as the majority of the code wasn't my own. esmi has a copy to play with and will let me know if anything needs adding.

    It's possible that the coffee2code plugin is more adaptable, but I will have another look at it when 2.8 comes out to see if I can extend it.

  13. stvwlf
    Member
    Posted 5 years ago #

    i'd like to be in the loop on this one!

    what i'd like to see is the additional fields displayed right on the category maint page, rather than on a page by themselves. And the option to have the visual editor on some of the fields...

    and yes, the same for tags and link categories would be great.

  14. elfin
    Moderator
    Posted 5 years ago #

    email me: elfin@elfden.co.uk and I'll send you a copy.

    I looked at the category page in WP for the first time in 2.7 (can't believe I haven't visited that page in so long) It may be possible to add in on the category page, but I haven't tried so far.

  15. stvwlf
    Member
    Posted 5 years ago #

    Hi

    At a quick glance it appears this plugin rewrites the output display on the WP category page. This might save you some time. It also activates the visual editor on the cat descrip field.

    For the extra fields it would be nice to have the option whether to use the visual editor on a particular field or not as sometimes it would get in the way, other times be quite useful.

    http://www.laptoptips.ca/projects/category-description-editor/

  16. elfin
    Moderator
    Posted 5 years ago #

    I took out the visual editor.

    All I want the plugin to do, and all it should do in my opinion, is replicate the postmeta key/value pairings.

    Though I don't use the visual editor myself, so perhaps I'm biased.

  17. stvwlf
    Member
    Posted 5 years ago #

    Example of visual editor use:
    I use the original plugin on one site. The site owner is very non-technical. One of the custom fields is being used for multi-paragraph blurbs about a category, longer than the category descrip field allows. Its handy for her to have a visual editor because she doesn't want to deal with <p> <br /> <a> and all of that to mark up her thoughts. She just wants to wrote them down as they come to her. Her mind just does not work in HTML.

    I respect your thoughts about the editor, just explaining its value in certain cases.

  18. Sonika
    Member
    Posted 4 years ago #

    @stvwlf, thanks!

  19. Sonika
    Member
    Posted 4 years ago #

    How to upgrade plugin category-fields for wp 2.8

    changes in category_fields.php:

    /////////////////////////////

    [1]

    wp_enqueue_script('wp_tiny_mce');

    replace with:

    add_filter('admin_head','ShowTinyMCE');
    function ShowTinyMCE() {
    // conditions here
    wp_enqueue_script( 'common' );
    wp_enqueue_script( 'jquery-color' );
    wp_print_scripts('editor');
    if (function_exists('add_thickbox')) add_thickbox();
    wp_print_scripts('media-upload');
    if (function_exists('wp_tiny_mce')) wp_tiny_mce();
    wp_admin_css();
    wp_enqueue_script('utils');
    do_action("admin_print_styles-post-php");
    do_action('admin_print_styles');
    };

    [2]

    global $wpdb, $table_prefix;
    $wpdb->query("CREATE TABLE IF NOT EXISTS '$wpdb->cat_fields' (
    'field_id' INT NOT NULL auto_increment ,
    'cat_id' INT NOT NULL,
    'kkeys' TEXT NOT NULL ,
    'kval' TEXT NOT NULL,
    PRIMARY KEY ( 'field_id' ))");

    replace with:

    $sql = "CREATE TABLE " . $cat_fields . " (
    'field_id' INT NOT NULL auto_increment ,
    'cat_id' INT NOT NULL,
    'kkeys' TEXT NOT NULL ,
    'kval' TEXT NOT NULL,
    PRIMARY KEY ( 'field_id' )
    );";
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);

    /////////////////////////////

    It's work for me.

  20. maorb
    Member
    Posted 4 years ago #

    Do you intend to release soon a version of the improved plugin?

    Thanks

  21. bravepioneer
    Member
    Posted 4 years ago #

    Sonika! You're a star!

    Wondered why the image editor didn't work. I'm running 2.8.4. You're a godess for the fix. Thanks again!

    A damn useful plugin, with Sonika's mod above. Hope someone much cleverer than me develops this, along with Sonika's mod for 2.8+ use.

    I do have a question about using the plugin:

    Can I present my category fields on a single page of that same category? I tried using a single cat template but no luck.

  22. syncbox
    Member
    Posted 4 years ago #

    To echo maorb, is there a current release of this plugin? I love the get_custom plugin from coffeetocode (it's my #1 fav) but am always looking for plugins that make using WordPress as a CMS better....

    put me on your list for being willing to beta test it. please!

    syncbox AT gmail DOT com

  23. john.andrews
    Member
    Posted 4 years ago #

    I tested category-fields mentioned above without much success in 2.8.4.

    Perhaps I'm missing something, but what's wrong with Eric Le Bail's Category Meta Plugin. It's rather barebones, but is exactly what I needed for assigning additional attributes to categories.

    I will say while Category Meta works great as is, but I'm really inspired to to extend it with functionality found in the popular more-fields plugin.

  24. regios287
    Member
    Posted 4 years ago #

    I tried http://coffee2code.com/wp-plugins/custom-fields-for-anything/ and it doesent work.
    -after installed, u cant edit/add/manage anything

    I tried http://mtncomp.com/upload/category-fields.zip, it also dident work (with Sonika's update)
    -after installed, get a error messege in wordpress

    I tried http://wordpress.org/extend/plugins/wp-category-meta/ and it dident work
    -added custom field, pasted code in php files, the tags dident show

    Is there one that works?

  25. JHouse
    Member
    Posted 4 years ago #

    I tried all of the aforementioned plugins with 2.9.1 and no dice. Was able to add the fields in the admin area, but couldn't get it to echo on the category page based on the php calls form wp-category-meta readme file.

  26. sparro
    Member
    Posted 4 years ago #

    This has been bugging me too, and I've now figured out a way to do it very simply using the HeadSpace2 plugin (which many of you might already have!)

    Simple tutorial here: Custom Fields for Categories

    I'd love a tweet or link if you found it useful.

  27. hafman
    Member
    Posted 4 years ago #

    jeanfayette,
    Headspace isn't working for me, nice to have a custom field in the category editor but alas the template code just isn't calling the custom value. I followed the instructions!

  28. sparro
    Member
    Posted 4 years ago #

    Can you paste your code?

    Is the custom value coming up as a field on your category description page?

  29. jvolvovski
    Member
    Posted 4 years ago #

    I am having the same problem.

    Installed HeadSpace2, added a custom field called "first-name"
    In the themes, I am calling it with the following code:
    <?php echo MetaData::get_custom ('first-name'); ?>

    Nothing was showing up. Then I realized the same field - "first-name" is also on every individual post. When I enter something in the "first-name" field on the individual post, it returns the value.

    But, how do I access it for specific categories?

    Thank You!

  30. sparro
    Member
    Posted 4 years ago #

    You must be calling it on single.php or in the single loop - so it's looking for the custom value for the individual post.

    If you insert your value on the category page and call the custom field on an archive or category page outside of the posts loop, it will work fine.

Topic Closed

This topic has been closed to new replies.

About this Topic