Skip to content

Instantly share code, notes, and snippets.

@KoolPal
KoolPal / woocommerce-stock-info.php
Created February 22, 2020 06:32 — forked from damiencarbery/woocommerce-stock-info.php
List stock levels in WooCommerce - List the stock level for each product and variation. https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
<?php
/*
Plugin Name: WooCommerce Stock Info
Plugin URI: https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
Description: List the stock level for each product and variation.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@KoolPal
KoolPal / add-cron-task.php
Created February 22, 2020 06:05 — forked from damiencarbery/add-cron-task.php
WP Cron - how to use and how to extend
<?php
// Set up task when plugin is activated
register_activation_hook(__FILE__, 'dcwd_cron_status_setup_schedule');
// On an early action hook, check if the hook is scheduled - if not, schedule it.
function dcwd_cron_status_setup_schedule() {
// Add the event only if it is not already scheduled.
if ( ! wp_next_scheduled( 'dcwd_cron_status_status_email' ) ) {
// Schedule weekly at 2:12am.
wp_schedule_event( mktime(2,12,0), 'weekly', 'dcwd_cron_status_status_email');
@KoolPal
KoolPal / disable-cf7.php
Created February 22, 2020 06:04 — forked from damiencarbery/disable-cf7.php
Disable Contact Form 7 plugin except for certain pages.
<?php
/*
Plugin Name: Disable CF7 plugin
Plugin URI: http://www.damiencarbery.com
Description: Disable Contact Form 7 plugin except for certain pages.
Author: Damien Carbery
Version: $Revision: $
$Id: $
*/
<?php
/*
Plugin Name: Move Variations above Short Description
Plugin URI: https://www.facebook.com/groups/advanced.woocommerce/permalink/2114573521890389/
Description: Move the variations and Add to Cart to be above the short description.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@KoolPal
KoolPal / send-emails-via-smtp.php
Created February 22, 2020 05:20 — forked from damiencarbery/send-emails-via-smtp.php
Sent WordPress emails with SMTP - Deliver emails reliably by using SMTP. Use a tiny streamlined plugin to keep things fast. https://www.damiencarbery.com/2019/01/send-wordpress-emails-with-smtp/
<?php
/*
Plugin Name: Send email via SMTP
Plugin URI: https://www.damiencarbery.com/2019/01/send-wordpress-emails-with-smtp/
Description: Send emails via SMTP.
Author: Damien Carbery
Version: 0.1
*/
@KoolPal
KoolPal / htaccess-root.txt
Created February 22, 2020 05:19 — forked from damiencarbery/htaccess-root.txt
Hardening and Caching WordPress - A few .htaccess and wp-config.php changes to harden and speed up your website. These are simple changes that can help protect you - https://www.damiencarbery.com/2019/03/hardening-and-caching-wordpress/
# Block WordPress xmlrpc.php requests.
<Files xmlrpc.php>
deny from all
</Files>
# Block direct access to wp-config.php.
<Files wp-config.php>
Deny from all
</Files>
@KoolPal
KoolPal / inject-ad-content.php
Created February 22, 2020 05:17 — forked from damiencarbery/inject-ad-content.php
Inject Adverts into Posts and Pages - Inject a specified page or widget area into post or page content. https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
<?php
/*
Plugin Name: Inject Adverts into Posts and Pages
Plugin URI: https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
Description: Inject a specified page or widget area into post or page content.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@KoolPal
KoolPal / custom-note-to-order-email.php
Created February 22, 2020 05:05 — forked from damiencarbery/custom-note-to-order-email.php
Add info to WooCommerce order emails -
<?php
/*
Plugin Name: Custom note to order email
Plugin URI: https://www.damiencarbery.com/2018/07/add-info-to-woocommerce-order-emails/
Description: Add a note to the order email if the order contains products from the specified category.
Author: Damien Carbery
Version: 0.1
*/
/* Add note about shapetrousers delivery time to the order email. */
@KoolPal
KoolPal / metabox-multiple.php
Created February 21, 2020 07:38 — forked from cferdinandi/metabox-multiple.php
Create a metabox with multiple fields
<?php
/**
* Create a metabox with multiple fields.
* Replace `_namespace` with some namespace for your project to avoid conflicts with other items
*/
//
// Create Metabox
//
@KoolPal
KoolPal / wordpress_functions.php
Created February 21, 2020 06:41 — forked from jetfire21/wordpress_functions.php
wordpress functions
<?php
########### wp replace url in DB #############
1
http://dugoodr.com
http://dugoodr2.dev
2
/home/dugoodr6/public_html/
/home/jetfire/www/dugoodr2.dev/