Hello,
Probably yes, but I can take a look if you show me the page in context. ->name is correct, but is depends on what $category is.
Thread Starter
eckul
(@eckul)
Thanks Mike, I want to populate a column in gravity forms when someone applies for a job. I’ve created a new “Category” column in gravity forms with “wp-job-manager-fields-master” I now need to send the category everytime someone applies for a job. I’ve tried adding the below code to “content-single-job_listing.php” but I am having no luck any help would be great.
`<?php
add_filter(‘gform_field_value_category’, ‘populate_post_category’);
function populate_post_category($value){
global $post;
return $category->name;
} ?>`
I’m not sure what to suggest here – I’m not a gforms developer unfortunately. However I can see from your snippet, there is no ‘$category’. You have not defined it, so ->name will not exist.
Thread Starter
eckul
(@eckul)
Hi Thanks, for your help I found another way around this. Cheers
Hi eckul.
Could you send me your final solution?
I’ve got the same problem. 😉
Tnx in advance.
Thread Starter
eckul
(@eckul)
Hi mopsfidel, I ended up adding a hidden field to the gravity form and I then auto populated it with the parameter ‘jobcategory’. I can’t remember if I created this parameter or if it already existed. I’ll get back to you asap. Cheers
Thread Starter
eckul
(@eckul)
Hi, I was using a filter to populate the field but I was having to add each category manually so I scrapped this. I ended up just creating a hidden field and then used the below Jquery to grab the category name from the side bar and populate the hidden field. Cheers
var cat = $('.job_listing-widget.default-widget a:first').text();
$("#input_1_19").attr('value',cat);