Skip to content

Instantly share code, notes, and snippets.

View llgruff's full-sized avatar
🎯
🐱

Roman Krokhmalyuk llgruff

🎯
🐱
View GitHub Profile
/**
Инструкция: Настройки для работы с API vk.com
1. Прочитать Знакомство с API ВКонтакте https://vk.com/dev/first_guide (можно пропустить:))
2. Регистрация приложения:
2.1. Открыть «Мои приложения» https://vk.com/apps?act=manage
2.2. Нажать «Создать»
2.3. Нужно выбрать один из трех типов приложений (для старта Standalone-приложение)
2.4. Подтвердить создание через СМС
2.5. Открыть вкладку «Настройки» в меню слева, сохранить свой «ID приложения», он же API_ID, APP_ID, client_id
@llgruff
llgruff / Configuring Automatic Background Updates.php
Last active August 10, 2019 15:23
Configuring Automatic Background Updates in WordPress (for functions.php)
<?php
/**
* Configuring Automatic Background Updates
* @link //codex.wordpress.org/Configuring_Automatic_Background_Updates
*/
# Example. To enable ALL automatic updates
add_filter( 'automatic_updates_is_vcs_checkout','__return_false', 1 );
add_filter( 'auto_update_core', '__return_true' );
/**
Инструкция
1. Открыть владельцу/администратору страницу
1.1. Для чистки паблика/группы «Управление сообществом» > «Участники», ссылка https://vk.com/ваш_паблик?act=users
1.2. Для чистки друзей «Друзья», ссылка https://vk.com/friends
2. Проскроллить до конца списка участников, чтобы все подгрузились (протестировано на 15к подписчиков)
3. Открыть консоль браузера используя клавиатуру:
3.1. Command - Option - J (Mac)
3.2. Ctrl - Shift - J (Windows/Linux)
4. Скопировать код данный ниже в консоль
@llgruff
llgruff / How to detect if a WordPress plugin is active.php
Last active October 25, 2022 09:29
A function you can use to check if plugin is active/loaded for your plugins/themes
<?php
/**
* Detect if a WordPress plugin is active
* A function you can use to check if plugin is active/loaded for your plugins/themes
* @link //gist.github.com/llgruff/c5666bfeded5de69b1aa424aa80cc14f
*/
// When coding plugins that rely on another one, like Private Content for bbPress or Visual Attributes for WooCommerce, you need to make if the WordPress Plugin is active to initialize your plugin routines or display a notice saying that the required plugin must be activated. In this tutorial we’ll see how to detect whether a certain plugin is active in a couple of ways.
## 1. Check whether a certain class or function or constant exists
@llgruff
llgruff / Changes in WordPress Plugin 404 Error Logger.php
Last active January 10, 2017 12:46
Additional functions for WordPress Plugin [404 Error Logger] https://wordpress.org/plugins/404-error-logger (for functions.php)
<?php
/**
* Additional functions for WordPress Plugin [404 Error Logger]
* @link //wordpress.org/plugins/404-error-logger
*/
/**
* Add WordPress Dashboard Widget only for admin users (can 'manage_options')
* @link //codex.wordpress.org/Dashboard_Widgets_API
*/
@llgruff
llgruff / Remove version from script and style tags.php
Last active November 15, 2017 14:24
Remove WordPress or file version [?ver=] from script and style tags in source code (for functions.php)
<?php
/**
* Remove WordPress or file version from script and style tags in source code
* @link //gist.github.com/llgruff/a31155be262290c796c3aba9326fdc53
*/
function wp_version_js_css($src) {
if (strpos($src, 'ver='))
$src = remove_query_arg('ver', $src);
return $src;
}
@llgruff
llgruff / Remove SEO-plugin HTML comments.php
Last active March 4, 2021 13:34
Remove [All in One SEO Pack] or [Yoast SEO] HTML Comments in WordPress (for functions.php)
<?php
/**
* Remove [All in One SEO Pack] HTML Comments
* @link //gist.github.com/llgruff/a7ab776167aa0ed307ec445df54e5fdb
*/
if (defined('AIOSEOP_VERSION')) {
add_action('get_header', function() {
ob_start(
function($o) {
return preg_replace('/\n?<.*?One SEO Pack.*?>/mi','',$o);