Skip to content

Instantly share code, notes, and snippets.

View topmask's full-sized avatar
🤩
Out sick

Allen Smith topmask

🤩
Out sick
View GitHub Profile
@topmask
topmask / _common.conf
Created October 15, 2021 00:06 — forked from Daniel15/_common.conf
WordPress config with WP Super Cache for Nginx
# /etc/nginx/snippets/wordpress/common.conf
index index.php;
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
}
# Block PHP files in uploads, content, and includes directory.
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
@topmask
topmask / page-contact-form.php
Created October 19, 2021 08:03 — forked from tmblog/page-contact-form.php
Simple WordPress Contact Form without Plugin - Bootstrap ready.
<?php /* Template Name: Contact Page */
$response = "";
//function to generate response
function my_contact_form_generate_response($type, $message){
global $response;
if($type == "success") $response = "<div class='alert alert-success'>{$message}</div>";
else $response = "<div class='alert alert-danger'>{$message}</div>";
#!/usr/bin/env bash
# WP-CLI Back up Script to Amazon S3
# Source: https://www.jonathan.vc
# Author: Jonathan Dingman
# Adapted from Mike at WP Bullet
#define local path for backups
BACKUPPATH=/tmp/backups
#path to WordPress installations
@topmask
topmask / custom-email-manager.php
Created October 29, 2021 13:52 — forked from pinalj/custom-email-manager.php
This file contains the code to include email classes and trigger custom emails.
<?php
/**
* Handles email sending
*/
class Custom_Email_Manager {
/**
* Constructor sets up actions
*/
public function __construct() {
@topmask
topmask / custom-item-email-html.php
Created October 29, 2021 13:52 — forked from pinalj/custom-item-email-html.php
The HTML Email Template
<?php
/**
* Admin new order email
*/
$order = new WC_order( $item_data->order_id );
$opening_paragraph = __( 'A new order has been made by %s. The details of the item are as follows:', 'custom-email' );
?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<?php
/**
* Admin new order email
*/
$order = new WC_order( $item_data->order_id );
echo "= " . $email_heading . " =\n\n";
$opening_paragraph = __( 'A new order has been made by %s. The details of the item are as follows:', 'custom-email' );
@topmask
topmask / product_key_features.php
Created October 30, 2021 10:18 — forked from tdmrhn/product_key_features.php
Product Key Features Field
<?php
// Display Input Field on Backend
add_action( 'woocommerce_product_options_general_product_data', function () {
global $woocommerce, $post;
echo '<div class="options_group">';
woocommerce_wp_text_input(
array(
'id' => 'product_key_features',
'label' => __( 'Product Key Features', 'woocommerce' ),
'placeholder' => 'Enter product key features (3 words)',
@topmask
topmask / disable-woocommerce-bloat.php
Created October 30, 2021 10:31 — forked from tdmrhn/disable-woocommerce-bloat.php
Disable WooCommerce Bloat
<?php
add_filter( 'woocommerce_admin_disabled', '__return_true' );
add_filter( 'jetpack_just_in_time_msgs', '__return_false', 20 );
add_filter( 'jetpack_show_promotions', '__return_false', 20 );
add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false', 999 );
add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
add_filter( 'woocommerce_menu_order_count', 'false' );
@topmask
topmask / www-post-thumb.php
Created November 16, 2021 11:48 — forked from gmazzap/www-post-thumb.php
WordPress plugin that allow to use an external image url as featured image.
<?php namespace GM\WWWPostThumbnail;
/**
* Plugin Name: WWW Post Thumbnail
* Description: Allow to use an external image url as featured image.
* Plugin URI: https://gist.github.com/Giuseppe-Mazzapica/928bc22e5f49a654cf7c
* Author: Giuseppe Mazzapica
* Author URI: https://github.com/Giuseppe-Mazzapica
* License: MIT
* Version: 0.1.0
*