Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
1.3 kB
3
Indexable
Never
add_action('salesking_extend_menu', function(){
    ?>
    <li class="nk-menu-item">
        <a href="<?php echo esc_attr(get_page_link(apply_filters( 'wpml_object_id', get_option( 'salesking_agents_page_setting', 'disabled' ), 'post' , true))).'newpage1';?>" class="nk-menu-link">
            <span class="nk-menu-icon"><em class="icon ni ni-wallet-out"></em></span>
            <span class="nk-menu-text"><?php esc_html_e('New Page', 'salesking');?></span>
        </a>
    </li>
    <?php
}, 100);
add_action('salesking_extend_page', function($page){
    if ($page === 'newpage1'){
        ?>
        <div class="nk-content salesking_earnings_page">
            <div class="container-fluid">
                <div class="nk-content-inner">
                    <div class="nk-content-body">
                    	Total value:

                   		<?php
                   		require_once ( SALESKING_DIR . 'includes/class-salesking-helper.php' );
                   		$helper = new Salesking_Helper();
                    	$total_orders_value = $helper->get_total_orders_value_agent(get_current_user_id()); //1234 is the USER ID of the agent


                    	echo wc_price($total_orders_value);
                    	?>

                </div>
            </div>
        </div>
        <?php
    }
}, 10, 1);