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!
WordPress/PHP Developer Chennai
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!
For our customization want to remove woocommerce pagination programmatically then place the following snippet in functions.php within your theme folder!.
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
Have any doubt, then comment here!
For our customization want to remove woocommerce ratings programmatically in WordPress then place the following snippet in functions.php within your theme folder!.
The remove_action can be used for removing the woocommerce ratings from woocommerce page.
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
Have any doubt, then comment here!
For our customization want to remove woocommerce related products programmatically then place the following snippet in functions.php within your theme folder!.
The remove_action can be used for removing the related products from woocommerce page.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products',20); remove_action( 'woocommerce_after_single_product', 'woocommerce_output_related_products',10);
Have any doubt, then comment here!
For our customization want to check post type and remove media buttons in wp-admin then place the following snippet in functions.php within your theme folder!. add your custom post type slug instead of custom-post-type.
add_action('admin_head', 'check_post_type_and_remove_media_buttons'); function check_post_type_and_remove_media_buttons() { global $post; if($post->post_type == 'custom-post-type') { remove_action( 'media_buttons', 'media_buttons' ); } }
Have any doubt, then comment here!