Skip to content

Instantly share code, notes, and snippets.

View Keey's full-sized avatar
🍺

Yamaksum Keey

🍺
View GitHub Profile
// Custom JS
var catConfig = {
hideControlOnEnd: true,
adaptiveHeight: true,
infiniteLoop: false,
useCSS: false,
prevText: '',
nextText: '',
pager: false,
speed: 350
@moskalukigor
moskalukigor / functions.php
Last active September 14, 2017 08:36
Wordpress Ajax
<?php
/*IS NOT WOOCOMMERCE*/
if ( ! function_exists( 'is_ajax' ) ) {
/**
* is_ajax - Returns true when the page is loaded via ajax.
* @return bool
*/
function is_ajax() {
return defined( 'DOING_AJAX' );
}
@Tusko
Tusko / parse.php
Last active December 2, 2017 01:39
Parse CSV by line (acf repeater)
<?php
$file = file_get_contents('/wp-content/themes/themename/analyzers.csv');
$lines = explode(PHP_EOL, $file);
$array = array();
foreach ($lines as $line) {
$l = str_getcsv($line);
$array[] = array(
'brand' => $l[1],
'model' => $l[0],
);
@moskalukigor
moskalukigor / functions.php
Last active February 21, 2018 13:07
popular product wordpress
<?php
function get_most_popular_products($atts = array())
{
extract($atts);
$posts_per_page = !isset( $posts_per_page ) ? 10 : $posts_per_page;
$order = !isset( $order ) ? "DESC" : $order;
$post_status = !isset( $post_status ) ? "publish" : $post_status;
$post_type = !isset( $post_type ) ? "product" : $post_type;
$args = array(
@moskalukigor
moskalukigor / init.js
Last active May 21, 2018 08:07
Temporary Block CF7 Submit on Send
var wpcf7Submit = $('.wpcf7-submit');
document.addEventListener( 'wpcf7submit', function( event ) {
wpcf7Submit.attr('disabled', 'disabled');
}, false);
document.addEventListener( 'wpcf7mailsent', function( event ) {
wpcf7Submit.removeAttr('disabled');
}, false);
document.addEventListener( 'wpcf7mailfailed', function( event ) {
wpcf7Submit.removeAttr('disabled');