This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Drop wp-config-local.php into local site's root dir. | |
// Get connection info from Pantheon project. | |
define('DB_NAME', ''); | |
define('DB_USER', ''); | |
define('DB_PASSWORD', ''); | |
// Use HOST:PORT from Pantheon. | |
define('DB_HOST', ''); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop this in theme's functions.php file. | |
// Use shortcode [path_theme] from visual editor. | |
function custom_shortcode_path_theme( $atts ){ | |
return get_stylesheet_directory_uri(); | |
} | |
add_shortcode( 'path_theme', 'custom_shortcode_path_theme' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accessibility fixes for WordPress Google Language Translator plugin. | |
// Found on WP repo here: https://wordpress.org/plugins/google-language-translator/ | |
// Wait for jQuery to be ready... | |
// Grab and test for main wrap inserted before script runs. | |
var glt = document.getElementById('google_language_translator'); | |
if ( $(glt).length ) { | |
// Allow time for plugin to render. | |
setTimeout( function (){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a wrapper to any YouTube video. Depends on jQuery. | |
if ( $('iframe[src*="youtube."]').length ) { | |
$('iframe[src*="youtube."]').each( function () { | |
// Use the video's specified width as a max so we don't stretch. | |
var width = $(this).attr('width'); | |
$(this).wrap('<div class="video-wrap" style="max-width:'+width+'px;"><div class="inner"></div></div>'); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fix WP shortcode breaks. | |
function wpex_fix_shortcodes($content){ | |
$array = array ( | |
'<p>[' => '[', | |
']</p>' => ']', | |
']<br />' => ']' | |
); | |
$content = strtr($content, $array); | |
return $content; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add format dropdown for MCE. | |
add_filter( 'mce_buttons_2', 'my_mce_editor_buttons' ); | |
function my_mce_editor_buttons( $buttons ) { | |
array_unshift( $buttons, 'styleselect' ); | |
return $buttons; | |
} | |
// Add SMALL and LEAD (from Bootstrap) text options. | |
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' ); | |
function my_mce_before_init( $settings ) { | |
$style_formats = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// If running on localhost, don't bother with GA init. | |
if ( document.location.hostname !== "localhost" ) { | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-XXXXXXXX-X', 'your-site.com'); | |
ga('send', 'pageview'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setEqualRows = function(){ | |
$('[data-equal-row]').each(function(){ | |
var items = $(this).find('[data-equal-item]'), | |
maxHeight = 0; | |
items.css('min-height','auto'); | |
setTimeout(function(){ | |
items.each(function(){ | |
var thisHeight = $(this).outerHeight(); | |
console.log(thisHeight); | |
maxHeight = (thisHeight > maxHeight)? thisHeight : maxHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Manage click/focus states for CTA with inner link. | |
var setWrapCTAs = function (event) { | |
var wrap = $('[data-cta-wrap]'), | |
link = wrap.find('[data-cta-link]'); | |
// Clicking on CTA wrapper triggers internal link. | |
wrap.on('click', function(e) { | |
e.preventDefault(); | |
var path = $(this).find('[data-cta-link]').attr('href'); | |
if ( path !== "" ) { | |
window.location = path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register the shortcode. | |
function my_custom_shortcode( $atts ) { | |
extract( shortcode_atts( | |
array( | |
'arg1' => '', | |
'arg2' => '' | |
), $atts ) | |
); | |
$output = "Whatever you need your shortcode to do..."; | |
return $output; |
OlderNewer