View gist:6565746
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 | |
// LOGOUT LINK IN MENU | |
function diww_menu_logout_link( $nav, $args ) { | |
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>'; | |
if( $args->theme_location == 'primary' ) { | |
return $nav.$logoutlink ; | |
} else { | |
return $nav; |
View gist:14902f07be81051a1170
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 add_conversion_tracking_code($button, $form) { | |
$dom = new DOMDocument(); | |
$dom->loadHTML($button); | |
$input = $dom->getElementsByTagName('input')->item(0); | |
if ($input->hasAttribute('onclick')) { | |
$input->setAttribute("onclick","ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Mailing List Sign Up', eventLabel: 'Sidebar'});".$input->getAttribute("onclick")); | |
} else { | |
$input->setAttribute("onclick","ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Mailing List Sign Up', eventLabel: 'Sidebar'});"); | |
} | |
return $dom->saveHtml(); |
View gist:a64a4790e00159febe73
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
# redirect http to https | |
server { | |
listen 80; ## listen for ipv4; this line is default and implied | |
listen [::]:80; ## listen for ipv6 | |
server_name dave.pe www.dave.pe; | |
return 301 https://dave.pe$request_uri; | |
} |
View gist:6565910
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 | |
// SEND ACCESS LEVEL TO GRAVITY FORMS | |
function get_access_level(){ | |
global $user_ID; | |
$plan_id = rcp_get_subscription_id( $user_ID ); | |
$access_level = rcp_get_subscription_access_level( $plan_id ); | |
return $access_level; | |
} |
View gist:68fe7e0cf4a10700774f
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 | |
// Don't email webmaster for comment moderation | |
function pref_dont_email_webmaster( $emails, $comment_id ) { | |
$webmaster_email = get_option('admin_email'); | |
if ( $emails[0] == $webmaster_email ) | |
unset($emails[0]); | |
return (array) $emails; | |
} |
View gist:6744477
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 diww_add_post_content($content) { | |
if (is_single()) { | |
$content .= '<p><div id="newsletter-box">Please subscribe to <a title="Do More With WordPress" href="http://www.doitwithwp.com/go/newsletter">our newsletter</a></div></p>'; | |
} | |
return $content; | |
} | |
add_filter ('the_content', 'diww_add_post_content', 0); |
View gist:6745757
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 | |
$show_after_p = 2; | |
$content = apply_filters('the_content', $post->post_content); | |
if(substr_count($content, '<p>') > $show_after_p) | |
{ | |
$contents = explode("</p>", $content); | |
$p_count = 1; | |
foreach($contents as $content) | |
{ | |
echo $content; |
View gist:6746806
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 wp_footer(); ?> | |
<?php if (!$user_ID) : ?> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-9669661-12']); | |
_gaq.push(['_trackPageview']); |
View gist:6565915
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($){ | |
$(".gform_wrapper .disable input").attr('disabled','disabled'); | |
}); |
View gist:6565913
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 | |
// DISABLE CERTAIN FIELDS | |
function enqueue_gf_disable() { | |
wp_enqueue_script( 'gf-disable', plugins_url( '/scripts/gravity-forms-disable.js', dirname(__FILE__) ) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_gf_disable' ); |
NewerOlder