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
# For nginx -- goes in the /sites-available/domainnamehere.com file | |
location ~ /\.git { | |
return 404; | |
#deny all; | |
} | |
# or, all . directories/files in general (including .htaccess, etc) | |
# i like to use 'deny all' for all . files ~mj | |
location ~ /\. { |
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
via Jack Wallen @jlwallen | |
-- This goes in /etc/ngnix/ngnix.conf | |
gzip on; | |
gzip_vary on; | |
gzip_min_length 10240; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml; | |
gzip_disable "MSIE [1-6]\."; |
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
# This is in the server {} section of the /sites-available domain | |
location / { | |
#notice the $uri space $uri/ space before the @ function for the re-writes | |
try_files $uri $uri/ @extensionless-php; | |
index index.html index.htm index.php; | |
} | |
location @extensionless-php { | |
rewrite ^(.*)$ $1.php last; | |
} |
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 | |
ini_set( 'display_errors', 1 ); | |
error_reporting( E_ALL ); | |
$from = "emailtest@currentdomain.com"; | |
$to = "myemail@currentdomain.com"; | |
$subject = "PHP Mail Test script via currentdomain"; | |
$message = "This is a test to check the PHP sendmail functionality."; | |
$headers = "From:" . $from; | |
if(mail($to,$subject,$message, $headers)) | |
echo "Test email sent from currentdomain."; |
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 surrounding <div> for all the ish don't want to keep once submission is successful | |
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script> | |
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[1]='FNAME';ftypes[1]='text';fnames[0]='EMAIL';ftypes[0]='email';}(jQuery)); | |
//var $mcj = jQuery.noConflict(true); | |
</script> | |
<script> | |
$(function(){ | |
//$("#mcm_hide_on_submit").hide(); | |
$(".button").on("click", 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
// For FAQ page nav scrolling | |
function anchorScrollTo() { | |
$('.anchor li a').on('click', function(e){ | |
e.preventDefault(); | |
var scrollTo = $($(this).attr('href')); | |
var headerHeight = $('.page_header').height(); | |
console.log(scrollTo, headerHeight); | |
$('html,body').animate({ | |
scrollTop: scrollTo.offset().top - headerHeight}, | |
'slow'); |
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 | |
/* I use this in a separate config-properties.php or otherwise named file | |
* which is then included by wp-config.php ~mj */ | |
function getRealHost() { | |
list($realHost,) = explode(':',$_SERVER['HTTP_HOST']); | |
return $realHost; | |
} |
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 | |
// add this to `core-emails.php` file in the ACF Advanced Forms plugin ~mj | |
// From header | |
$from = af_resolve_field_includes( $email['from'], $fields ); | |
$replyto = af_get_field( 'email'); | |
$headers[] = 'From:' . $from; | |
// only have reply-to to Customer if it's admin |
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 | |
// Display ACF field names for development for Administrator only | |
function display_acf_field_names( $field ) { | |
echo $field['_name']; | |
} | |
if(is_admin() && !current_user_can('manage_options')) { | |
add_action( 'acf/render_field', 'display_acf_field_names', 10, 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
<?php | |
/** | |
* @desc Add .img-responsive to all post images ~mj | |
*/ | |
function add_post_img_responsive_class($attr) { | |
$attr['class'] .= ' img-responsive'; // note the leading space | |
return $attr; | |
} | |
add_filter('wp_get_attachment_image_attributes', 'add_post_img_responsive_class'); |