Skip to content

Instantly share code, notes, and snippets.

View doiftrue's full-sized avatar
💻
codding...

Timur Kamaev doiftrue

💻
codding...
View GitHub Profile
@doiftrue
doiftrue / disable-comments.php
Last active December 5, 2024 16:11
[wp-kama embed] https://wp-kama.com/2539 Disable Comments for WordPress. Original code see here: https://github.com/WPDevelopers/disable-comments-mu
<?php
/**
* Plugin Name: Disable Comments (Must Use version)
* Description: Disables all WordPress comment functionality on the entire network.
* Version: 1.1.2 (changed)
* Plugin Changed URI: https://gist.github.com/doiftrue/ab931c1d866cb113b4ff318a5faeb3b3
* Plugin URI: https://github.com/WPDevelopers/disable-comments-mu
* GitHub Plugin URI: https://github.com/WPDevelopers/disable-comments-mu
* Author: WPDeveloper
* Author URI: https://wpdeveloper.com
@doiftrue
doiftrue / disable-aggressive-updates.php
Last active November 18, 2024 17:18
[wpkama embed] https://wp-kama.com/2345 Disable Aggressive Updates.
<?php
/**
* Disable forced checking for new WP, plugins, and theme versions in the admin panel,
* so that it doesn't slow down when you haven't visited for a long time and then visit...
* All checks will happen unnoticed through cron or when you visit the "Dashboard > Updates" page.
*
* @see https://wp-kama.ru/filecode/wp-includes/update.php
* @author Kama (https://wp-kama.ru)
* @version 1.1
@doiftrue
doiftrue / disable-wp-customizer.php
Last active September 14, 2024 02:54
[wp-kama embed] https://wp-kama.com/2600 Disable WP Customizer. Original code see here: https://wordpress.org/plugins/customizer-disabler/
<?php
/*
* Plugin name: Disable Customizer
* Description: Completely turn off customizer on your site.
*
* Plugin URI: https://gist.github.com/doiftrue/6d8f975ed8af5ac325b6d9a1c52abf1c
* Author URI: https://wp-kama.com
* Author: Timur Kamaev
* Note: This is a fork of https://wordpress.org/plugins/customizer-disabler/ (v2.2.7)
* Source Author: Johannes Siipola
@doiftrue
doiftrue / WP_Theme_Scripts_Styles.php
Last active July 27, 2024 19:32
WP_Theme_Scripts_Styles - simple class to enqueue scripts and styles using config array.
<?php
/**
* @author Kama (wp-kama.com)
* @see https://gist.github.com/doiftrue/d975646f41f218499866968a1a7dbf62
*
* @version 2.1
*/
class Theme_Scripts_Styles {
@doiftrue
doiftrue / Kama_Breadcrumbs.php
Created January 11, 2024 01:25
[wpkama embed] https://wp-kama.ru/541 Breadcrumbs for WordPress
<?php
/**
* Breadcrumbs for WordPress
*
* @param string $sep Separator. Default is ' » '.
* @param array $l10n For localization. See the variable `$default_l10n`.
* @param array $args Options. See the variable `$def_args`.
*
* @return void Outputs HTML code to the screen
@doiftrue
doiftrue / kama_previous_posts_from_tax_lis.php
Last active March 16, 2024 16:04
[wp-kama embed] Interlinking posts in WordPress (previous posts from category). Function 2 -- https://wp-kama.com/2186
/**
* Предыдущие записи из рубрики (относительно текущей записи) +
* кольцевая перелинковка (можно указывать таксономию и тип записи).
*
* Кэширует результат в объектный кэш, если он включен.
*
* Вызываем функцию так:
*
* echo kama_previous_posts_from_tax_lis( [
* 'post_num' => 5,
@doiftrue
doiftrue / My_Best_Metaboxes.php
Created March 6, 2024 02:55
[wp-kama embed] https://wp-kama.ru/id_740 Example of custom post metabox
<?php
$my_metabox = new My_Best_Metaboxes( 'post' );
$my_metabox->init();
class My_Best_Metaboxes {
public $post_type;
static $meta_prefix = 'company_address';
@doiftrue
doiftrue / wp_nav_menu-object-cache.php
Created February 28, 2024 19:16
[wpkama embed] https://wp-kama.ru/16856 wp_nav_menu object cache
<?php
Pj_Cached_Nav_Menus::load();
/**
* Caches calls to wp_nav_menu().
*/
class Pj_Cached_Nav_Menus {
public static $ttl = 3600; // use 0 to cache forever (until nav menu update)
public static $cache_menus = array();
@doiftrue
doiftrue / Kama_Minmax_Post_Meta_Values.php
Created January 15, 2024 22:45
[wpkama embed] https://wp-kama.ru/9128 Gathers and caches the minimum and maximum value of the specified meta-field for the specified terms of the taxonomy
<?php
/**
* Gathers and caches the minimum and maximum value of the specified meta-field for the specified terms of the taxonomy.
* Suitable for obtaining the minimum and maximum prices of products from categories.
*
* The code caches the minimum and maximum numerical values in the post meta-fields for each category.
* It also collects the overall minimum and maximum values for the entire taxonomy.
*
* @changelog
@doiftrue
doiftrue / Kama_Post_List_Table_Thumb.php
Created January 15, 2024 21:05
[wpkama embed] https://wp-kama.ru/9227 Ability to upload and modify post thumbnails from the posts list table in the admin panel.
<?php
if( ! is_admin() ){
return;
}
add_action( 'admin_init', [ Kama_Post_List_Table_Thumb::class, 'init' ] );
/**
* Ability to upload and modify post thumbnails from the posts list table in the admin panel.