Skip to content

Instantly share code, notes, and snippets.

View agronom81's full-sized avatar

Pavlo Petrenko agronom81

  • WebDesignSun
  • Ukraine, Mykolaiv
View GitHub Profile
@agronom81
agronom81 / create and load csv
Created January 24, 2019 07:31
create and load csv
/**
* load csv
*/
add_action("init", "download_csv");
function download_csv() {
if (isset($_POST['download_csv'])) {
function outputCsv( $fileName, $assocDataArray ) {
@agronom81
agronom81 / gist:7d071e9f0a6e7bfdc7c63f646d363513
Last active January 4, 2019 05:49
Briteverify with public API KEY
var mail = $('input[type=email]').val();
//username is public API Key
var url = "https://bpi.briteverify.com/emails.json?address="+mail+"&username=772454564564564564564563";
$.ajax({
url: url,
dataType: "jsonp",
success: function(data){
var status = data.status;
$('input[type=email]').addClass(status);
if(status === 'valid') {
window.history.replaceState({}, document.title, "?variant=" + variant.id);
@agronom81
agronom81 / Change the Add to Cart text
Last active July 5, 2018 11:18
Change the Add to Cart text in WooCommerce
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->get_type();
switch ( $product_type ) {
case 'external':
return __( 'Take me to their site!', 'woocommerce' );
break;
function mailTo ( $emails, $subject, $message ) {
$mail = new PHPMailer;
$mail->isSMTP();
$mail->isHTML(true);
$mail->setFrom( SITE_EMAIL, SITE_NAME );
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = SMTP_LOGIN;
$mail->Password = SMTP_PASS;
@agronom81
agronom81 / gist:b63d8077ed89e501c3f3
Last active January 27, 2016 10:00
get the_content with ID
// Setting the Post ID in a variable for which the content is required
$the_postid = 20;
$the_post_content = get_post($the_postid);
$content = $the_post_content->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
// Print Content data or further use it as required
echo $content;
@agronom81
agronom81 / gist:503841607193a2eda4ee
Created May 10, 2015 11:38
maximum z-index on the page
var highest_index = 0,
elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length - 1; i++) {
if (parseInt(elements[i].style.zIndex) > highest_index) {
highest_index = parseInt(elements[i].style.zIndex);
};
};
var zIndex = highest_index + 10;