This file contains hidden or 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 (!defined('ABSPATH')) exit; | |
function checkbox($data=array()) { | |
$instance = '_'.uniqid(); | |
$text = $data['text'] ?? ''; | |
$checked = $data['checked'] ?? ''; | |
$name = $data['name'] ?? ''; | |
$class = $data['class'] ?? ''; | |
ob_start('ob_gzhandler'); | |
?> |
This file contains hidden or 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
find . -type f -exec sed -i 's/search/replace/g' {} + |
This file contains hidden or 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="interactive"> | |
<div class="toggle"> | |
<p class="waves-effect">CLICK ME</p> | |
</div> | |
<div class="hideable"> | |
<p>I wrap the content. Lorem what?</p> | |
</div> | |
</div> | |
<style type="text/css"> |
This file contains hidden or 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
<pre> | |
<?php | |
$path = realpath(__DIR__); | |
echo "<p>Zipping...</p>"; | |
$zip = new ZipArchive(); | |
$zip->open(dirname(__FILE__).'.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); | |
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); | |
foreach ($files as $name => $file) { | |
if ($file->isDir()) { | |
echo $name . "\r\n"; |
This file contains hidden or 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
function distance(lat1, lon1, lat2, lon2) { | |
var p = 0.017453292519943295; // Math.PI / 180 | |
var c = Math.cos; | |
var a = 0.5 - c((lat2 - lat1) * p)/2 + | |
c(lat1 * p) * c(lat2 * p) * | |
(1 - c((lon2 - lon1) * p))/2; | |
return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km | |
} |
This file contains hidden or 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 distance($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo) { | |
$rad = M_PI / 180; | |
$theta = $longitudeFrom - $longitudeTo; | |
$dist = sin($latitudeFrom * $rad) * sin($latitudeTo * $rad) + cos($latitudeFrom * $rad) * cos($latitudeTo * $rad) * cos($theta * $rad); | |
return acos($dist) / $rad * 60 * 1.852; | |
} |
This file contains hidden or 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 | |
// column post image | |
function add_thumb_column($cols) { | |
$cols['thumbnail'] = 'Image'; | |
return $cols; | |
} | |
function add_thumb_value($column_name, $post_id) { | |
$width = (int) 120; |
This file contains hidden or 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 ajax_get_template_part() { | |
check_ajax_referer('ajax_get_template_part','nonce'); | |
$part = esc_attr($_POST['template_part']); | |
if (!$part) {return;} | |
get_template_part($part); | |
die(); | |
} | |
add_action( 'wp_ajax_nopriv_ajax_get_template_part', 'ajax_get_template_part' ); |
This file contains hidden or 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('post_gallery','bp_custom_gallery_html',10,2); | |
function bp_custom_gallery_html($string,$attr){ | |
$uniqid = uniqid(); | |
$output = '<div class="bp_gallery_'.$uniqid.'">'; | |
$attachments = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment')); | |
foreach($attachments as $key => $value){ | |
$output .= '<img src="'.wp_get_attachment_image_src($value->ID, 'large')[0].'" alt="Bottega Progetti Gallery Image"/>'; | |
} |
This file contains hidden or 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
.waves-effect { | |
position: relative; | |
overflow: hidden; | |
display: inline-block; | |
} | |
.ripple { | |
width: 0; | |
height: 0; | |
border-radius: 50%; | |
background: rgba(255, 255, 255, 0.4); |
NewerOlder