How To Customize Label Template – Updated

On the update version on Frontend Manager, the label template is already composed with the following hooks:
1. “wpcfe_before_label_content” – contains the styles of the label template

How it is called:

function wpcfe_before_label_content_callback(){
    ?>
    <style>
        table{ border-collapse: collapse; }
        table td{ vertical-align:top; border:1px solid #000; padding: 8px; }
        table td *{ margin:0; padding:0; }
        img#log{ width:50% !important; }
    </style>
    <?php
}
add_action( ‘wpcfe_before_label_content’, ‘wpcfe_before_label_content_callback’, 10, 1 );

2. “wpcfe_label_site_info” – contains the site information of the label template

How it is called:

function wpcfe_label_site_info_callback( $shipmentDetails ){
    ?>
    <section style=”text-align:center”><?php echo $shipmentDetails[‘siteInfo’]; ?></section>
    <?php
}
add_action( ‘wpcfe_label_site_info’, ‘wpcfe_label_site_info_callback’, 10, 1 );

3. “wpcfe_label_from_info” – contains the shipper information of the label template

How it is called:

function wpcfe_label_from_info_callback( $shipmentDetails ){
    global $WPCCF_Fields, $wpcargo;
    ?>
    <h1 style=”margin-bottom:18px;”><?php esc_html_e(‘From:’, ‘wpcargo-frontend-manager’); ?></h1>
    <?php
    echo wpcfe_print_data( ‘shipper_info’, $shipmentDetails[‘shipmentID’]);

}

add_action( ‘wpcfe_label_from_info’, ‘wpcfe_label_from_info_callback’, 10, 1 );

4. “wpcfe_label_to_info” – contains the receiver information of the label template

How it is called:

function wpcfe_label_to_info_callback( $shipmentDetails ){
    global $WPCCF_Fields, $wpcargo;
    ?>
    <h1 style=”margin-bottom:18px;”><?php esc_html_e(‘To:’, ‘wpcargo-frontend-manager’); ?></h1>
    <section id=”section-to”><?php echo wpcfe_print_data( ‘receiver_info’, $shipmentDetails[‘shipmentID’]); ?></section>
    <?php

}

add_action( ‘wpcfe_label_to_info’, ‘wpcfe_label_to_info_callback’, 10, 1 );

5. “wpcfe_end_label_section” – contains the barcode and other shipment information

How it is called:

function wpcfe_end_label_section_callback( $shipmentDetails  ){
    global $wpcargo;
    ?>
    <tr>
        <td colspan=”2″ class=”barcode” style=”text-align:center;padding-top:18px;”>
            <img id=”frontend-label-barcode” class=”label-barcode” style=”margin-top:12px;” src=”<?php echo $wpcargo->barcode_url( $shipmentDetails[‘shipmentID’] ); ?>”>
            <p style=”font-size:24px;padding:0;margin:0;”><?php echo get_the_title( $shipmentDetails[‘shipmentID’]); ?><p>
        </td>
    </tr>
    <?php
}
add_action( ‘wpcfe_end_label_section’, ‘wpcfe_end_label_section_callback’, 100, 1 );
0
    0
    Your Cart
    Your cart is emptyReturn to Shop