Discussion on Gravity Forms Post Listing Field

nathanfranklinau

nathanfranklinau supports this item

Supported

60 comments found.

Hi Nathan,

I love the plugin and have been using it for awhile.

Is there a way to “exclude” posts from a certain category from showing in the dropdown list?

Thanks,

Chase

Hi Chase,

You can use the gfpl_post_args filter like this:

add_filter("gfpl_post_args", "theme_gfpl_post_args", 10, 5); function theme_gfpl_post_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { return $args; }

$args can be filled with the same params as you would WP_Query.

http://codex.wordpress.org/Class_Reference/WP_Query

Hope this helps.

Thanks Nathan! I’m using this to try to exclude a category for appearing in the dropdown.

function theme_custom_gfpl_post_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { $args[“cat”] = “-34”; return $args; }

It’s still showing the post in the excluded category. This post is using a custom post type of “ai1ec_event”. Do I need something to reference this custom post type or should it work as is?

Hi Chase, Try using category__not_in.

$args["category__not_in"] = array(34);

Let me know how you go.

Hi,

I enabled the “enhanced UI user interface” for the post field (it is a dropbox), but in the front end it just appears as a normal dropdown.

There is another dropdown field in the same form which i use the standard GF fields with enhanced UI enabled and it appears ok in the frontend

Is there a way for me to send you the url in private so you can take a look at the issue?

btw I am using GF Version 1.8.17 and your plugin version is 2.0.1

Hi, sure. can you send the information directly to me@nathanfranklin.com.au and I will check it out.

Hi

Thanks for the plugin.

Is there a way that we can search of custom post? for woo commerce categories and products?

Thanks

Mark

i guess not then…

Hey! Sorry, I missed this one, it must have slipped through the cracks somehow. I’m not sure I understand the question. You can select the product post_type in the field options and group by the product category without needing to write code. Maybe I’m missing something?

Hello, I purchased your plugin in hopes that it would solve a problem for me.

I am trying to output a name and address into the notification email based upon a selection made on the form entry page.

I know I can use the conditional function on the notification page, using a different notification for each name and address, but the list of different addresses is around 100…

I figured it would be easier to upload each name and address as a post, and then use your plugin to pull that information into the form.

My question is, how do I get the body of the post to output in the notification? I can only get it to output the name of the post. Ideally, I would like the post body to also output on the form front end after it is selected, but that isn’t essential.

Thanks for any help you can provide.

Regards,

Joel

Hi Joel in terms of the output in the front you can use the filter ‘gfpl_post_title’. It’s defined like this in the code: $output[$post->ID] = apply_filters("gfpl_post_title", $post->post_title, $post->ID, $meta_key, $group_by_taxonomy, $field);

I’m not sure if there is any easy way to change the text from the notifications presently. This is to do with how the plugin was originally created. The code needs a little bit of revamp to accomodate things like this.

Thanks.

Fabulous plugin! Worked just as it is described and support was fast, courteous and very helpful. This is a great plugin for customizing dropdowns with any sort of post-type. :-)

Hi Nathan,

I just purchased the plugin. Really useful.

Is there a way to replace multiselect by checkboxes? Thank you for your help. Best,

Hi digitd, Apologies for the delay, currently having some downtime. Unfortunately there is no way to achieve this. Sorry!

How can I (with php) get the permalink (or at least the post ID) alone for the post selection that the visitor makes using any given (non multi-select dropdown) post listing field in a gravity form?

I need this so I can replace the value of the Post Listing field with the permalink so when my custom notification is sent, it’s part of the message. I plan to use the gform_after_submission hook to do the replacement itself.

If there’s an even easier way to set the GF field value to the permalink for the selected post, I’m certainly open to that too!

Hi WPWiseOwl, You can pull the value out of the entry by referencing the ID of the field. I would most likely create a hidden field and access the value of the post listing field in gform_pre_submission and set the hidden field value to be the permalink. See http://www.gravityhelp.com/documentation/page/Gform_pre_submission for a little bit more info. Let me know how you go.

Hi, pre-sale question: I’m looking for a way to create a form with several dropdown menus. Each menu should be listing posts filtered by post type and category.

Example:

  • list of CPT “A”, only from TAX_TERM “X”
  • list of CPT “B”, only from TAX_TERM “Y”
and so on…

At the very least, I’d need to list as follows:

  • list of CPT “A”, only from TAX_TERM “X”
  • list of CPT “A”, only from TAX_TERM “Y”
and so on…

I hope what I need to do is clear… is it possibile out-of-the-box (or with a simple tweak) using this plugin?

Thanks, regards

Thanks for the quick reply.

It doesn’t look like a plugin conflict, nor a theme conflict. Please note that I performed the following tests in my staging site, cause the main site is already published. But they’re clones, so this shouldn’t be an issue.

In case you wonder, I’m not trying to network activate it. That said…

Tried with Theme X, Genesis, TwentyFifteen. Nothing. :(

Tried with all plugins disabled (all but the few that are network activated, but they’re just a handful). Worth mentioning, none of the Gravity Forms-related plugins are network activated. So, a conflict with a “similar” plugin seems unlikely, since I disabled all those plugins while testing.

There is no tale-telling message when wpdebug is on, which confuses me quite a lot.

Just a few Notices and Strict Standard messages related to bbpress and is_single being called incorrectly.

Chrome Console isn’t showing any obvious error, neither. In fact, everything works exactly the same when I enable/disable every plugin, except this is not activating.

Host Details:

PHP version 5.5.19 MySQL version 5.6.17 WP memory limit 256M Max memory limit 512M

I’m not saying it’s your fault, but I’d appreciate if you could help me. Maybe pointing me in the right direction about what to look for.

Thanks :)

In an effort to anticipate your most likely (since it’d be the most sensible) proposal, uninstalling and reinstalling didn’t work.

I just tried via FTP (first time, I tried with the wp installer) and nothing changes.

(failed to mentin this earlier: I’m on a VPS, if this helps you in any way)

Thanks again.

FYI, a curiosity: I’ve found a workaround for what I consider a bug.

In multisite (in my environment at least) it should be network-activated. Repeat: I was able to activate it only via networ-activation.

Weird, isn’t it? BTW, it’s somewhat solved for now. On a different note, is there some kind of documentation about filters? I’ve found something deep-digging the comments here, but I’d love if you could put together a doumentation file.

Thanks, regards :)

I need to list the post and add a conditional logic to display another field based on the post’s category. Is that possible with this plugin

Hi,

I want to set a filter for categories. So I get only one category in a dropdown field on a form. I tried this with code on other post on this side, but I get all categories. What should I do?

Many thanks from germany Marco

Hi there Marco, Try checking the docs here: https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

Hope this helps. If not send me an email with your sample code to me@nathanfranklin.com.au

Ok, I have send you a mail…

Hi nathanfranklinau ,

I’m using GF 1.9.8 and Gravity Forms Post Listing Field 2.0.

When selecting the checkbox “Enable enhanced user interface” it still displays a normal dropdown field without the chosen script being applied to that dropdown field.

Any ideas?

Hi, Apologies for the delay. I will need to look into this and get back to you. Apologies that the plugin isn’t working as expected.

No worries – let me know if you need anything from my side :)

I’ve sent you a mail as well just in case…

Hey! I’ve tested it locally and everything works as expected. I would assume there is some type of javascript error somewhere on your page preventing Chosen from instancing. Send me an email to me@nathanfranklin.com.au with the details of your site and where I can see the form with the field on it and I will check it out.

Hey Nathan,

I’m really excited about your plugin! If it really delivers what I need it for – (pre)populating WooCommerce products in a drop-down –, then $14 is a real bargain. :)

Just one quick question seeing the plugin hasn’t been updated for over a year: is it safe to use it with current versions of WP + GF + WC?

Cheers,

Zsolt

Hey! There shouldn’t be any problems, but if there are I’m available for support. :)

Thanks for the quick reply and the positive attitude, I’m definitely buying! :)

Hi there, I’ve got a custom post type “event” and custom taxonomy “event-category”. When not bothering with event-category, I was able to select events in the form and they showed up in the dropdown list just fine.

Then I saw in your support comment about excluding certain categories, and have tried to modify the code to fit my scenario.

Here’s my latest iteration:

function theme_custom_gfpl_post_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { 
    $args = array (
    'tax_query' => array(
            array(
                'taxonomy' => 'event-category',
                'ID'    => array(57,58),
            ) ),
    'post_type' => 'event');
}
add_filter("gfpl_post_args", "theme_gfpl_post_args", 10, 5);

I only need to show EVENTS that are in EVENT-CATEGORIES 57,58.

The code above doesn’t work. The code you posted below didn’t work for me either.

Thank you in advance.

Hi there, checkout this link: https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

In your code above try:

'tax_query' => array(
           array(
               'taxonomy' => 'event-category',
               'terms'    => array(57,58),
               'field' => 'term_id'
           ) ),

Also, it might be best to rather than reset the whole $args array just use something like this:

$args[‘tax_query’] = array( array( ‘taxonomy’ => ‘event-category’, ‘terms’ => array(57,58), ‘field’ => ‘term_id’ ) );

Hi, is there a way to have two post listing fields but with different args?

I think I figure it out,

I wanted to show one field with all the posts from the current user and the other field with all the posts minus the current user both from the same custom post type.

on gravity forms I made the 1st field as normal added the custom post type i wanted and everything on the 2nd field I changed the post type to something different like pages and on the filter I made it go back to the post type I original wanted.

If I don’t do this then it doesn’t work it gives me the same args from the 1st field.

add_filter(“gfpl_post_args”, “theme_pl_args”, 10, 5); function theme_pl_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { if(strpos($field[“cssClass”], “your-css-class”) !== false) { $args[“author”] = get_current_user_id(); } if(strpos($field[“cssClass”], “other-css-class”) !== false) { $args[“post_type”] = “original-post-type”; $args[“author”] = ”-”. get_current_user_id(); } return $args; }

Hey. Thanks for the report on this. I will check it out and get back you.

Hi, is it possible to have checkboxes instead of select-list? If not could you add this functionality?

Then there is a bug. Plugin returns “array” into messages instead of the list of selected post

Hey there, Unfortunately this is not on the roadmap at this stage. I haven’t had any complain about the ‘array’ issue. Are you using any custom hooks in the plugin to extend it’s functionality?

Hi I have tested the plugin and I’m unable to reproduce the issue of getting ‘array’. Are you able to send send screenshot and steps to reproduce the problem? Email: me@nathanfranklin.com.au Thanks.

Hello Nathan, good works !

I’am trying to create 3 list with 3 differents category (4,19,20).

I understand i need to use add filter with gfpl_post_args but i dont understand how to use my fuction on a specific list and not on those 3.

Thanks for your help

Got any exemple of code i can modify? can’t make it works actually.

Thanks for your time

any news ?

Hi there. Sorry for the delay.

Try something like this:

add_filter("gfpl_post_args", "theme_pl_args", 10, 5); function theme_pl_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { if($field["id"] == "21") { // 21 is an example of a field id currently in the form. $args["category__in"] = array(22, 21, 34); // example term_id's for categories. } return $args; }

Hello,

I’ve sent you an email concerning an issue I’m having with your plugin and have not get any response yet… are you still supporting this product?

Best regards!

Have you had the time to check this?

Hi rubencio

Try this in your functions.php file:

add_filter("gform_merge_tag_filter", "theme_change_merge_tag_filter", 20, 5); function theme_change_merge_tag_filter($value, $merge_tag, $options, $field, $lead) { if(($merge_tag == "all_fields" || $merge_tag == "[id of field]") && $field["type"] == "post_listing") { // old code stores id in [[]] $pattern = '/\[\[(\d+)\]\]/i'; $matches = array(); $res = preg_match_all($pattern, $value, $matches); if($res && count($matches) >= 2 && is_array($matches[1]) && count($matches[1]) > 0) { $id = $matches[1][0]; //$value .= " " . get_permalink($id); $value .= ' <a href="' . get_permalink($id) . '">View</a>'; } } return $value; }

This is going outside of the plugins support, so I won’t be able to offer support for this. In saying that though, this should work ok.

is the plugin still supported?

apology, but where do i use this code? and will it let to search product by _SKU?

Ok so i just figure that i can use the
Enter meta key to use as ‘text’ in the dropdown.
_sku

can i use multiple values there? something like:
_post_id | _sku | _title ?

example of desire result :
https://docs.woothemes.com/wp-content/uploads/2014/09/Instant-Search-Form.png?resize=413%2C255

Hi. Obviously late to the party on this :s You can’t use multiple values. You would need to use the custom code sample above to get this working.

Hi, I’ve installed the plugin but the new field doesn’t appear on the right hand side under the Advanced tab.

Hey could you please private message me your email. I have a new version that I would like you to try. Thanks.

Hi

I want to show a list of custom posts but only where the author of the post is the same user who is filling out the gravity form. How would I do this?

i try this code but he doen’t work!

add_filter(“gfpl_post_args”, “theme_pl_args”, 10, 5); function theme_pl_args($args, $post_type, $meta_key, $group_by_taxonomy, $field) { if(strpos($field[“cssClass”], “css-page-camp”) !== false) { $args[“author”] = get_current_user_id(); } return $args; }

thanks

It looks like it should work?

by
by
by
by
by
by