Skip to content

Instantly share code, notes, and snippets.

View jillmugge's full-sized avatar

Jill jillmugge

View GitHub Profile
@jillmugge
jillmugge / Select the Facebook Image
Last active March 26, 2016 16:59
Select the Facebook Image to use as thumbnail. Check Facebook results here: https://developers.facebook.com/tools/debug/og/object/ Place code below in functions.php, then call function in <head></head>
<?php
function facebook_thumbnail(){
echo '<meta property="og:image" content="http://jmgmarketinggroup.com/jmg/wp-content/uploads/JMG-Logo-v4.png" />
<meta property="og:type" content="website" />
<meta property="og:title" content="JMG Marketing Group | Dedicated to Building Websites that Pay for Themselves" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon" >
';
@jillmugge
jillmugge / filter <p> tags
Created April 22, 2014 14:56
filter <p> on images
<?php
//filter <p> on images
function filter_ptags_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
@jillmugge
jillmugge / Making LoopBuddy compatible
Created April 22, 2014 14:58
Making LoopBuddy compatible with other themes
<?php
//LoopBuddy Support. Place in functions.php
add_theme_support('loop-standard');
if ( ! function_exists( 'dynamic_loop' ) ) {
function dynamic_loop() {
global $dynamic_loop_handlers;
if ( empty( $dynamic_loop_handlers ) || ! is_array( $dynamic_loop_handlers ) )
return false;
ksort( $dynamic_loop_handlers );
@jillmugge
jillmugge / PODS & LB Images
Created April 22, 2014 14:59
Adding Img from PODS via LB
<?php
//adding images from Pods to Loopbuddy
add_shortcode('jmg_custom_image_before', 'get_custom_field_1');
function get_custom_field_1() {
global $post;
return '<a href="'.get_post_meta($post->ID, "before_lightbox.guid", true).'" rel="themeblvd_lightbox[before]" title="'.get_post_meta($post->ID, "before_image_title", true).'"><img src="'.get_post_meta($post->ID, "before.guid", true).'" class="before-image"></a>';
}
@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 . '" />';
@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 / remove <p> tags
Created April 22, 2014 15:03
Remove <p> tags from content
remove_filter ('the_content', 'wpautop');
@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 / 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 / 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;