Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author GatorDog

    (@gatordog)

    Not sure, do you just call the form function from a post template and it provides a front end form for the user to enter/edit the field data and submit?

    Thread Starter bnfw

    (@voltronik)

    Yes, along with the ID.

    Here’s the docs: http://customfieldsuite.com/docs/form/

    Is it possible to use the ID of the category? Or does CFS just do post and page types?

    Plugin Author GatorDog

    (@gatordog)

    You couldn’t pass the ID to the cfs API, it takes a post id which would either be a post or custom post type. However I can build a wrapper around it like with the get_category_meta function, where you could simply pass the categoryID, and probably the taxonomy name. Will try to roll that out this week.

    Thread Starter bnfw

    (@voltronik)

    Great, thanks!
    That would be superb.

    Plugin Author GatorDog

    (@gatordog)

    @voltronik Upon taking a closer look, it looks like the form api is for editing / creating posts. What exactly are you trying to do with this for the category or custom taxonomy?

    Thread Starter bnfw

    (@voltronik)

    I’d like to be able to edit the custom fields from the category on the front end.

    This plugin allows custom fields to be added to the category, so it would be great to utilise the a CFS form() to edit these. It should work for either a category or a taxonomy (or anything that your plugin allows you to add a custom field to for that matter).

    Plugin Author GatorDog

    (@gatordog)

    A new function has been added, get_category_form(). You can pass the term to it, otherwise it will default to queried object, eg the category on a category archive page.

    Haven’t had a chance to test it, however, you can download the dev version from the Development tab of the plugin page – Dev Version.

    Thread Starter bnfw

    (@voltronik)

    Thanks!
    But it doesn’t seem to work for me. I’ve tried get_category_form() both with and without a term ID but had no luck.

    Happy to continue testing though when you’ve had a chance to take a look.

    Plugin Author GatorDog

    (@gatordog)

    There was a typo in the cfs function call, this has been fixed and it works as expected now. Have also released the new version which includes this.

    If you want to pull up a category form anywhere, you would pass it the term object, the term id would not work. You can get the object from the id by using the WordPress get_term_by function.

    Thread Starter bnfw

    (@voltronik)

    Thanks.
    For some reason it’s not working for me.

    If I use $cat = get_category( get_query_var('cat'), ARRAY_A ); and do var_dump of $cat which outputs 16 as the category ID in this case, then use get_category_form($cat);, the form doesn’t show.

    Plugin Author GatorDog

    (@gatordog)

    @voltronik, get_category_form takes and object, your code is sending it an array. Try this instead, leaving out ARRAY_A, which by the way should be in quotes, it’s not a contstant.

    $cat = get_category(get_query_var('cat'));
    get_category_form($cat);

    You should also be just able to use get_category_form() without an argument, it looks like the queried object in your case would be the category.

    Thread Starter bnfw

    (@voltronik)

    Ok, tried that. Even did a var_dump($cat) just to make sure it was an object and not an array this time but still no luck. Nothing it being outputted at all πŸ™

    Plugin Author GatorDog

    (@gatordog)

    That’s odd, are you able to get the meta fields (get_category_meta)? I’ve tried this using your code and just plain get_category_form() and both work in the archive/category template.

    Thread Starter bnfw

    (@voltronik)

    Nope, still no joy.
    I’m using:

    $cat2 = get_category(get_query_var('cat'));
    var_dump($cat2);
    get_category_form($cat2);
    get_category_meta('archive_project', $cat2);

    But still don’t get anything of any sort.
    If it helps, I am getting a warning in the console:
    PHP Warning: Illegal offset type in isset or empty in /Users/Jack/Dropbox (COAS)/Voltronik/The Business/Projects/Mission Control/Build/wp-content/plugins/custom-field-suite/includes/api.php on line 27

    Plugin Author GatorDog

    (@gatordog)

    Is the field group set for “Category” in the field group settings? Do the fields show up in the category editor? Post > Category, then edit a category?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Use with cfs form() ?’ is closed to new replies.