Skip to content

Instantly share code, notes, and snippets.

View ildarkhasanshin's full-sized avatar
🚀
eat sleep code repeat

ildar r. khasanshin ildarkhasanshin

🚀
eat sleep code repeat
View GitHub Profile
@artikus11
artikus11 / functions.php
Created August 16, 2022 11:35
Удаление всех миниатюр у отдельного типа записи
function delete_all_attachments_by_post_type() {
global $wpdb;
$attachments = $wpdb->get_results(
"SELECT meta_value as att_id
FROM $wpdb->postmeta
INNER JOIN $wpdb->posts
ON ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->posts.post_type = 'courses')
WHERE meta_key = '_thumbnail_id'"
@artikus11
artikus11 / art-custom-edits.php
Created August 13, 2021 15:13
Обрезка заголовков атрибутов до нужной длины
add_filter(
'sanitize_taxonomy_name',
function ( $urldecode ) {
return mb_substr( $urldecode, 0, 26, 'utf-8' );
},
10,
2
);
@artikus11
artikus11 / art-custom-edits.php
Created August 7, 2021 14:23
Функция подсчета времени чтения поста
/**
* Возвращает примерное время чтение поста, в зависимости от количества знаков
*
* @param int $post_id ID поств, для которого надо расчитать время
*
* @return string
*
* @author Artem Abramovich
* @verphp 7.0
*/
@artikus11
artikus11 / art-custom-edits.php
Last active November 26, 2022 18:57
Прогресс бар при скроле страницы
/**
* Прогресс бар при скроле страницы
*
* @author Artem Abramovich
* @verphp 7.0
*/
function art_progress_bar() {
?>
<style>
@NabilNoN
NabilNoN / MySQL.php
Last active May 24, 2022 10:48 — forked from shak18/MySQL.php
Simple PHP MYSQLi Class
<?php
class Mysql
{
private $link = null;
private $info = array(
'last_query' => null,
'num_rows' => null,
'insert_id' => null
);
@shak18
shak18 / MySQL.php
Last active September 16, 2023 14:42
Simple PHP MYSQLi Class
<?php
class MySQL {
private $link = null;
private $info = array(
'last_query' => null,
'num_rows' => null,
'insert_id' => null
);
private $connection_info = array();
@starlinq
starlinq / cloud.mail.ru-webdav.md
Last active June 25, 2023 16:57
Подключение к Cloud.mail.ru с помощью WebDAV эмулятора в Убунту 18.04
title date
Подключение к Cloud.mail.ru с помощью WebDAV эмулятора в Убунту 18.04
2019-02-06

Подключение к Cloud.mail.ru с помощью WebDAV эмулятора в Убунту 18.04

Инструкцию для Убунту 20.04 см. здесь.

@campusboy87
campusboy87 / wpcf7_modal_invalid.php
Last active March 28, 2024 11:20
Displays a message about the successful submission of the form in a modal window for the Contact Form 7 plugin
<?php
/**
* Plugin Name: CF7 Modal Invalid Answer
* Plugin URI: https://gist.github.com/campusboy87/a056c288c99feee70058ed24cee805ad
* Author: Campusboy (wp-plus)
* Author URI: https://www.youtube.com/wp-plus
*/
add_action( 'wp_enqueue_scripts', 'wpcf7_modal_invalid_js' );
add_action( 'wp_footer', 'wpcf7_modal_invalid_js_inline', 999 );
@artikus11
artikus11 / .htaccess
Created June 29, 2018 09:19
Редирект с http На https
#Вариант 1
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
#Вариант 2
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
##
## How to install mcrypt in php7.2 / php7.3
## Linux / MacOS / OSX
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
#