Skip to content

Instantly share code, notes, and snippets.

View jillmugge's full-sized avatar

Jill jillmugge

View GitHub Profile
@jillmugge
jillmugge / new_gist_file-v2.php
Created June 2, 2017 15:41
Add FB Pixel to head via functions.php for WP to exclude your IP address in FB metrics
add_action( 'wp_head', 'child_theme_head_script' );
function child_theme_head_script() {
if ( $_SERVER['REMOTE_ADDR'] != '73.153.255.49' ) {
?>
<!--Facebook Pixel Code-->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
@jillmugge
jillmugge / function.php
Last active October 13, 2016 17:42
Hero full browser screen image. Add #hero to img. enqueue script in functions.php
//Enqueue
add_action( 'wp_enqueue_scripts', 'jmg_enqueue_all' );
function jmg_enqueue_all() {
wp_register_script( 'hero', get_stylesheet_directory_uri().'/js/hero.js');
wp_enqueue_script('hero', get_template_directory_uri().'/js/hero.js', array('jquery'), false, true);
}
@jillmugge
jillmugge / functions.php
Last active October 13, 2016 15:04
Adding a Child Theme to Divi style.css and functions.php. Add a child folder in /wp-content/themes/..
<?php
add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );
function my_enqueue_assets() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
@jillmugge
jillmugge / shrink-header.css
Created March 10, 2016 14:29
This is my alternative to Nathan's shrinking header
.header {
background-color:rgba(255, 255, 255, 0.7);
position: fixed;
width: 100%;
z-index: 1;
}
/* Second Module Offset */
.hero-text {
@jillmugge
jillmugge / fixed-cover.css
Created March 10, 2016 14:24
fixed position doesn't work well with bg-size cover in css. this is an alternative using jQ
.hero-image {
background: url('http://dev.jmgmarketinggroup.com/arete/wp-content/uploads/Hero-v5.jpg') no-repeat;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
background-size:cover;
min-height:700px;
/*min-width:100%;*/
background-attachment:scroll;
background-position: bottom right;
@jillmugge
jillmugge / gzip .htaccess
Created August 28, 2014 19:36
increase page speed by enabling gzip compression . Add to .htaccess in WordPress
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
@jillmugge
jillmugge / 0_reuse_code.js
Created April 22, 2014 15:13
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
@jillmugge
jillmugge / remove <p> tags
Created April 22, 2014 15:03
Remove <p> tags from content
remove_filter ('the_content', 'wpautop');
@jillmugge
jillmugge / Tblvd - modify meta data
Created April 22, 2014 15:02
Themeblvd - Modify Meta Data
<?php
/*-----------------------------------------------------------------------------------*/
/* MODIFY META DATA
/*
/* This function will remove the default meta data from the theme.
/* You can specify your own text below in the my_custom_meta_information area.
/*-----------------------------------------------------------------------------------*/
function my_custom_meta_information(){
?>
@jillmugge
jillmugge / LoremPixel shortcode
Created April 22, 2014 15:01
Building a Shortcode for Lorempixel
// http://lorempixel.com/
// [phpic width="300" height="200"]
<?php
function grab_random_picture($atts){
extract(shortcode_atts(array(
'width' => 400,
'height' => 300,
), $atts));
return '<img src="http://lorempixel.com/'. $width . '/' . $height . '" />';