Skip to content

Instantly share code, notes, and snippets.

View aschweigert's full-sized avatar

Adam Schweigert aschweigert

View GitHub Profile

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
<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:

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: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]
if ( ! function_exists( 'largo_opengraph' ) ) {
function largo_opengraph() {
global $current_url, $post;
// set a default thumbnail, if a post has a featured image use that instead
if ( is_single() && has_post_thumbnail( $post->ID ) ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
$thumbnailURL = $image[0];
} else if ( of_get_option( 'logo_thumbnail_sq' ) ) {
@aschweigert
aschweigert / functions.php
Created July 18, 2012 18:25 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress. (adds support for second level dropdowns)
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );