Skip to content

Instantly share code, notes, and snippets.

View artikus11's full-sized avatar
🥕
Create plugins

Artem Abramovich artikus11

🥕
Create plugins
View GitHub Profile
@artikus11
artikus11 / rank_math_seo_dropdown_filter_removal_posts_table.php
Created April 22, 2024 17:48 — forked from campusboy87/rank_math_seo_dropdown_filter_removal_posts_table.php
Removing the drop-down filter of the Rank Math SEO plugin in the table of posts
<?php
add_action( 'restrict_manage_posts', function () {
global $wp_filter;
$action = 'restrict_manage_posts';
$priority = 11;
$method = 'add_seo_filters';
if ( empty( $wp_filter[ $action ]->callbacks[ $priority ] ) ) {
@artikus11
artikus11 / rank-math-cleanup.php
Last active February 2, 2024 18:30
Rank Math SEO plugin cleanup
<?php
/**
* Plugin Name: Rank Math SEO plugin cleanup
* Description: A cached translation override for WordPress.
* Author: Artem Abramovich
* Plugin URI: https://gist.github.com/artikus11/0d7a52273bd8bdc85f0d3010f156cd5f
*
* @link https://rankmath.com/kb/filters-hooks-api-developer/
*
* @see https://gist.github.com/timbowen/c5c00667c4c48f8ec3f5706b686d6f00
const path = require( 'path' );
const glob = require( 'glob' );
const defaultConfig = require( "@wordpress/scripts/config/webpack.config" );
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
const CssMinimizerPlugin = require( "css-minimizer-webpack-plugin" );
const { hasBabelConfig } = require( '@wordpress/scripts/utils' );
const TerserPlugin = require( 'terser-webpack-plugin' );
const SpriteLoaderPlugin = require( 'svg-sprite-loader/plugin' );
const UnminifiedWebpackPlugin = require( 'unminified-webpack-plugin' );
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
const path = require( 'path' );
const defaultConfig = require( "@wordpress/scripts/config/webpack.config" );
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
const CssMinimizerPlugin = require( "css-minimizer-webpack-plugin" );
const { hasBabelConfig } = require( '@wordpress/scripts/utils' );
const TerserPlugin = require( 'terser-webpack-plugin' );
const UnminifiedWebpackPlugin = require( 'unminified-webpack-plugin' );
const FixStyleOnlyEntriesPlugin = require( 'webpack-fix-style-only-entries' );
const isProduction = process.env.NODE_ENV === 'production';
$( 'form.checkout' ).on( 'change', 'input.qty', function( e ) {
let maxQtyData = {};
let inputs = $( this ).closest( '.woocommerce-checkout-review-order-list' ).find( 'input.qty' );
inputs.each( function( index, element ) {
maxQtyData[$( element ).attr( 'name' )] = $( this ).attr( 'max' );
} );
var data = {
jQuery( document ).ready( function( $ ) {
$( document ).on( 'click', '.plus, .minus', function() {
// Get values
var $qty = $( this ).closest( '.quantity' ).find( '.qty' ),
currentVal = parseFloat( $qty.val() ),
max = parseFloat( $qty.attr( 'max' ) ),
min = parseFloat( $qty.attr( 'min' ) ),
step = $qty.attr( 'step' );
@artikus11
artikus11 / functions.php
Created July 24, 2023 19:24
Отключение лайтбокса и зума на странице товара WooCommerce
add_action( 'after_setup_theme', 'art_remove_wc_lightbox_zoom', 100 );
function art_remove_wc_lightbox_zoom() {
remove_theme_support( 'wc-product-gallery-lightbox' );
remove_theme_support( 'wc-product-gallery-zoom' );
}
.product-content--meta--list {
margin: 0;
padding: 0;
}
.product-content--meta--list tbody {
display: grid;
gap: 12px;
}
/**
* Вывод избранных атрибутов в карточке товара
*
* @param $product
*
* @return array
*/
public function get_attributes_to_product( $product ) {
$product_attributes = [];
@artikus11
artikus11 / wp_remove_attachments_old.sh
Created March 21, 2023 16:26 — forked from zevilz/wp_remove_attachments.sh
Remove old WP attachments
#!/bin/bash
while true; do
POSTS=$(wp db query 'SELECT ID FROM wp_posts WHERE post_type="attachment" AND post_date < "2022-06-05" LIMIT 10000;' --skip-column-names | paste -s -d ' ' -)
if ! [ -z "$POSTS" ]; then
wp post delete $POSTS --force
else
exit 0
fi
done