wpcargo_track_result_form
“wpcargo_track_result_form” action hook is use to change the whole track result form template.
Copy and paste this sample code to change the track result template to the theme functions.php file.
// In this sample code the shipment information and the shipment history is removed. add_action( 'wp', function(){ global $wpcargo_track_form; function my_custom_wpcargo_track_result_form( ){ // Get form submitted shipment number $shipment_number = wpcargo_can_track_shipment( ); // Check if the submitted shipment number found on the database $shipment_id = wpcargo_trackform_shipment_number( $shipment_number ); ?> <div id="wpcargo-result-wrapper"> <div class="wpcargo-result wpcargo" id="wpcargo-result"> <?php if ( !empty( $shipment_id ) ) : $shipment = new stdClass; $shipment->ID = (int)esc_html( $shipment_id ); $shipment->post_title = esc_html( get_the_title( $shipment_id ) ); ?> <div id="wpcargo-result-print" class="wpcargo-wrap-details wpcargo-container"> <?php do_action('wpcargo_before_track_details', $shipment ); do_action('wpcargo_track_header_details', $shipment ); do_action('wpcargo_track_after_header_details', $shipment ); do_action('wpcargo_track_shipper_details', $shipment ); do_action('wpcargo_after_package_details', $shipment ); ?> </div> <?php else: ?> <h3 style="color: red !important; text-align:center;margin-bottom:0;padding:12px;">No results found!</h3> <?php endif; ?> </div> </div> <?php } // Remove the default form template remove_action( 'wpcargo_track_result_form', array( $wpcargo_track_form, 'wpcargo_trackform_result_template' ), 10 ); // Add new hook for the new form template add_action( 'wpcargo_track_result_form', 'my_custom_wpcargo_track_result_form' ); }, 25 );
Screenshot: