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 / 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
@artikus11
artikus11 / woo-events.js
Last active February 5, 2024 19:53 — forked from bagerathan/woo-events.js
Woocommerce Javascript events #woocommerce
//Woocommerce JS events. Страница оформления заказа
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce JS events. Страница корзины
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@artikus11
artikus11 / passing-variables-to-get_template_part-in-wordpress.php
Created October 22, 2019 18:46 — forked from mihdan/passing-variables-to-get_template_part-in-wordpress.php
Передача переменных для get_template_part()
<?php
/**
* Load a template part into a template
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialised template.
* @param array $params Any extra params to be passed to the template part.
*/
function get_template_part_extended( $slug, $name = null, $params = array() ) {
if ( ! empty( $params ) ) {
@artikus11
artikus11 / .htaccess
Created May 16, 2019 22:02 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@artikus11
artikus11 / wp-plugin-classes.php
Created September 15, 2018 09:11 — forked from chrisguitarguy/wp-plugin-classes.php
Using classes in WordPress plugins. Please comment!
<?php
/* Using Classes in WordPress Plugins */
/**
* The "normal" way. Actions are added in a constructor. Create a new instance
* of the class to "bootstrap" the plugin.
*
* Two ways to instantiate:
* 1. anonymous:
@artikus11
artikus11 / pe-customize-controls.css
Created June 20, 2018 15:25 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@artikus11
artikus11 / functions.php
Created February 18, 2018 19:08 — forked from mihdan/functions.php
SMTP using wp-config.php for settings
<?php // Don't use this line.
/**
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*
* Values are constants set in wp-config.php
*/
add_action( 'phpmailer_init', 'send_smtp_email' );
@artikus11
artikus11 / woocommerce-optimize-scripts.php
Created May 18, 2017 17:56 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );