For our customization want to get woocommerce checkout page url programmatically then place the following snippet!.
global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url();
Have any doubt, then comment here!
WordPress/PHP Developer Chennai
For our customization want to get woocommerce checkout page url programmatically then place the following snippet!.
global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url();
Have any doubt, then comment here!
For our customization want to get woocommerce payment page url programmatically then place the following snippet!. Here the $payment_page having your woocommerce payment page url.
$payment_page = get_permalink( woocommerce_get_page_id( 'pay' ) ); if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) { $payment_page = str_replace( 'http:', 'https:', $payment_page ); }
Have any doubt, then comment here!
For our customization want to get woocommerce logout page url programmatically then place the following snippet!. Here $logout_url having your woocommerce logout url.
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' ); if ( $myaccount_page_id ) { $logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) ); if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) $logout_url = str_replace( 'http:', 'https:', $logout_url ); }
Have any doubt, then comment here!
if you want to add the JS file only to a specified page by wp_enqueue, you can wrap it in an is_page() condition:
add_action( 'wp_enqueue_scripts', 'load_myjs' ); function load_myjs() { if( is_page('your-page') ){ wp_register_script('load_my_js',get_template_directory_uri().'/yourjsfilename.js', array('jquery'),'1.1',true); wp_enqueue_script('load_my_js'); } }
Have any doubt, then comment here!
For our customization want to get site URL by blog_id in WordPress then use the following code. Here $url returns the site URL of a of a particular blog in WordPress.
$url = get_site_url($blog_id); echo $url;
Have any doubt, then comment here!
For our customization want to get site URL in WordPress programmatically then use the following code. Here $url returns the site URL of a WordPress.
$url = site_url(); echo $url;
Have any doubt, then comment here!
For our customization want to parsing domain from URL in PHP then use the following code. Here $parse[‘host’] prints the domain name of a given URL in $url.
$url = 'http://www.boopathirajan.com/dhasjkdas/sadsdds/sdda/sdads.html'; $parse = parse_url($url); print $parse['host']; // prints 'boopathirajan.com'
Have any doubt, then comment here!
For our customization want to get post thumbnail URL in WordPress by post ID then use the following code.
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
Have any doubt, then comment here!
if you want to Convert 12 to 24 hour time and vice versa in PHP then use this code.
// 24-hour time to 12-hour time $time_in_12_hour_format = DATE("g:i a", STRTOTIME("13:30")); // 12-hour time to 24-hour time $time_in_24_hour_format = DATE("H:i", STRTOTIME("1:30 pm"));
Have any doubt, then comment here!
For our customization want to hide woocommerce shop page tittle programmatically in WordPress then place the following snippet in functions.php within your theme folder!.
[sourcecode language=”plain”]
add_action( ‘woocommerce_show_page_title’, ‘cw_woocommerce_show_page_title’, 10);
if( !function_exists(‘cw_woocommerce_show_page_title’) ) {
function cw_woocommerce_show_page_title() {
return false;
}
}
[/sourcecode]
Have any doubt, then comment here!