• Hi, I was wondering how to remove “description” field from the submission form? Or make it optional instead of required. Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    i would recommend making the field optional instead of removing it since the description is saved to the default wp_posts.post_content field.

    To make it optional you can either use the Custom Fields extension or add the code below in your theme functions.php file (or even better by creating a blank plugin https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/ and pasting it there).

    
    add_filter( "adverts_form_load", "customize_adverts_add_ppn" );
    function customize_adverts_add_ppn( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "post_content" ) {
            $form["field"][$key]["validator"] = array();
        }
      }
      return $form;
    }
    
    Thread Starter multidimentional

    (@multidimentional)

    This is great, thank you.

    One more quick question. Not sure if I am suposed to start a new topic, but the thing is that after adding custom checkbox field with

    “max_choices” => 1,

    user can still select more than one checkbox.
    Same goes for categories.

    Is there any way to disable multiple choice option?

    Thank you in advance.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    if you would like the users to select one option only then you should use the Radio input instead of the Checkbox.

    As for the Categories (dropdown) if you set the max_choices to 1 then it should convert the dropdown to a single select dropdown, if that is not the case on your site then there might be some misconfiguration, can you let me know how you are changing the max_choices, do you have some code snippet for that?

    BTW. Note that the choices are validated on submission meaning that if you allow the user to select max one checkobx then in the form he can check as many as he wants but when he will submit the form he should see an error message informing him that he selected too many options.

    Thread Starter multidimentional

    (@multidimentional)

    Thank you for your reply.

    As for categories, this is the default field in the submission form. When I add max_coinces=”1″ to the shortcode, nothing happends.
    But I guess it is not how it works.

    As for the extra submission form fields, I simply added custom fields as per documentation https://wpadverts.com/doc/custom-fields/ and I set max_choice to 1 everywhere.

    Radio button works like a charm. Thank you.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. note that the shortcode does not support max_choices param, this can be used only in the PHP code.

    2. can you share the code you created? If the max_choices param does not have any effect then most likely there is some kind of typo.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove description field’ is closed to new replies.