Skip to content

Instantly share code, notes, and snippets.

View maddisondesigns's full-sized avatar

Anthony Hortin maddisondesigns

View GitHub Profile
@maddisondesigns
maddisondesigns / change-db-collation.php
Last active August 26, 2021 09:09
Change the Collation of all tables in a WordPress Database. Will try to extract Database details from wp-config.php file.
<?php
/*
* Change the Collation of all tables in a WordPress Database
*
* WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
* Take a backup first, and carefully test the results of this code.
* USE OF THIS SCRIPT IS ENTIRELY AT YOUR OWN RISK. I/We accept no liability from its use.
*
* USE:
* Simply place this script in the root of your WordPress site and run it from your browser.
@maddisondesigns
maddisondesigns / create-wp-admin.php
Created October 4, 2017 01:10
Create a new WordPress Administrator User
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
// Original script by Joshua Winn - https://joshuawinn.com/create-a-new-wordpress-admin-user-from-php
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
@maddisondesigns
maddisondesigns / functions.php
Last active May 7, 2021 16:34
Update the version number on child theme stylesheet that's been enqueued from Parent theme
<?php
/**
* If you have a child theme that has had its stylesheet enqueued from within the main Parent theme,
* and you wish to update the version number that’s appended to the url, you can include this in your
* child theme functions.php file.
*
* Obviously, change the version number (‘6.0.0’ in this example) to whatever is appropriate for you,
* along with comparing the approriate stylesheet handle ('ephemeris-style' in this example)
*
* Where:
@maddisondesigns
maddisondesigns / CSV Product Import.csv
Last active October 15, 2020 08:20
WooCommerce Product CSV Import Schema
ID Type SKU Name Published Is featured? Visibility in catalog Short Description Description Date sale price starts Date sale price ends Tax Status Tax Class In stock? Backorders allowed? Sold individually? Weight (unit) Length (unit) Width (unit) Height (unit) Allow customer reviews? Purchase Note Price Regular Price Stock Categories Tags Shipping Class Attribute 1 Name Attribute 1 Value(s) Attribute 1 Default Attribute 1 Visible Images Download 1 Name Download 1 URL Download Limit Download Expiry Days Parent Upsells Cross-sells
id type sku name status featured catalog_visibility short_description description date_on_sale_from date_on_sale_to tax_status tax_class stock_status backorders sold_individually weight length width height reviews_allowed purchase_note price regular_price manage_stock / stock_quantity category_ids tag_ids shipping_class_id attributes attributes default_attributes attributes image_id / gallery_image_ids downloads downloads download_limit download_expiry parent_id upsell_ids cross_sell_
@maddisondesigns
maddisondesigns / functions.php
Created September 29, 2014 08:20
Custom Gravity Forms Dropdown Validation
<?php
/**
* Custom Gravity Forms validation. Make sure the form isn't submitted with the default dropdown values
* Useful for when your Gravity Form is displaying default values instead of the field labels.
*
* Tie our validation function to the 'gform_validation' hook. Since we've appended _1 to the filter name (gform_validation_1)
* it will only trigger on form ID 1. Change this number if you want it to trigger on some other form ID.
* There's no sense in running this function on every form submission, now is there!
*
@maddisondesigns
maddisondesigns / functions.php
Created May 22, 2019 08:01
Ephemeris Theme - Filter our social icons to add an email icon on the end
<?php
/**
* Filter our social icons to add an email icon on the end
*/
function ephemeris_add_email_to_social_icons( $social_list ) {
$social_list[] = sprintf( '<li class="%1$s"><a href="%2$s" title="%3$s"><i class="%4$s"></i><span class="assistive-text">%3$s</span></a></li>',
'email',
esc_url( home_url( '/contact' ) ),
__( 'Get in touch', 'ephemeris' ),
'far fa-envelope'
@maddisondesigns
maddisondesigns / functions.php
Last active May 7, 2019 08:03
Hide the progress count on the Site Health screen
<?php
/**
* Hide the progress count on the Site Health screen
*/
function mytheme_load_custom_wp_admin_style() {
$current_screen = get_current_screen();
if ( strpos( $current_screen->base, 'site-health' ) === false ) {
return;
} else {
@maddisondesigns
maddisondesigns / blocks-style.css
Last active April 23, 2019 07:22
Load CSS to style the (Gutenberg) Block Editor like the front-end
/*
Theme Name: Ephemeris
Description: Used to style the Block Editor (Gutenberg)
*/
/* Custom Colours */
/* Eclipse */
.edit-post-visual-editor .has-eclipse-background-color {
background-color: #3a3a3a;
}
@maddisondesigns
maddisondesigns / common.js
Last active April 6, 2019 19:01
Close all the Divi accordions on page load. Works with Divi 2.5 and above
/**
* Toggle the class on the accordion so that they're all closesd on page load
*/
jQuery( document ).ready( function( $ ) {
$(function() {
$(".et_pb_accordion .et_pb_toggle_open").addClass("et_pb_toggle_close").removeClass("et_pb_toggle_open");
$(".et_pb_accordion .et_pb_toggle").click(function() {
$this = $(this);
setTimeout(function() {
@maddisondesigns
maddisondesigns / functions.php
Last active March 25, 2019 21:48
Remove the annoying Wordfence Notifications on plugin updates and plugin activation
<?php
/*
* Remove the annoying Wordfence Notifications. Tested with Wordfence v6.3.2
*/
class ahRWN_Remove_Wordfence_Notification {
private $wordfencePluginFile;
public function __construct() {
$this->wordfencePluginFile = "wordfence/wordfence.php";
register_activation_hook( $this->wordfencePluginFile, array( $this, 'rwn_remove_wordfence_notifications_on_activation' ) );