Skip to content

Instantly share code, notes, and snippets.

View Niloys7's full-sized avatar
🏠
Working from home

Niloy Niloys7

🏠
Working from home
View GitHub Profile
@Niloys7
Niloys7 / functions.php
Created August 6, 2023 14:39
Order status manager email template Customize by 3rd party plugin
/**
* https://brightplugins.com/docs/how-to-edit-or-override-the-email-templates-for-custom-order-status/
*/
add_filter( 'viwec_accept_email_type', function ($email_types) {
$email_types[] = 'bvos_custom_pickup-point'; // replace it
return $email_types;
}, 9999 );
function register_email_type( $emails ) {
@Niloys7
Niloys7 / order_email_template.php
Created February 13, 2023 12:05
Add Content in custom status email template
/**
* How to edit or override the email templates for custom order status?
* @link https://brightplugins.com/docs/how-to-edit-or-override-the-email-templates-for-custom-order-status/
*/
add_action( 'woocommerce_email_before_order_table', 'brightplugins_add_content_specific_email', 20, 4 );
function brightplugins_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == 'bvos_custom_transit' ) {
echo '<p>Content for Transit Status</p>';
@Niloys7
Niloys7 / change_order_status_on_preorder_date.php
Created July 12, 2022 00:13 — forked from niloyBrightVessel/change_order_status_on_preorder_date.php
Change Preorder status after preoder date arrived
add_filter('change_order_status_on_preorder_date','bp_change_order_status',20,1);
function bp_change_order_status($status){
return 'processing';
}
@Niloys7
Niloys7 / hide_x_button.php
Created February 10, 2022 21:16
Hide Remove Button [x] from Specific product from WooCommerce Cart
add_filter( 'woocommerce_cart_item_remove_link', 'ns_cart_item_remove_link', 20, 2 );
/**
* @snippet Hide Remove Button [x] from Specific product from WooCommerce Cart
* @author Niloy , iamniloy.com
* @param $button_link
* @param $cart_item_key
* @return mixed
*/
function ns_cart_item_remove_link( $button_link, $cart_item_key ) {
//SET HERE your specific products IDs
@Niloys7
Niloys7 / preorder_avaiable_date_text.php
Last active January 3, 2023 16:56
Filter for preorder available date text on single product page
add_filter('preorder_avaiable_date_text',function($text , $id){
$custom_date_format = date( 'D M d, Y', strtotime( get_post_meta($id, '_pre_order_date', true)) );
return '<span class="preorder-avaiable-date-text">Available on '.$custom_date_format.'</span>';
},10,2);
@Niloys7
Niloys7 / functions.php
Created August 9, 2021 20:04
Update preorder date programmatically for Variable products
add_action('wp_head','bp_preorder_script');
function bp_preorder_script() {
$args = array(
'post_type' => 'product_variation',
'posts_per_page' => -1,
);
$query = new WP_Query( $args );
@Niloys7
Niloys7 / dcpt.php
Created April 17, 2021 12:44
//Delete all posts of a custom post type with its included post meta data and taxonomies by using wpdb
function deletePostType($postType = ''){
global $wpdb;
$result = $wpdb->query(
$wpdb->prepare("
DELETE posts,pt,pm
FROM {$wpdb->prefix}posts posts
LEFT JOIN {$wpdb->prefix}term_relationships pt ON pt.object_id = posts.ID
LEFT JOIN {$wpdb->prefix}postmeta pm ON pm.post_id = posts.ID
WHERE posts.post_type = %s
@Niloys7
Niloys7 / porto-theme-quickview.php
Last active December 29, 2020 11:19
Since Porto theme has there owned gallery markup that reason the quick view feature is not working properly with the "product gallery slider" . so we need to override the ajax function only for the quick view mode.to do this just copy the code from below and paste it into your child-theme/functions.php or create a custom plugin to add this code.
<?php
add_action( 'init', 'cix_new_hooks');
function cix_new_hooks(){
remove_action( 'wp_ajax_porto_product_quickview', 'porto_product_quickview' );
remove_action( 'wp_ajax_nopriv_porto_product_quickview', 'porto_product_quickview' );
add_action( 'wp_ajax_porto_product_quickview', 'cix_porto_product_quickview' );
add_action( 'wp_ajax_nopriv_porto_product_quickview', 'cix_porto_product_quickview' );
}
{
"plugins": [
"query-monitor",
"regenerate-thumbnails",
{
"slug": "envato-theme-check",
"source": "https://github.com/envato/envato-theme-check/archive/master.zip"
}
<?php
/*
http://manual.unyson.io/en/latest/options/introduction.html#content
*/
$options = array(
'tab_1' => array(
'title' => esc_html__('Logo Options', 'academic'),
'type' => 'tab',
'options' => array(
'heading' => array(