Skip to content

Instantly share code, notes, and snippets.

View butlerblog's full-sized avatar

Chad Butler butlerblog

View GitHub Profile
@bekarice
bekarice / heading-shortcode.php
Last active February 4, 2019 23:18
Shortcode: Create Headings with anchor + link icon
<?php // only copy this line if needed!
// REQUIRES PHP 5.3+
/**
* Create a shortcode to insert a header with an anchor icon.
* Use [heading size="2" id="anchor"]Heading[/heading]
*
* Recommended: Add prefix / change shortcode name to avoid conflicts
*/
@bekarice
bekarice / wc-align-cart-buttons.css
Created October 2, 2014 23:44
Align WooCommerce Add to Cart Buttons (MAY CHANGE WITH THEME)
a.added_to_cart.wc-forward {
bottom: 0;
position: absolute;
display: block;
bottom: 0px;
}
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
min-height: 295px !important;
@mildred
mildred / download.sh
Created October 20, 2014 10:03
Download from archive.org Wayback Machine
#!/bin/bash
url=http://redefininggod.com
webarchive=https://web.archive.org
wget="wget -e robots=off -nv"
tab="$(printf '\t')"
additional_url=url.list
# Construct listing.txt from url.list
# The list of archived pages, including some wildcard url
@tommcfarlin
tommcfarlin / ajax-reg.js
Last active August 26, 2017 14:08 — forked from csknk/ajax-reg.js
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@slushman
slushman / jquery-datepicker-wp-admin
Last active October 19, 2022 14:25
How to Add the jQuery UI Datepicker to the WordPress Admin
/**
* Adds the datepicker settings to the admin footer.
* Only loads on the plugin-name settings page
*/
function admin_footer() {
$screen = get_current_screen();
if ( $screen->id == 'settings_page_plugin-name' ) {
@bekarice
bekarice / wc-free-checkout-fields.php
Last active October 31, 2021 19:10
Simplify WooCommerce checkout fields for free checkouts
<?php // only copy if needed
/**
* Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment.
*
* REQUIRES PHP 5.3+
*
* Tutorial: http://skyver.ge/c
*/
function sv_free_checkout_fields() {
@Aziz-Rahman
Aziz-Rahman / ajax-registration.js
Last active September 17, 2020 21:11
Register user with ajax (WP)
jQuery(document).ready(function($) {
/**
* When user clicks on button...
*
*/
$('#btn-new-user').on("click",function() {
/**
* Prevent default action, so when user clicks button he doesn't navigate away from page
@bekarice
bekarice / wc-memberships-change-restricted-price.php
Last active February 4, 2019 22:42
WooCommerce Memberships: Change the price for purchase-restricted products that non-members will see
<?php
/**
* Modify membership product pricing display for non-members
* changes pricing display if purchasing is restricted to members;
* active members will see the price instead of a message
*
* @param string $price the WC price HTML
* @return string $price the updated price HTML
*/
function sv_change_member_product_price_display( $price ) {
@bananana
bananana / wp-update.sh
Last active March 26, 2025 18:13
Bash script to run automatic updates and backups using wp-cli
#!/bin/bash
#
# Backup and update WordPress using wp-cli
#
# Set the -e shell option so the script exits immediately if any command within
# it exits with a non-zero status.
set -e
# Set PATH environment variable
@asharirfan
asharirfan / remove-woocommerce-select2-styles-scripts.php
Last active February 19, 2018 14:40
This function removes select2 JS and CSS of WooCommerce so that theme can use its own.
<?php
if ( ! function_exists( 'remove_select2_wc' ) ) {
/**
* remove_select2_wc.
*
* This function removes select2 JS and CSS so that
* theme can use its own.
*/
function remove_select2_wc() {