Skip to content

Instantly share code, notes, and snippets.

View aschweigert's full-sized avatar

Adam Schweigert aschweigert

View GitHub Profile
<span class="section-lead">Sometimes there is intro text such as lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat, nunc non porta placerat, leo justo posuere justo, at mollis velit odio at mauris.</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat, nunc non porta placerat, leo justo posuere justo, at mollis velit odio at mauris. <strong>Bold text is very bold</strong> and <em>italic text is rendered in italics</em> and <em><strong>bold italics, yep we have that, too</strong></em>. <del>Strikethrough</del>.
Duis ac dapibus risus, eu semper dolor. Sed pretium massa odio, non dictum est fermentum vel. Cras laoreet mattis lorem et eleifend. Suspendisse mauris dui, mollis in velit eget, fringilla fringilla tortor. Etiam aliquam posuere lacus, tempor elementum neque fermentum sed. Cras eget mattis mi, sed vehicula odio. Sed tincidunt eget neque sed sodales. Donec vehicula in arcu venenatis elementum.
<h3 class="subheader">Here Is A Subhead</h3>
Ut effic
@aschweigert
aschweigert / chart-styles.md
Last active May 25, 2018 15:14
Post Inline Elements

Styles exist to add headlines, credits and captions to charts.

To use these you'll need to wrap the entire chart in a <section> tag with the .inline-element and .chart classes:

<section class="inline-element chart">

Then you can use:

Setup

To work on this project locally, you'll need to do the following:

  • Make sure you have a couple prereqs installed on your computer
  • Install Virtualbox, Vagrant, VVV and VV
  • Create a new WP site using VV
  • Download a copy of the live site's db and add it to our local site.
  • Install a couple VIP specific things
  • Start working on the site
add_filter( 'dfw_network_code', 'mj_dfp_network_code' );
add_filter( 'dfw_breakpoints', 'mj_dfp_breakpoints' );
add_filter( 'dfw_targeting_criteria', 'mj_dfp_targeting' );
add_filter( 'dfw_mappings', 'mj_dfp_mapping' );
function mj_dfp_network_code() {
return 49189977;
}
function mj_dfp_breakpoints( $breakpoints ) {
$mj_breakpoints = array(
array(
@aschweigert
aschweigert / 0_reuse_code.js
Created April 6, 2016 17:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aschweigert
aschweigert / gist:9dd8391d7c47cbe11c80
Last active February 3, 2016 20:52
set featured images to false before X date
drop temporary table if exists post_ids;
create temporary table if not exists post_ids
select ID from wp_14_posts
where post_status = 'publish'
and post_type = 'post'
and post_date < '2016-02-03 00:00:000';
delete wp_14_postmeta from wp_14_postmeta join post_ids
on wp_14_postmeta.post_id = post_ids.ID
and wp_14_postmeta.meta_key = 'featured-image-display';
insert into wp_14_postmeta (post_id, meta_key, meta_value)
//least destructive, just update ones set to the old default
UPDATE wp_43_postmeta
SET meta_value = 'none'
WHERE meta_key = 'custom_sidebar' AND meta_value = 'sidebar-single'
//OR set them all to "none"
UPDATE wp_43_postmeta
SET meta_value = 'none'
WHERE meta_key = 'custom_sidebar'
@aschweigert
aschweigert / gist:334bbd5421c6a606f7f2
Created November 3, 2014 17:24
WPE DNS for new site
Email member and have them create (or change) the A record for the domain they want to use to point to 50.116.39.12
Then, in the WP Engine dashboard:
- click on the property name and then "domains"
- click on "add new domain" and enter the domain you want to add, at this stage you can also redirect other domains to the domain you're adding (e.g. citylimits.largoproject.org or www.citylimits.org) and it will pass these through to the primary domain you've added
In the WP Admin:
- from My Sites > Network Admin > Settings > Domains under "new domain" add the site ID and the domain you want to map to that site ID ("primary" should not be checked)
add_filter('wpmu_validate_user_signup','nd_validate_user_signup',10,3);
add_filter('signup_extra_fields','nd_extra_fields',10,1);
add_filter('add_signup_meta','nd_add_signup_meta');
add_action('wpmu_activate_user','nd_wpmu_activate_user', 10, 3);
function nd_extra_fields ($result) {
$first_name = ( isset( $_POST['first_name'] ) ) ? $_POST['first_name']: '';
$last_name = ( isset( $_POST['last_name'] ) ) ? $_POST['last_name']: '';
$error_msgs = $result->errors;
?>
@aschweigert
aschweigert / gist:f5dd03e04bea91797c0c
Last active December 29, 2015 14:29
Standalone WP -> Multisite migration queries
[prefix] is needed to push the new users/usermeta values outside of the range already populated in the database, usually for a site with an ID of 40 using 40,000 will work pretty well (unless some of your sites have a lot of users).
UPDATE wp_users
SET ID = ID + [prefix]
// Add two columns to the end of the wp_users table, spam and deleted. Both are TINYINT(2).
UPDATE wp_usermeta
SET user_id = user_id + [prefix]