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

    (@gwin)

    Hi, you can set max allowed description length by adding following code to your theme functions.php

    add_filter( 'adverts_form_load', 'set_description_max_length' );
     function set_description_max_length( $form ) {
    
         if( $form['name'] != 'advert' ) {
             return $form;
         }
    
         foreach( $form["field"] as $k => $field ) {
             if( $field["name"] == "post_content" ) {
                 $field["validator"][] = array(
                     "name" => "string_length",
                     "params" => array(
                       "min" => 0,
                       "max" => 100
                     )
                 );
                $form["field"][$k] = $field;
             }
         }
    
         return $form;
     }

    just change 100 to max allowed number of characters.

    Thread Starter dynasty2014

    (@dynasty2014)

    Thanks very much, Greg!

    Plugin Author Greg Winiarski

    (@gwin)

    Sure, no problem :).

    BTW. If you are finding the plugin useful i would be thankful if you could write a short one or two sentence review here https://www.ads-software.com/support/view/plugin-reviews/wpadverts

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Character limit for adverts’ is closed to new replies.