View Using a Logged State Object
(function ($) {
$(document).ready(function ($) {
var mz_mbo_state = {
logged: mz_mindbody_schedule.loggedMBO, // from php
html: undefined,
target: undefined,
siteID: undefined,
nonce: undefined,
View convert googleDoc to CSV
"""
Import Google Doc and export to CVS formatted for WP import.
Python3
First use Requests to get the file as recommended: http://www.madhur.co.in/blog/2016/05/13/google-docs-spreadsheet.html
Check to make sure that the file headers are what we expect and if not, exit.
If headers do match, create rows in the new file, matching the needed columns with those from the import.
View acf-polylang.php
<?php
add_filter('pll_get_post_types', 'wearewp_add_acf_pll', 10, 2);
function wearewp_add_acf_pll( $post_types, $is_settings ) {
$post_types[] = 'acf-field-group';
return $post_types;
}
View composer-private-package-github-token.md

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

View Pupulate Donor Perfect Checkboxes Based on Query String Parameter
<script>
// Get the parameter from the Query String
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
View Useful WP Plugins
simply-show-hooks
contact-form-7
contact-form-7-honeypot
custom-post-type-ui
debug-bar
duplicate-post
get-tweets-in-php
tinymce-advanced
tailor
really-simple-csv-importer
View fbcrosssection.py
#!/usr/bin/python
"""
Compare two small csv files and create two new files, one with matches, the other which don't match.
I use it here to to get the names and email addresses from "personal" FB friends which are in a specific group.
It loops the group and pulls matches from the friends list, so that only group members whom are also found in the
friends list will be included in the GroupFriends list.
A hipper, more efficient approach is found here: https://stackoverflow.com/a/23090697/2223106
"""
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/
View taxonomy-breadcrumbs.php
<?php
if( !function_exists( 'inspiry_get_breadcrumbs_items' ) ) :
/**
* Returns a array of breadcrumbs items
*
* @param $post_id int Post id
* @param $breadcrumbs_taxonomy string Taxonomy name
* @return mixed|void
*/
function inspiry_get_breadcrumbs_items( $post_id, $breadcrumbs_taxonomy ) {
View docker-sql-dump-restore
function dumpdb()
{
# source https://stackoverflow.com/a/46042938/2223106
# source https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb
local wkdir=`basename $PWD`
local container='echo ${wkdir}_my-wpdb_1'
docker exec ${container} mysqldump -uroot --password=password wordpress > backup.sql
}
function restoredb()