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> | |
var parentWindow = window.parent; | |
// Create our stylesheet | |
var style = parentWindow.document.createElement('style'); | |
style.innerHTML = `#YOUR_SELECTOR_HERE {max-width: 100% !important; padding: 0; overflow: hidden; }`; | |
// Get the first script tag | |
var ref = parentWindow.document.querySelector('script'); |
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 Netflify tag to GForms | |
add_filter( 'gform_form_tag', 'form_tag_netlify', 10, 2 ); | |
function form_tag_netlify( $form_tag, $form ) { | |
$form_name = $form['title']; | |
$form_tag = str_replace( "<form ", "<form name='{$form_name}' data-netlify='true' action='/pages/success' ", $form_tag ); | |
return $form_tag; | |
} |
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
// Change "_2" to the ID of the form | |
add_action( 'gform_after_submission_2', 'add_to_awardpost', 10, 2 ); | |
function add_to_awardpost($entry, $form) { | |
// Create the variables | |
$facility_name = rgar($entry, '1' ); | |
$primary_contact_name = rgar($entry, '2' ); | |
$primary_contact_title = rgar($entry, '3'); | |
$primary_contact_email = rgar($entry, '4'); |
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 | |
// Click to tweet functionality. Look for the username and hashtags at the end of the string. | |
$main_question = get_the_title(); | |
$twitter_quote = get_field('twitter_quote'); | |
?> | |
<div class="tweet-this"> | |
<a class="click-tweet" href="http://twitter.com/share?text=<?php echo html_entity_decode($main_question); ?> "<?php if($twitter_quote) { echo urlencode($twitter_quote); } ?>" via <?php echo $fullname . ' ' . $twitter_handle; ?>&url=<?php echo $roundup_permalink; ?>&hashtags=backswing @getbackswing" target="_blank"> | |
Click to Tweet | |
</a> |
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
<a href=(["'])(?:(?=(\\?))\2.)*?\1> |
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_filter( 'woocommerce_variation_option_name', 'display_price_in_variation_option_name' ); | |
function display_price_in_variation_option_name( $term ) { | |
global $wpdb, $product, $woocommerce; | |
if ( empty( $term ) ) return $term; | |
if ( empty( $product->get_id() ) ) return $term; | |
$result = $wpdb->get_col( "SELECT slug FROM {$wpdb->prefix}terms WHERE name = '$term'" ); |
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
jQuery( document ).ready( function( $ ) { | |
var $menu = $('#menu'), | |
$menulink = $('.menu-link'), | |
$menuTrigger = $('.has-submenu > a'); | |
$menulink.click(function(e) { | |
e.preventDefault(); | |
$menulink.toggleClass('active'); | |
$menu.toggleClass('active'); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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_filter('the_content', 'my_nofollow'); | |
add_filter('the_excerpt', 'my_nofollow'); | |
function my_nofollow($content) { | |
return preg_replace_callback('/<a[^>]+\\.pdf/', 'my_nofollow_callback', $content); | |
} | |
function my_nofollow_callback($matches) { | |
$link = $matches[0]; | |
$link = preg_replace("%(href=\S(?!$link))%i", 'rel="nofollow" $1', $link); | |
return $link; | |
} |
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 | |
function simple_pagination($pages = '', $range = 2){ | |
$showitems = ($range * 2)+1; | |
global $paged; | |
if(empty($paged)) $paged = 1; | |
if($pages == '') | |
{ |
NewerOlder