Forum Replies Created
-
AuthorPosts
-
SteveKeymasterIt looks like you copied the
address_groupfield directly from the demos. It has a function called “piklist_demo_get_states()” in it, that you didn’t copy over. You can either remove that entire field, or replacepiklist_demo_get_states()with an array of choices like:,'choices' => array( 'nj' => 'NJ', 'nj' => 'NY' )
SteveKeymasterI tested this field and it works for me. Please enable wp_debug so WordPress can log the error message: https://wordpress.org/support/article/debugging-in-wordpress/
SteveKeymaster@guit4eva– Since Piklist is file driven, and not database driven, you can’t really get the values by default. However, we’ve run into this in the past as well for our clients, and here are two solutions:
1) Name the keys the values you want to display:
piklist('field', array( 'type' => 'select', 'field' => 'establishment_no_bedrooms', 'label' => 'Number of Bedrooms', 'choices' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7+' => '7+', ), ));Obviously, that’s the easiest.
2. List your choices in a separate function.
One of the things that makes Piklist so great, is that you can use functions to generate field options and reuse them. In another file (not your Piklist parts file), like functions.php do something like:
function establishment_no_bedrooms_list($choice = null) { $choices = array ( '1_bedroom' => '1', '2_bedroom' => '2', '3_bedroom' => '3', '4_bedroom' => '4', '5_bedroom' => '5', '6_bedroom' => '6', '7_bedroom' => '7+', ); If ($choice === null { return $choices; } else { return $choices[$choice]; }That function says, if you don’t pass a choice return the choices. If you do pass a choice, return the value.
Then in your Piklist parts file reference the function.
piklist('field', array( 'type' => 'select', 'field' => 'establishment_no_bedrooms', 'label' => 'Number of Bedrooms', 'choices' => establishment_no_bedrooms_list() ), ));and in your theme:
echo establishment_no_bedrooms_list( get_post_meta($post->ID, 'establishment_no_bedrooms', true ) );IMPORTANT: This is untested and may require some tweaking.
September 8, 2020 at 11:56 am in reply to: use frontend form with custom field created manually or through other plugin #10874
SteveKeymasterAbsolutely! When creating fields with Piklist, make sure name the
fieldthe same name as the custom field in your database. Piklist will recognize it.
SteveKeymasterThank you for using it!
SteveKeymaster@rafi– We’re still working on Piklist v2.0, which will be as revolutionary as Piklist 1.0 was, and will address issues like this.
SteveKeymaster@rafi– We’re still working on Piklist v2.0, which will be as revolutionary as Piklist 1.0 was, and will address issues like this.
SteveKeymasterThanks. We’re working on a fix.
SteveKeymaster@cobaltmg– I was able to reproduce the message. Unfortunately, this is not such an easy fix and probably won’t be available until Piklist 2.0 which we are currently working on.
SteveKeymasterThank you for bringing this to our attention. We just updated the animated logo, shortened the length and removed the loop. https://wordpress.org/plugins/piklist/
SteveKeymasterWhich version of WordPress are you running? I’m going to try and reproduce.
SteveKeymasterHave you tried removing some of these options and see if that fixes it?
,'tinymce' => array( 'extended_valid_elements' => 'span[!class],code[!class],a[!href|target=_blank],*[style=]' ,'invalid_styles' => 'display,color' ,'invalid_elements' => '*[style]' ,'block_formats' => 'Paragraph=p;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6' ,'paste_auto_cleanup_on_paste' => true ,'paste_remove_spans' => true ,'paste_remove_styles' => true ,'toolbar1' => 'bold italic underline bullist numlist link unlink cut copy paste undo redo' ,'toolbar2' => 'formatselect strikethrough indent outdent pastetext removeformat charmap searchreplace' )
SteveKeymasterPlease post all the code in your parts file. I’d like to see if I can reproduce.
-
AuthorPosts