Skip to content

Instantly share code, notes, and snippets.

View pbrocks's full-sized avatar

Paul Barthmaier pbrocks

View GitHub Profile
@pbrocks
pbrocks / add--to--customizations--plugin.php
Last active February 27, 2018 00:10
Add to Active theme's folder as account.php in paid-memberships-pro/pages folder as a replacement for the Paid Memberships Pro pmpro_account shortcode created in the shortcodes folder of the main plugin, which will detect if PMPro Members Directory Add On or Theme My Login are active and redirect profile to either before redirecting to dashboard…
<?php
/**
* Add to your PMPro Customizations plugin -- Note: you only need the code below, not the first 4 lines.
*/
function check_pmpro_account_page() {
$account_page = get_theme_file_path( 'paid-memberships-pro/pages/account.php' );
if ( file_exists( $account_page ) ) {
require( $account_page );
}
}
@pbrocks
pbrocks / .htaccess
Created February 27, 2018 03:06 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#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/
@pbrocks
pbrocks / .htaccess
Created February 27, 2018 03:06 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#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/
@pbrocks
pbrocks / countries.json
Created February 28, 2018 21:27 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@pbrocks
pbrocks / pmpro-gettext-filter.php
Last active March 9, 2018 00:27
Get text filter that replaces text strings with a string customized by the administrator.
/**
* Testing if this is synced or embedded
*
*/
add_filter( 'gettext', 'my_pmpro_gettext_changes', 20, 3 );
function my_pmpro_gettext_changes( $translated_text, $text, $domain ) {
$original = 'Drag and drop membership levels to reorder them on the Levels page.';
$replacement = 'Whatever I want to replace that text with';
$text_domain = 'paid-memberships-pro';
if ( $text_domain === $domain ) {
@pbrocks
pbrocks / my-pmpro-levels-array.php
Last active March 13, 2018 19:49 — forked from strangerstudios/my_pmpro_levels_array.php
Use pmpro_levels_array filter to remove specific levels from your levels array. In this case, we are removing Free levels, leaving only paid levels to be returned to your PMPro levels array.
/**
* The function my_pmpro_levels_array is an arbitrarily named function, which
* you can rename to something more meaningful, as long as it is uniquely
* named on this site.
*
* @param array $levels Input the array of levels from your site
* @return array Output all paid levels, ie NOT the free level(s)
*/
function my_pmpro_levels_array( $levels ) {
$newlevels = array();
@pbrocks
pbrocks / notes.md
Created March 18, 2018 11:17 — forked from GaryJones/notes.md
Add PHPCS + WPCS to Sublime Text 3

Install PHP_CodeSniffer (PHPCS) via git

You can use the .phar for PHPCS, but it's easier to pull the repo down from git to then choose what version to use.

cd ~
mkdir -p code
cd code
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
@pbrocks
pbrocks / js.js
Created March 18, 2018 12:39 — forked from GaryJones/js.js
Gravity Forms Countries dropdown with country codes
var countryCodes = {
'Afghanistan': '93',
'Albania': '355',
'Algeria': '213',
'American Samoa': '684',
'Andorra': '376',
'Angola': '244',
'Antigua and Barbuda': '1-268',
'Argentina': '54',
'Armenia': '374',
@pbrocks
pbrocks / icons.json
Created March 18, 2018 12:39 — forked from GaryJones/icons.json
Font Awesome 4.1.0 icons as JSON
{
"icons": [
{
"name": "Glass",
"id": "glass",
"unicode": "f000",
"created": 1,
"categories": [
"Web Application Icons"
]

Config Files

Development-related files that might be found in version-controlled projects. Doesn't include editor-specific files.

Files

  • .editorconfig - EditorConfig define and maintain consistent coding styles between different editors and IDEs.
  • .gitignore - ignore files from version control. Note, don't add system files - contributors should be globally ignoring these on their local machines. Only use for files created during project build, credentials files etc.