Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / functions.php
Last active May 23, 2018 15:09
Wordpress - bring in custom scripts and stylesheets on each page using custom field / page meta
<?php
function tierpoint_styles() {
$parent_style = 'parent_style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ), 90
);
@NickDeckerDevs
NickDeckerDevs / loop.nthoftype.scss
Created May 24, 2018 15:48
Sass Loop using nth of type
&.client-logo-gallery {
@include breakpoint(maxdesktop) {
@for $i from 10 through 20 {
.et_pb_gallery_item:nth-of-type(#{$i}) {
display: none!important
}
}
}
@include breakpoint(phone) {
@for $i from 7 through 20 {
@NickDeckerDevs
NickDeckerDevs / functions.php
Created June 5, 2018 14:18
Using Wordpress with scripts and stylesheets - using functions.php properly
<?php
/* I'll use an example in comments and then how to insert in functions.php below it */
/*
* <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
*/
// give it a name that is unique, then second line arg is the file location, the third agrument is the priority.
wp_enqueue_style(
@NickDeckerDevs
NickDeckerDevs / gscript.gs
Last active June 16, 2018 17:10
google docs script to convert doc to html - used for tierpoint data centers - then emails to your email address after running
// tools -> script editor
// paste this script in. save it and give it a name
// will take a moment to save.
// Run -> Run Function -> ConvertGoogleDocToCleanHtml
function ConvertGoogleDocToCleanHtml() {
var body = DocumentApp.getActiveDocument().getBody();
var numChildren = body.getNumChildren();
var output = [];
@NickDeckerDevs
NickDeckerDevs / webinar-page.php
Created June 18, 2018 15:13
tierpoint webinar page
<?php
if( isset( $_GET ) && isset( $_GET[ 'id' ] ) ) {
$webinar_id = $_GET[ 'id' ];
}
?>
<div class="jsBrightTALKEmbedWrapper" style="width:100%; height:100%; position:relative;background: #ffffff;">
<script class="jsBrightTALKEmbedConfig" type="application/json">
{
"channelId" : 14695,
@NickDeckerDevs
NickDeckerDevs / data-center-display-functions.php
Created June 18, 2018 15:33
displaying all the data center menu on the data center page. does a page search and walks through it
function display_data_centers( $atts, $content ) {
$values = shortcode_atts( array(
// not being used, is in the CSS
// 'columns' => $atts[ 'columns' ],
), $atts );
$html = '<div class="data-center-links auto"><div>';
$state_pages = get_pages( [
'parent' => 93,
'sort_order' => 'ASC',
@NickDeckerDevs
NickDeckerDevs / data-center-display-functions.php
Created June 18, 2018 15:33
displaying all the data center menu on the data center page. does a page search and walks through it
<?php
function display_data_centers( $atts, $content ) {
$values = shortcode_atts( array(
// not being used, is in the CSS
// 'columns' => $atts[ 'columns' ],
), $atts );
$html = '<div class="data-center-links auto"><div>';
$state_pages = get_pages( [
'parent' => 93,
function is_filtered() {
if($('.topic-options > .topic-checkbox').length == $('.topic-options > .topic-checkbox.checked').length && $('.type-options > .type-checkbox').length == $('.type-options > .type-checkbox.checked').length) {
$('.choose-topic-select .filter-all').text('Filters: Show All').removeClass('clear-all')
} else {
$('.choose-topic-select .filter-all').text('Filters: Clear All').addClass('clear-all')
}
}
@NickDeckerDevs
NickDeckerDevs / export.php
Created June 21, 2018 23:37
Export pages by parent page ID
/* get the post ID -- you will edit the code below on line 14 ($new_pages[] = {your post id};)
* open up the live site, edit the file:
* wp-admin/includes/export.php
* search for "grab a snapshot"
* comment out the next line
* $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
* add the following code right below it. Save file, run export, then un-comment
* the original code and delete your inserted code
*/
@NickDeckerDevs
NickDeckerDevs / inview-stuff.html
Last active July 3, 2018 20:16
this script piece is horribly setup and needs refactoring. It loops through the videos on the page and plays them when they come into view. the "view" is a certain section of the viewport to allow for some tolerance.
<style>
video {
width:100%!important;
padding-right
max-width:1200px!important;
height:auto!important;
-webkit-box-shadow: 0 40px 80px 0 rgba(0, 0, 0, .2);
-moz-box-shadow: 0 40px 80px 0 rgba(0, 0, 0, .2);
box-shadow: 0 40px 80px 0 rgba(0, 0, 0, .2);