Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
901 B
1
Indexable
Never
function b2bking_add_quick_csv_endpoint() {
    add_rewrite_endpoint( 'quickcsv', EP_ROOT | EP_PAGES );
}
  
add_action( 'init', 'b2bking_add_quick_csv_endpoint' );
  

  
function b2bking_quick_csv_query_vars( $vars ) {
    $vars[] = 'quickcsv';
    return $vars;
}
  
add_filter( 'query_vars', 'b2bking_quick_csv_query_vars', 0 );
  
function b2bking_add_quick_csv_link_my_account( $items ) {

	$i = 3;

	$items = array_slice($items, 0, $i, true) +
	    array('quickcsv' => esc_html__( 'CSV Orders', 'b2bking' )) + 
	    array_slice($items, $i, count($items)-$i, true);

    return $items;
}
  
add_filter( 'woocommerce_account_menu_items', 'b2bking_add_quick_csv_link_my_account' );
    
function b2bking_quick_csv_content() {
   echo '<h3>Quick CSV Order</h3>';
   echo do_shortcode( '[b2bking_csvorder]' );
}
  
add_action( 'woocommerce_account_quickcsv_endpoint', 'b2bking_quick_csv_content' );