Skip to content

Instantly share code, notes, and snippets.

@AntonLitvin
AntonLitvin / wp_security_setting
Created October 17, 2018 10:14 — forked from artikus11/wp_security_setting
Настройки для плагина All In One WP Security
{"aiowps_enable_debug":"","aiowps_remove_wp_generator_meta_info":"1","aiowps_prevent_hotlinking":"1","aiowps_enable_login_lockdown":"1","aiowps_allow_unlock_requests":"","aiowps_max_login_attempts":3,"aiowps_retry_time_period":5,"aiowps_lockout_time_length":60,"aiowps_set_generic_login_msg":"","aiowps_enable_email_notify":"","aiowps_email_address":"9698114@mail.ru","aiowps_enable_forced_logout":"","aiowps_logout_time_period":"60","aiowps_enable_invalid_username_lockdown":"","aiowps_instantly_lockout_specific_usernames":[],"aiowps_unlock_request_secret_key":"9boae3otjbi5x7b7q6kf","aiowps_enable_whitelisting":"","aiowps_allowed_ip_addresses":"","aiowps_enable_login_captcha":"","aiowps_enable_custom_login_captcha":"","aiowps_captcha_secret_key":"y9t13745ja38h0dirf5q","aiowps_enable_manual_registration_approval":"","aiowps_enable_registration_page_captcha":"","aiowps_enable_random_prefix":"","aiowps_enable_automated_backups":"1","aiowps_db_backup_frequency":2,"aiowps_db_backup_interval":"2","aiowps_backup_files_s
@AntonLitvin
AntonLitvin / resize.js
Last active August 11, 2019 14:48 — forked from branneman/event.js
JavaScript window resize event with a 500ms delay
$(window).on('resize-end', function() {
console.log('IMMA RESIZED 500 MILLI-FOCKING-SECONDS AGO');
});
// решение для того чтобы ресайз не срабатывал на скролл на мобилках
var width = $(window).width();
$(window).resize(function(){
if($(window).width() != width){
//DO RESIZE
@AntonLitvin
AntonLitvin / functions.php
Created February 8, 2019 19:54 — forked from vishalbasnet23/functions.php
User Registration Front End WordPress with Ajax
<?php
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0);
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end');
function register_user_front_end() {
$new_user_name = stripcslashes($_POST['new_user_name']);
$new_user_email = stripcslashes($_POST['new_user_email']);
$new_user_password = $_POST['new_user_password'];
$user_nice_name = strtolower($_POST['new_user_email']);
$user_data = array(
'user_login' => $new_user_name,
@AntonLitvin
AntonLitvin / functions.php
Created February 8, 2019 20:29 — forked from vishalbasnet23/functions.php
Append async to wp_enqueue_script
<?php
function advanced_asyc_scripts($url) {
if ( strpos( $url, '#asyncload') === false ) {
return $url;
} else if ( is_admin() ) {
return str_replace( '#asyncload', '', $url );
} else {
return str_replace( '#asyncload', '', $url )."' async='async' defer='defer";
}
}
@AntonLitvin
AntonLitvin / form.html
Created February 9, 2019 07:53 — forked from vishalbasnet23/form.html
Custom jQuery validation for form without submit function.
<form id="form-id">
<div class="span6 form-table">
<label for="usr">First Name <b>*</b></label>
<input name="first_name" type="text" class="form-control" id="usr" data-required="yes">
<div class="cus-validation-error" style="display:none;">
Please Enter Your First Name.
</div>
</div>
<div class="span6 form-table">
<label for="">E-mail address<b>*</b></label>
@AntonLitvin
AntonLitvin / functions.php
Created February 9, 2019 07:54 — forked from vishalbasnet23/functions.php
Simple Ajax Pagination WP
<?php
add_action('wp_ajax_infinite_scroll_home', 'infinite_scroll_home', 0);
add_action('wp_ajax_nopriv_infinite_scroll_home', 'infinite_scroll_home');
function infinite_scroll_home() {
$exclude_posts_json = $_POST['exclude_posts'];
$exclude_posts = json_decode($exclude_posts_json);
$post_offset = $_POST['post_offset'];
$infinite_scroll_args = array( 'post_type'=>'post', 'posts_per_page'=> 2,'post__not_in' => $exclude_posts, 'offset' => $post_offset);
$infinite_scroll_query = new WP_Query( $infinite_scroll_args );
while( $infinite_scroll_query->have_posts() ) : $infinite_scroll_query->the_post();
@AntonLitvin
AntonLitvin / woocommerce-give-subcat-list-items-their-own-ul.php
Created June 1, 2020 16:52 — forked from twoelevenjay/woocommerce-give-subcat-list-items-their-own-ul.php
Move WooCommerce subcategory list items into their own <ul> separate from the product <ul>.
<?php
/**
* Move WooCommerce subcategory list items into
* their own <ul> separate from the product <ul>.
*/
add_action( 'init', 'move_subcat_lis' );
function move_subcat_lis() {
// Remove the subcat <li>s from the old location.
@AntonLitvin
AntonLitvin / viewport.js
Last active October 18, 2020 13:31 — forked from delphinpro/viewport.js
Conditional meta viewport
/*
* Paste into the end <head>
*/
(function(){
var width = screen.width;
var oldViewport = document.querySelector('meta[name="viewport"]');
var viewport = document.createElement('meta');
viewport.setAttribute('name', 'viewport');
viewport.setAttribute('content', 'width=' + (width <= 640 ? '640' : 'device-width'));
document.head.replaceChild(viewport, oldViewport);
@AntonLitvin
AntonLitvin / Minify HTML
Created February 4, 2021 16:56 — forked from unfulvio/functions.php
WordPress HTML Minification Class to compress HTML (removal of whitespaces, line breaks, new lines, comments). Preserves script comments (if removed might break some javascripts like Google Analytics or Adsense) and IE specific tags.
/* Minifies HTML and removes comments (except IE tags and comments within script tags)
*
* To disable compression of code portions, use '<!--wp-html-compression no compression-->' tag
*
* @see http://forrst.com/posts/Wordpress_Minify_output_HTML-29q
* @see http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html
*/
class WP_HTML_Compression
{
// Settings
@AntonLitvin
AntonLitvin / add-wordpress-settings-page.php
Created August 19, 2021 16:11 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters