Skip to content

Instantly share code, notes, and snippets.

@ArhStrAngeR
ArhStrAngeR / gist:14e33c05f95fa8a222acc9aba2adbb13
Created June 28, 2021 14:46
update price for woocommerce
update `wp_postmeta` set meta_value = meta_value * 2 WHERE (`meta_key` = '_price' OR `meta_key` = '_regular_price')
@ArhStrAngeR
ArhStrAngeR / gist:cc5d362c6fbc7434f13842370700ded7
Created June 4, 2021 14:46
Получить список всех записей с урлами
SELECT wpp.post_title, wpp.guid, wpp.post_date,
REPLACE( REPLACE( REPLACE( REPLACE( wpo.option_value, '%year%', DATE_FORMAT(wpp.post_date,'%Y') ), '%monthnum%', DATE_FORMAT(wpp.post_date, '%m') ), '%day%', DATE_FORMAT(wpp.post_date, '%d') ), '%postname%', wpp.post_name ) AS permalink
FROM wp_posts wpp
JOIN wp_options wpo
ON wpo.option_name = 'permalink_structure'
WHERE wpp.post_type = 'post'
AND wpp.post_status = 'publish'
ORDER BY wpp.post_date DESC;
@ArhStrAngeR
ArhStrAngeR / hideCounters.js
Created March 3, 2021 10:06 — forked from mforve/hideCounters.js
Скрытие счетчиков метрики для PageSpeed
window.onload = function(e){
function toTop() {
$(window).scrollTop($(window).scrollTop()+1);
}
setTimeout(toTop, 1000);
}
var fired = false;
window.addEventListener('scroll', () => {
if (fired === false) {
fired = true;
<?php
////////////////////////////
# WP AJAX EXAMPLE
////////////////////////////
/////////////////////////
# Enqueue Script
/////////////////////////
<?php
///////////////////////////////
# COMPLETE METABOX EXAMPLE
///////////////////////////////
///////////////////////////////
# I. ADD METABOX
@ArhStrAngeR
ArhStrAngeR / wpdb-column-examples.php
Created March 12, 2020 14:34 — forked from jeffward3283/wpdb-column-examples.php
WordPress Database Examples
<?php
////////////////////////
# COLUMN EXAMPLES
////////////////////////
////////////////////////
# Add Column (after)
////////////////////////
global $wpdb;
@ArhStrAngeR
ArhStrAngeR / .htaccess
Created October 8, 2019 13:23 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@ArhStrAngeR
ArhStrAngeR / .htaccess
Created October 8, 2019 13:21 — forked from artikus11/.htaccess
Заготовка для подключения браузерного кеширования
Включение кеша браузера
=====
Вариант 1
===
<ifModule mod_headers.c>
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=2592000"
<style>
/* ---------------------------------------------- /*
* Mouse animate icon
/* ---------------------------------------------- */
.mouse-icon {
border: 2px solid #000;
border-radius: 16px;
height: 40px;
width: 24px;
display: block;