This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if the user has purchased specific product IDs | |
function user_has_purchased_product($user_id, $product_ids) { | |
// Get all orders for the user | |
$customer_orders = wc_get_orders(array( | |
'customer_id' => $user_id, | |
'status' => array('completed', 'processing', 'on-hold') | |
)); | |
// Loop through orders and check if the product is purchased | |
foreach ($customer_orders as $order) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyframes delay { | |
0% { opacity: 0; } | |
100% { opacity: 1; } | |
} | |
/* Apply animation to the section */ | |
section { | |
opacity: 0; /* Initially hide the section */ | |
animation: delay 2s ease forwards; /* Apply animation with 2-second delay */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="slider"> | |
<div> | |
<div class="text"> | |
This is the worst kind of discrimination: the kind against me! You don't know how to do any of those. You are the last hope of the universe. Yes, except the Dave Matthews Band doesn't rock. | |
</div> | |
</div> | |
<div> | |
<div class="text"> | |
This is the worst kind of discrimination: the kind against me! You don't know how to do any of those. You are the last hope of the universe. Yes, except the Dave Matthews Band doesn't rock. | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventlistener(DOMcontentloaded,()=>{ | |
function currencyFormhandler(event){ | |
event.target.form.submit(); | |
} | |
document.querySelectorAll(.selecclass).forEach((elm)=>{ | |
elm.addEventlistener('change'.currencyFormhandler) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YAML is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. | |
version: '3.1' # Compose file versions | |
services: | |
#Database | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Demo Plugin | |
* Plugin URI: https://smalltowndev.com | |
* Description: A demo plugin to show how to WordPress. | |
* Author: kardi | |
* Version: 1.0.0 | |
* Author URI: https://kardi.com | |
* | |
* @package wordpress-reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_dashboard_setup', 'test_dashboard_widget' ); | |
/** | |
* Registers dashboard widget. | |
*/ | |
function test_dashboard_widget() { | |
wp_add_dashboard_widget( | |
'test_dashboard_widget', | |
esc_html( 'Test widget' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( | |
'user_has_cap', | |
function( $allcaps, $caps, $args, WP_User $user ) { | |
$current_user = wp_get_current_user(); | |
$requested_cap = $args[0]; | |
if ( $user->ID === $current_user->ID && in_array( 'customer', (array) $current_user->roles ) ) { | |
if ( 'upload_files' === $requested_cap ) { | |
return $allcaps; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (has_block("gallery", get_the_content())) | |
{ | |
$post_blocks = parse_blocks(get_the_content()); | |
foreach ($post_blocks as $post_block) | |
{ | |
if ("core/gallery" == $post_block["blockName"]) | |
{ | |
$ids = $post_block["attrs"]["ids"]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$valid_states = WC()->countries->get_states( $country ); | |
$for_country = isset( $args['country'] ) ? $args['country'] : WC()->checkout->get_value( 'billing_state' === $key ? 'billing_country' : 'shipping_country' ); | |
$states = WC()->countries->get_states( $for_country ); |
NewerOlder