Skip to content

Instantly share code, notes, and snippets.

View sukhikh18's full-sized avatar
💪
Business, Development, Sales, Marketing

Nick Sergeevich sukhikh18

💪
Business, Development, Sales, Marketing
View GitHub Profile
<?php
/**
* WP Admin Settings Page
*
* before use:
* download requires
* change MY_PAGE_SLUG constant
* change render functions
*
*/
@sukhikh18
sukhikh18 / add-wc-order-status.php
Created July 4, 2017 06:03 — forked from bekarice/add-wc-order-status.php
Add WooCommerce 2.2 Order Status
/**
* Register new status
* Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/
**/
function register_awaiting_shipment_order_status() {
register_post_status( 'wc-awaiting-shipment', array(
'label' => 'Awaiting shipment',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
<?php
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
var Countdown = function (clock, endtime, args){
function parseCdString(endtime){
var index, parse, result = 0;
index = endtime.indexOf('day');
if( index >= 0 ){
result+= parseInt(endtime.slice( parse, index - 1 ).replace( /^\D+/g, '')) * 24 * 60 * 60 * 1000;
parse = index;
}
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* To Use: Install 'Easy Fancybox'. Leave the URL blank on an image slide in Meta Slider.
* The slide will automatically be linked to it's full image in a lightbox
*
* @tested on WP - 4.4.11; Meta Slider - 3.5.1
*/
function metaslider_easy_fancybox($attributes, $slide, $slider_id) {
if (!strlen($attributes['href'])) {
@sukhikh18
sukhikh18 / custom-nav-walker-usage.php
Created December 29, 2017 11:10 — forked from kosinix/custom-nav-walker-usage.php
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
<?php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
?>
@sukhikh18
sukhikh18 / _custom-utilites.scss
Created July 4, 2018 06:47
Custom scss utilites
// Images
.full { max-width: auto !important; }
.cyrcle { border-radius: 50% !important; }
.rounded { border-radius: 4px !important; }
.scale {
position: relative;
overflow: hidden;
text-align: center;
vertical-align: middle;
> img, > a, > span, > div {
@sukhikh18
sukhikh18 / wp-custom-ajax.php
Created July 9, 2018 08:58
Wordpress. Work with ajax.
<?php
// Константы назначены ТОЛЬКО для показательного примера.
// jquery заменить на свой handle скрипта (если такой имеется)
define('AJAX_ACTION_NAME', 'my_action_name');
define('AJAX_VAR', 'my_ajax_var');
define('MY_SECRET_STRING', 'any_secret_string');
add_action( 'wp_enqueue_scripts', 'add_ajax_data', 99 );
@sukhikh18
sukhikh18 / location_bitrix.php
Last active July 31, 2018 09:25 — forked from VSeryoga/location_bitrix.php
Местоположения Битрикс
<?
$res = \Bitrix\Sale\Location\LocationTable::getList(array(
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID, 'TYPE_CODE' => array("VILLAGE", "CITY"), 'NAME_RU' => array($_POST["city"], $_POST["city"]." %")),
'select' => array('*', 'NAME_RU' => 'NAME.NAME', 'TYPE_CODE' => 'TYPE.CODE'),
'limit' => 10
));
while($item = $res->fetch())
{
$loc[$item["ID"]] = $item;
$ids[] = $item["PARENT_ID"];
@sukhikh18
sukhikh18 / magniflier.js
Last active August 9, 2018 09:41
Image magniflier
$.magniflier = function( target, style ) {
if( !target ) return false;
var style = style || false;
var native_width = 0;
var native_height = 0;
var mouse = {x: 0, y: 0};
var $curImg;
var ui = {