Remove Query Strings From Static Resources

You can also remove query strings from your assets with code. Simply add the following to your WordPress theme’s functions.php file.

function _remove_script_version( $src ){ 
$parts = explode( '?', $src ); 	
return $parts[0]; 
} 
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); 
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );


Advertisements

add new tab to my account in woocommerce

i wanted to add wishlist tab to the account page in woocommerce in the the theme enfold  i was using the yith plugin yith-woocommerce-wishlist  so i need to show the title with link to the content that will show the shortcode here what i did

first add to function.php in the child theme this code


/*
* add option to edit elements via css class
*/
// add_theme_support('avia_template_builder_custom_css');

/**
* Insert the new endpoint into the My Account menu.
*
* @param array $items
* @return array
*/
function my_custom_my_account_menu_items( $items ) {
// Remove the logout menu item.
$logout = $items['customer-logout'];
unset( $items['customer-logout'] );

// Insert your custom endpoint.
$items['my-custom-endpoint'] = __( 'המעודפים שלי', 'woocommerce' );

// Insert back the logout item.
$items['customer-logout'] = $logout;

return $items;
}

add_filter( 'woocommerce_account_menu_items', 'my_custom_my_account_menu_items' );

/**
* Register new endpoint to use inside My Account page.
*
* @see https://developer.wordpress.org/reference/functions/add_rewrite_endpoint/
*/
function my_custom_endpoints() {
add_rewrite_endpoint( 'my-custom-endpoint', EP_ROOT | EP_PAGES );
}

add_action( 'init', 'my_custom_endpoints' );

/**
* Add new query var.
*
* @param array $vars
* @return array
*/
function my_custom_query_vars( $vars ) {
$vars[] = 'my-custom-endpoint';

return $vars;
}

add_filter( 'query_vars', 'my_custom_query_vars', 0 );

/**
* Endpoint HTML content.
*/
function my_custom_endpoint_content() {
echo do_shortcode('[yith_wcwl_wishlist]');
}

add_action( 'woocommerce_account_my-custom-endpoint_endpoint', 'my_custom_endpoint_content' );

 

so with the function my_custom_endpoint_content i can display what i want in the my account tab content and i did used the shortcode that comes with the plugin