Skip to content

Instantly share code, notes, and snippets.

@campaignupgrade
campaignupgrade / donation_thank_you_ga_fill.html
Last active February 27, 2017 03:54 — forked from salsalabs/donation_thank_you_ga_fill.html
Send donatoin_KEY and amount to Google Analytics (GA) from the thank you page that follows a successful donation in Salsa.
<script>
// Script to retrieve donation_KEY and amount from the URL and send
// them to Google Anaylitics eCommerce.
// See https://salsasupport.zendesk.com/entries/98811317
var m = /donation_KEY=(\d+)/.exec(window.location.search);
var donation_KEY = (m != null) ? donation_KEY = m[1] : 'Unknown';
var m = /amount=(\d+)/.exec(window.location.search);
var amount = parseFloat(window.location.href.split("amount=")[1].split('&'));
(function(i, s, o, g, r, a, m) {
UPDATE `wp_options`
SET `option_value` = 'a:22:{s:8:\"filepath\";s:128:\"/Users/slam_13/sites/to4/wp-content/uploads/wpallimport/uploads/d9a9d7a00a52a270a15df2eb4f515b83/xml_articles_10_14_10_40_PM.xml\";s:6:\"source\";s:214:\"a:4:{s:4:\"name\";s:31:\"xml_articles_10_14_10_40_PM.xml\";s:4:\"type\";s:6:\"upload\";s:4:\"path\";s:85:\"/wpallimport/uploads/d9a9d7a00a52a270a15df2eb4f515b83/xml_articles_10_14_10_40_PM.xml\";s:12:\"root_element\";s:3:\"row\";}\";s:9:\"feed_type\";s:0:\"\";s:15:\"update_previous\";s:1:\"3\";s:16:\"parent_import_id\";s:1:\"0\";s:5:\"xpath\";s:4:\"/row\";s:7:\"options\";s:9795:\"a:191:{s:4:\"type\";s:4:\"post\";s:21:\"is_override_post_type\";i:0;s:15:\"post_type_xpath\";s:0:\"\";s:8:\"deligate\";s:0:\"\";s:11:\"wizard_type\";s:3:\"new\";s:11:\"custom_type\";s:16:\"to4_article_post\";s:14:\"featured_delim\";s:1:\",\";s:10:\"atch_delim\";s:1:\",\";s:25:\"is_search_existing_attach\";s:1:\"0\";s:15:\"post_taxonomies\";a:2:{s:8:\"category\";s:154:\"[{\"item_id\":\"1\",\"left\":2,\"right\":5
# Attempt to load files from production if they're not in our local version
# https://stevegrunwell.com/blog/keeping-wordpress-under-version-control-with-git/
# or, option for main htaccess:
# RewriteCond /your/docroot/%{REQUEST_FILENAME} !-f
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Replace URL with the production site's domain name
#!/bin/bash
GIT_WORK_TREE=/path/to/web git checkout -f
@campaignupgrade
campaignupgrade / WPAllImport disable check duplicates
Last active January 4, 2018 00:00
WpAllImport skip dupe check
add_filter( 'wp_all_import_is_check_duplicates', 'wpai_is_check_duplicates', 10, 2 );
function wpai_is_check_duplicates( $is_check_duplicates, $import_id ) {
return false;
}
Source Joomla website renders correctly:
http://www.truth-out.org/article/item/42794
In Joomla content in MySQL before export:
<div><span class="wf_caption" style="display: block; max-width: 640px; width: 100%;"><img src="http://www.truth-out.org/images/Images_2017_12/2017_1204td1.jpg" alt="(Image: Muhammad Ansi, Untitled (Pier), 2016.)" width="640" style="width: 100%; margin: auto;" /><span style="margin-top: 3px; display: block;">(Image: <a href="https://www.artfromguantanamo.com/muhammad-ansi-1/" >Muhammad Ansi</a>, Untitled [Pier], 2016.)</span></span></div>
<div>&nbsp;</div>
In XML export file:
DATE(booking_time) <= '2012-12-28'
@campaignupgrade
campaignupgrade / App.php
Last active April 14, 2018 04:45
Multiple values in an array variable in Sober Controller (Sage 9)
// in controller
public function homepageFields() {
return array (
$subheading => get_field('subheading'),
$video = get_field('video_link')
)
}
@campaignupgrade
campaignupgrade / README-Sage-9-to-WPEngine.md
Last active April 28, 2018 03:29 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Sage 9 to WPEngine Deployment setup

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->