my_custom_field
-
Regards Greg! By adding more than one custom field in the product description, the first 2 take the information from the third party. What is the cause of that?
In topic child function php add the following:
add_filter( "adverts_form_load", "my_adverts_form_load" ); function my_adverts_form_load( $form ) { if( $form["name"] != "advert" ) { return $form; } $form["field"][] = array( "name" => "my_custom_field", "type" => "adverts_field_text", "order" => 25, "label" => "A?o / Condición (nuevo o usado)", "is_required" => true, "validator" => array( array( "name" => "is_required" ), ) ); $form["field"][] = array( "name" => "my_custom_field", "type" => "adverts_field_text", "order" => 25, "label" => "Marca / Modelo / Versión", "is_required" => true, "validator" => array( array( "name" => "is_required" ), ) ); $form["field"][] = array( "name" => "my_custom_field", "type" => "adverts_field_text", "order" => 25, "label" => "Kilometraje / Transmisión", "is_required" => true, "validator" => array( array( "name" => "is_required" ), ) ); return $form; } add_action( "adverts_tpl_single_details", "my_adverts_tpl_single_details" ); function my_adverts_tpl_single_details( $post_id ) { $cf = get_post_meta( $post_id, "my_custom_field", true); ?> <?php if(! empty($cf) ): ?> <div class="adverts-grid-row"> <div class="adverts-grid-col adverts-col-30"> <span class="adverts-round-icon adverts-icon-wordpress"></span> <span class="adverts-row-title">A?o / Condición (nuevo o usado)</span> </div> <div class="adverts-grid-col adverts-col-65"> <?php esc_html_e( $cf ) ?> </div> </div> <?php endif; ?> <?php if(! empty($cf) ): ?> <div class="adverts-grid-row"> <div class="adverts-grid-col adverts-col-30"> <span class="adverts-round-icon adverts-icon-wordpress"></span> <span class="adverts-row-title">Marca / Modelo / Versión</span> </div> <div class="adverts-grid-col adverts-col-65"> <?php esc_html_e( $cf ) ?> </div> </div> <?php endif; ?> <?php if(! empty($cf) ): ?> <div class="adverts-grid-row"> <div class="adverts-grid-col adverts-col-30"> <span class="adverts-round-icon adverts-icon-wordpress"></span> <span class="adverts-row-title">Kilometraje / Transmisión</span> </div> <div class="adverts-grid-col adverts-col-65"> <?php esc_html_e( $cf ) ?> </div> </div> <?php endif; ?> <?php } <img src="https://kmeru.com/wp-content/uploads/2019/09/CAMPO-PERSONALIZADO-1024x335.png" alt="" />
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘my_custom_field’ is closed to new replies.