Skip to content

Instantly share code, notes, and snippets.

Avatar

Theuns Coetzee ipokkel

View GitHub Profile
@salcode
salcode / .gitignore
Last active Jan 26, 2021
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@ScottPhillips
ScottPhillips / .htaccess
Created Feb 2, 2012
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@jareware
jareware / SCSS.md
Last active Jan 21, 2021
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do
View SCSS.md

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

View my_pmpro_automatic_discount_application.php
<?php
// Copy from below here
/**
* Automatically applies discount code for users switching from a level in a set of given levels.
* Useful for giving discounts to members upgrading their memberships.
* To use, make sure to update the first 2 variables in each function.
*/
function my_pmpro_automatic_discount_application() {
@dparker1005
dparker1005 / my_hook_analizer_widget_function.php
Last active Jan 18, 2021
See all functions hookoing into login_redirect hook
View my_hook_analizer_widget_function.php
<?php
// Copy from below here...
/*
* See all functions hookoing into login_redirect hook
*/
function my_hook_analizer_widget_function( $post, $callback_args ) {
print_filters_for( 'login_redirect' );
}
View README.md

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@strangerstudios
strangerstudios / custom_addon_package_prices.php
Created Mar 22, 2016
Charge different prices for different membership levels with PMPro and PMPro Addon Packages.
View custom_addon_package_prices.php
/*
Charge different prices for different membership levels.
*/
//global var to store the price configurations
global $custom_addon_package_prices;
$custom_addon_package_prices = array(
//post_id => array(level_id => price, level_id => price, ...)
353 => array(1 => 1500, 2 => 1000, 3 => 500)
);
@ipokkel
ipokkel / my-pmprorh-read-only.php
Last active Jan 8, 2021
Set Register Helper field to read only for members but not administrators or membership managers with the readonly field option.
View my-pmprorh-read-only.php
<?php
/**
* This recipe creates a custom fields for membership registration
* that is readonly on the user edit profile for members and
* editable by administrators or users with the membership manager role.
*
* This recipe assumes that the registration field is required during checkout.
*
* @requires Register Helper Add On
* @link https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
@dparker1005
dparker1005 / pmprorh_required_date.php
Created Dec 17, 2020
A workaround for requiring that users fill out the RH Date field. Fails checkout if date is still the same as today's date.
View pmprorh_required_date.php
<?php
// Copy from below here...
/**
* Add a "Birthday" field via Register Helper.
*/
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
@strangerstudios
strangerstudios / my_pmpro_mailchimp_listsubscribe_fields.php
Last active Jan 4, 2021
Example of using the pmpro_mailchimp_listsubscribe_fields filter to send extra fields to MailChimp.
View my_pmpro_mailchimp_listsubscribe_fields.php
/*
Sync fields to MailChimp
*/
function my_pmpro_mailchimp_listsubscribe_fields($fields, $user)
{
$new_fields = array(
"TITLE" => $user->title,
"COMPANY" => $user->company,
"ADDRESS" => $user->address,
"CITY" => $user->city,