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 / Kama_Disable_Gutenberg.php
Created January 14, 2024 04:07
[wpkama embed] https://wp-kama.ru/11130 Kama_Disable_Gutenberg
<?php
/***
* Disables Gutenberg (the new block editor in WordPress).
*
* @version 2.0
*/
did_action( 'plugins_loaded' )
? Kama_Disable_Gutenberg::init()
: add_action( 'plugins_loaded', [ Kama_Disable_Gutenberg::class, 'init' ] );
@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 / kama_previous_posts_from_cat.php
Last active January 10, 2024 03:24
[wp-kama embed] Previous Entries from Category >>> https://wp-kama.com/2102
<?php
/**
* Previous posts from the category (relative to the current post) + circular linking
* Parameters passed to the function. Default values are indicated in parentheses.
*
* @param int $post_num (5) Number of links.
* @param string $format ('') Output format: `{thumb} {date:j.M.Y} - {a}{title}{/a} ({comments})`.
* @param string $cache ('') Enable cache (default is off). Write 1 to enable.
* @param string $list_tag (li) List tag.
* @param string $post_type (post) Type of post we are working with.
@doiftrue
doiftrue / kama_pagenavi.php
Last active January 10, 2024 03:24
[wp-kama embed] kama_pagenavi >>> https://wp-kama.ru/8/
/**
* A wp_pagenavi alternative. Creates pagination links on archive pages.
*
* @param array $args Function arguments.
* @param WP_Query $wp_query WP_Query object on which pagination is based. Defaults to global variable $wp_query.
*
* @return string Pagination HTML code.
*
* @link https://wp-kama.ru/8
* @author Timur Kamaev
@doiftrue
doiftrue / Kama_Hard_Disable_Plugins_On_Front.php
Last active January 10, 2024 03:32
[wp-kama embed] How Disable Plugins on Front-end? >>> https://wp-kama.com/1704
<?php
/**
* Disables the connection of the specified plugins at the front and ajax requests.
*
* @version 2.0
* @author Kama (wp-kama.ru)
*/
class Kama_Hard_Disable_Plugins_On_Front {
@doiftrue
doiftrue / Same_Prefix_Post_Taxes_Rewrite.php
Last active January 10, 2024 03:25
[wp-kama embed] WordPress: Friendly URLs for a Dual Multi-level Taxonomy >>> https://wp-kama.com/1326
<?php
new Same_Prefix_Post_Taxes_Rewrite();
/**
* How it works.
*
* We have:
* - ``company`` — Flat post type.
* - ``catalog`` — Hierarchical taxonomy.
@doiftrue
doiftrue / twenty23-theme.json
Created November 18, 2022 19:50
twenty23 teme file as example of supported parameters
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"customTemplates": [
{
"name": "blank",
"postTypes": [
"page",
"post"
],
@doiftrue
doiftrue / WP_CLI_Permalink_Manager_Deletion_Check.php
Last active January 10, 2024 08:05
[EPAM] WP CLI Commands for analyze (investigate) whether we can delete Permalink Manager plugin
@doiftrue
doiftrue / define_wp_debug.php
Last active January 10, 2024 08:28
[wp-kama embed] https://wp-kama.ru/7791 Dynamically enable/disable the display of PHP errors in WordPress.
<?php
/**
* Dynamically enable/disable the display of PHP errors in WordPress.
*
* Installation:
* replace line 'define( WP_DEBUG, false );' in 'wp-config.php' file with this code.
*
* Enabling debug mode:
* NOTE: Strongly recommended to changing the 'debug' word to something more unique!