Skip to content

Instantly share code, notes, and snippets.

View echodev3's full-sized avatar

JP echodev3

  • Echo Web Solution
  • Remote
View GitHub Profile
@echodev3
echodev3 / shortcode.php
Created March 12, 2024 08:21
Shortcode that captures another shortcode's output and save / serve it from a static file
add_shortcode( "echo_static_html_cache", "echo_static_html_cache_callback");
function echo_static_html_cache_callback( $atts ) {
$cache_dir = get_template_directory() . '/static-cache/';
if ( ! is_dir( $cache_dir ) ) {
mkdir( $cache_dir );
}
$(".removeDeveloper").on( 'click', function() {
var usertodelete = $(this).data('usertodelete');
var email = $(this).data('email');
var displayName = $(this).data('userdisplayname');
var nonce = $(this).data('nonce');
// let emailConfirm = prompt(`Are you sure you want to remove ${displayName}?
// This function is to be used only when a developer has left your organisation. It will deactivate ALL their current activations and will mark their email address as deleted so that email will NOT be able to activate again. DO NOT use this to remove a single activation. Contact support@scichart.com instead. If you are sure you want to permanently remove this user, enter their email address to confirm`, "");
var modal_input_email = $(this).closest( 'input' ).val();
@echodev3
echodev3 / gist:63c21f1937578517a25b97737b64d880
Created August 8, 2024 07:50
Disable Dates for Datepicker
function getDatesFromRange($start, $end, $format = 'Y-m-d'){
// Declare an empty array
$array = array();
// Variable that store the date interval
// of period 1 day
$interval = new DateInterval('P1D');
$realEnd = new DateTime($end);
$realEnd->add($interval);
$period = new DatePeriod(new DateTime($start), $interval, $realEnd);
<script>
jQuery(function(){
$el = $( '#mk-text-block-544' );
$el.find( 'img' ).attr( 'src', '{abhi, please replace this with the correct image url}' )
$el.find( 'a' ).attr( 'hred', '{abhi, please replace this with the correct url}' )
})
</script>
location ~* ^/(demo|react)$ {
proxy_pass https://phpstack-931910-5120025.cloudwaysapps.com; # Forward to the target URL
proxy_set_header Host "phpstack-931910-5120025.cloudwaysapps.com"; # Pass the original host header
proxy_set_header X-Real-IP $remote_addr; # Pass the real IP of the client
proxy_set_header X-Forwarded-For $remote_addr; # Forward the client IP through proxies
proxy_set_header X-Forwarded-Proto $scheme; # Pass the protocol (http or https)
proxy_ssl_verify off; # Disable SSL verification (for self-signed certs)
}
location ~* ^/(bundle.js|images|style.css) {
function jfs_product_pre_get_posts( $query ) {
if ( $query->is_main_query() ) {
if ( in_array ( $query->get('post_type'), array('slug_nung_prdoucts') ) ) {
$query->set( 'posts_per_page', 50 );
}
}
}
add_action( 'pre_get_posts', 'jfs_product_pre_get_posts' );
add_action('woocommerce_thankyou', 'bofi_push_purchase_data_to_datalayer');
function bofi_push_purchase_data_to_datalayer($order_id) {
$order = wc_get_order($order_id);
if ( !$order ) return;
$items = [];
foreach ($order->get_items() as $item) {
stdClass Object
(
[standard] => stdClass Object
(
[items] => Array
(
[0] => stdClass Object
(
[id] => 119931
[label] => 12V Power Socket in Boot