Fields not displaying
-
I created a form with custom fields, the fields appear in the frontend form once I fill the fields and submit the form, I can see the custom fields in the back, but when I hit preview or publish, the custom fields does not appear.
-
When you write “associated with a tag” do you refer to associate the pods created “custom post type” with the “built in taxonomies” —> Tags(post_tag) and select the “custom taxonomy” I created. Because I already did that, I rule out a theme conflict since I am using one of the default wordpress themes, my active plugins are caldera, caldera custom fields, metaplate and pods. And it does work with the post but not with my custom post type, I used the exact same form in both,and the “post” works with and without the code:
-
{{#each taxonomy.post_tag}}
- {{name}}
{{/each}}
-
But the custom post type just don’t show the taxonomy.
Have you confirmed that the post, in your custom post type, that you are trying to display the tags for has tags associated with it? Not the Pod, the actual post. Have you checked in the back-end editor for the particular post you are testing with, to see that they are shown in the tag meta box?
I check in the backend editor, it did have the taxonomy I selected associated (in the custom fields metabox {that field is an autopopulated taxonomy field from a taxonomy called “example”}) (there is an additional metabox( the one that pods adds of the “built in taxonomies”) my built in taxonomy is the taxonomy “example”( I would think that being the same taxonomy the result that shows in the metabox will also appear in the built in taxonomy metabox ) but it didn’t.
So I add it manually in the backend,after I did that in the frontend it shows an “array” instead of the name of the taxonomy I selected.Note that when creating a post, in the default “post” the taxonomy appears automatically in the frontend even without having to manually add tags in the backend, and I dont get an “array”, I get the value selected from the autopopulate.
So two totally different issues:
1) The taxonomy terms are not being saved as associated with the post. Makes sense — it’s not a feature of Caldera Custom Fields yet. I would use the Run Action processor to grab the value for that field and pass them towp_set_object_terms()
2) Why is it displaying as a “array”, not the term? That’s because you’re trying to print an array as a string. If you have an array, use an each loop to get the individual components of the array.
1) Ok I get it is not saving them as associated with the post,but why they are working perfect with the default wordpress post if I also try it with the same caldera form?
That’s why I even dare to think it was perhaps something with the “custom post type” created with pods, since caldera work fine in the “post”.
Anyway I will try the run action ( I am reading the tutorial) Will update once am done.2)I did use the each loop:
-
{{#each taxonomy.post_tag}}
- {{name}}
{{/each}}
Ok I am confused.
I add a run action processor,I did the following:
position—> process
type—–> action
action/filter—–>wp_set_object_terms()But nothing happens, I tried also with pre process and post process.
Mu head hurts. Looks like you’re doing a nice complex integration.
if you are still working on this, could you write up a brief on what you are wanting to achieve? We could then help sort determine where its going wrong.
Josh and David,(better late than never) thanks a million for all the effort you put in this plugin, which is truly great and its full of options and possibilities, thanks for the patience and help :), I think caldera forms has the potential to become (and it will eventually)some of those 1 million+ downloaded plugins, due to its flexibility and features.
David what I am trying to do is a form that will be used to create a post type, one of the field is a taxonomy field, So I want that when I submit the post, the post is tagged with the selected taxonomy.
What I did is:
<?php
add_action( ‘caldera_forms_submit_complete’, ‘slug_process_form’, 55 );
function slug_process_form( $form ) {//put form field data into an array $data
$data= array();
foreach( $form[ ‘fields’ ] as $field_id => $field){
$data[ $field[‘slug’] ] = Caldera_Forms::get_field_data( $field_id, $form );
}//get embedded post ID.
$embeded_post_id = absint( $_POST[ ‘_cf_cr_pst’ ] );/** DO SOMETHING WITH $data here **/
}
Then, position—> process
type—–> action
action/filter—–>wp_set_object_terms()also try adding callback function wp_set_object_terms
and setting as varibales the field with the taxonomy, I test changing the behavior with “entry list,static and passback” but none work to register or tagged my “taxonomy”.So with that code snippet you now have two things:
1) The post ID.
2) An array of data from the submission.Let’s assume you have field whose slug is “lightsaber_type” that has, as its value, a term of a taxonomy of the same name.
All you need to do, is, replace my note
/** DO SOMETHING WITH $data here **/
withwp_set_object_terms( $embeded_post_id, $data[ 'lightsaber_type' ], 'lightsaber_type', true );
Ok so I follow:
<?php
add_action( ‘caldera_forms_submit_complete’, ‘slug_process_form’, 55 );
function slug_process_form( $form ) {//put form field data into an array $data
$data= array();
foreach( $form[ ‘fields’ ] as $field_id => $field){
$data[ $field[‘slug’] ] = Caldera_Forms::get_field_data( $field_id, $form );
}//get embedded post ID.
$embeded_post_id = absint( $_POST[ ‘_cf_cr_pst’ ] );wp_set_object_terms( $embeded_post_id, $data[ ‘example’ ], ‘example’, true );
}
But still the taxonomy is not registering. Do I also have to sustitute the post id’_cf_cr_pst’?
@zenbirdy did you figure out how to get the post id?
- The topic ‘Fields not displaying’ is closed to new replies.