How to Customize Template of Label
Customize Label Template
- Create “wpcargo/wpcargo-frontend-manager” directory in your theme directory. (e.g. child-theme/wpcargo/wpcargo-frontend-manager).
- Create a new file and name it “label.tpl.php” for single print label template and “label-packages.tpl.php” for the Enable label multi print setting. Note: This will return an empty template.
- If you just need a little changes in your template, you can copy below code and update desired section
label.php template default layout
<?php do_action( 'wpcfe_before_label_content', $shipmentDetails, null, null, null ); ?> <table style="width:100%;"> <?php do_action( 'wpcfe_start_label_section', $shipmentDetails, null, null, null ); ?> <tr> <td style="width:50% !important; vertical-align: middle !important; text-align: center !important;"> <?php do_action( 'wpcfe_label_site_info', $shipmentDetails, null, null, null ); ?> </td> <td style="width:50% !important; padding-right:18px;"> <?php do_action( 'wpcfe_label_from_info', $shipmentDetails, null, null, null ); ?> </td> </tr> <?php do_action( 'wpcfe_middle_label_section', $shipmentDetails, null, null, null ); ?> <tr> <td colspan="2" style="padding-left:28px;"> <?php do_action( 'wpcfe_label_to_info', $shipmentDetails, null, null, null ); ?> </td> </tr> <?php do_action( 'wpcfe_end_label_section', $shipmentDetails, null, null, null ); ?> </table> <?php do_action( 'wpcfe_after_label_content', $shipmentDetails, null, null, null ); ?>
label-packages.php template default layout
<?php $_totalCount = count( $packages ); ?> <?php $_counter = 1; ?> <?php foreach ($packages as $package ): ?> <?php do_action( 'wpcfe_before_label_content', $shipmentDetails, $packages, $package, $_counter ); ?> <table style="width:100%;"> <?php do_action( 'wpcfe_start_label_section', $shipmentDetails, $packages, $package, $_counter ); ?> <tr> <td style="width:50% !important; vertical-align: middle !important; text-align: center !important;"> <?php do_action( 'wpcfe_label_site_info', $shipmentDetails, $packages, $package, $_counter ); ?> </td> <td style="width:50% !important; padding-right:18px;"> <?php do_action( 'wpcfe_label_from_info', $shipmentDetails, $packages, $package, $_counter ); ?> </td> </tr> <?php do_action( 'wpcfe_middle_label_section', $shipmentDetails, $packages, $package, $_counter ); ?> <tr> <td colspan="2" style="padding-left:28px;"> <?php do_action( 'wpcfe_label_to_info', $shipmentDetails, $packages, $package, $_counter ); ?> </td> </tr> <?php do_action( 'wpcfe_end_label_section', $shipmentDetails, $packages, $package, $_counter ); ?> </table> <?php do_action( 'wpcfe_after_label_content', $shipmentDetails, $packages, $package, $_counter ); ?> <?php if( $_totalCount == $_counter ){ continue; } ?> <div class="page_break"></div> <?php $_counter++; ?> <?php endforeach; ?>