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 | |
if( ! extension_loaded('zip') ) { | |
die('missing zip extension!'); | |
} | |
set_time_limit(0); | |
$file = 'wp.zip'; |
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
import http.server | |
import socketserver | |
import os | |
PORT = 786 | |
web_dir = os.path.join(os.path.dirname(__file__), '<DIR>') | |
os.chdir(web_dir) | |
Handler = http.server.SimpleHTTPRequestHandler |
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
git pull | |
TIMEOUT /T 30 /NOBREAK | |
git_pull.bat |
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="ci-select"> | |
<?php | |
wp_dropdown_categories( array( | |
'taxonomy' => 'property_location', | |
'hierarchical' => true, | |
'show_option_none' => esc_html_x( '-', 'any property location', 'ci_theme' ), | |
'option_none_value' => '', | |
'name' => 's_property_location', | |
'id' => 'property_location', | |
'selected' => isset( $_GET['s_property_location'] ) ? $_GET['s_property_location'] : '', // e.x 86,110,786 |
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 | |
// Don't disable on dev | |
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { | |
// Disable core update checking | |
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) ); | |
remove_action( 'admin_init', '_maybe_update_core' ); | |
remove_action( 'wp_version_check', 'wp_version_check' ); |
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 | |
function s2c( $str ) { | |
return substr( md5( $str . "snippets.ir" ), -6, 6 ); | |
} | |
$str = 'snippets.ir'; | |
print '<span style="background-color:#' . s2c($str) . '">' . $str . '</span>'; | |
$str = 'mahdiy.ir'; |
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 | |
function get_sorted_categories( $order_by = 'id', $args = array() ){ | |
global $wpdb; | |
$category = get_categories( $args ); | |
$order = [ | |
'id' => 'post.ID', | |
'date' => 'post.post_date', |
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_filter( 'woocommerce_package_rates', 'woocommerce_package_rates_remove_free', 1000 ); | |
function woocommerce_package_rates_remove_free( $rates ) { | |
// MahdiY.IR | |
foreach ( $rates as $rate_id => $rate ) | |
if ( 'free_shipping' === $rate->method_id | |
&& count( wc()->cart->get_applied_coupons() ) ) { |
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 | |
function reading_time( $content ) { | |
$words_per_minute = 200; | |
$word = count( explode(" ", strip_tags( $content ) ) ); | |
return ceil($word / $words_per_minute); | |
} |
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 | |
// Script start | |
$usage_start = getrusage(); | |
echo "PHP RAM Usage 1: " . convert(memory_get_usage()) . "\n"; | |
ob_start(); | |
// Start Code |
NewerOlder