Skip to content

Instantly share code, notes, and snippets.

@timba64
timba64 / functions.php
Last active July 16, 2018 07:34
remove quantity in woocommerce categories
//убираем количество в категориях
add_filter('woocommerce_subcategory_count_html','remove_count');
function remove_count(){
$html='';
return $html;
}
@timba64
timba64 / func-help.php
Last active July 17, 2018 12:37
add page Help in menu in admin area of wordpress
add_action('admin_menu', function(){
add_menu_page( 'Myway | Помощь', 'Помощь', 'edit_pages', 'help', 'add_help_page', 'dashicons-editor-help', 4 );
} );
function add_help_page() {
include 'helpix.php';
}
@timba64
timba64 / popup.js
Created October 24, 2018 15:05
maintenance of popup window with form
// maintenance of popup
(function(){
// open popup link ***********************/
var bopy = $('.bibop');
$('#pop-js').on('click touchend', function(e) {
bopy.css('display', 'block').show().animate({ opacity: 1 }, 350);
e.preventDefault();
});
// popUp with form ***********************/
@timba64
timba64 / functions.php
Last active October 26, 2018 09:20
some functions for Wordpress
//add styles only on one page of admin area Wordpress
add_action( 'admin_enqueue_scripts', 'add_css_help_page' );
function add_css_help_page( $hook ){
//wp_die($hook);
// output help.css only on help page in admin zone
if($hook != 'toplevel_page_help') {
return;
}
wp_enqueue_style( 'css-help-admin', get_template_directory_uri() .'/help.css' );
}
@timba64
timba64 / .htaccess
Last active October 26, 2018 09:28 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server and some others rules
# last working way - http to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</IfModule>
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
@timba64
timba64 / pie.js
Created October 30, 2018 14:29
Using Enhansed Ecommerce in Google Analytics
// get elements and push click in google Analitics
(function(){
var elems = document.querySelectorAll('.wcat-item');
for (var i = 0; i < elems.length; i++) {
elems[i].addEventListener('click', function(e){
var elName = this.querySelector('.name').textContent;
var elId = this.querySelector('.name').getAttribute('data-id');
var elPrice = parseInt(this.querySelector('.woocommerce-Price-amount').textContent);
//e.preventDefault();
dataLayer.push({
@timba64
timba64 / code.js
Last active November 26, 2018 09:24
Create custom menu in google spreadsheet, get unread email from google account and put it in google sheets
function onOpen(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Меню для Оли",
[{ name: "Write to file", functionName: "writeToFile" },
{ name: "Remove Duplicates", functionName: "removeDuplicates" },
{ name: "Count lids", functionName: "countLids" }]
);
}
/**
@timba64
timba64 / indo_favicon.html
Created January 12, 2019 14:37
рекомендованная фавиконка
<!-- Стандартный фавикон -->
<link rel="icon" type="image/x-icon" href="https://example.com/favicon.ico">
<!-- Рекомендованный формат фавикона -->
<link rel="icon" type="image/png" href="https://example.com/favicon.png">
@timba64
timba64 / kinsta-share-users.php
Created April 24, 2019 06:56 — forked from carlodaniele/kinsta-share-users.php
A plugin to share users and usermeta tables between independent WordPress installations. This plugin requires CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defined into wp-config file
<?php
/**
* @package Kinsta_Share_Users
* @version 1.0
*/
/*
Plugin Name: Kinsta Share Users
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for Kinsta blog readers
Author: Carlo Daniele
@timba64
timba64 / sql_query_levelchinese.txt
Created April 25, 2019 07:16
Some sql gueries for memory
1. ********* step 1
CREATE TABLE `levelchinese`.`temp_usermeta` (
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar(255) DEFAULT NULL,
`meta_value` longtext,
PRIMARY KEY (`umeta_id`),
KEY `user_id` (`user_id`),
KEY `meta_key` (`meta_key`(191))