Skip to content

Instantly share code, notes, and snippets.

East Side Code EastSideCode

Block or report user

Report or block EastSideCode

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@EastSideCode
EastSideCode / style.css
Created Apr 25, 2017
Expand arrows on NextGen Gallery with fancybox to edge of browser window
View style.css
#fancybox-left, #fancybox-right {position: fixed !important; visibility: visible !important;}
#fancybox-right span { left: auto; right: 20px; }
#fancybox-left span { left: 20px; }
#fancybox-close {position: fixed !important; top: 20px !important; right: 20px !important;}
@EastSideCode
EastSideCode / functions.php
Created Nov 13, 2017
Add a custom link to WordPress menu if needed
View functions.php
// Add custom link to WordPress menu
add_filter( 'wp_nav_menu_items', 'my_nav_menu_custom_link' );
function my_nav_menu_custom_link($menu) {
// generate the link in a variable
$customLink = '<li class="menu-item"><a href="#">Custom Link Text</a></li>';
// convert the standard menu to an array
@EastSideCode
EastSideCode / js
Created Nov 13, 2017
Generic, reusable, AJAX Mailer
View js
jQuery(document).ready(function($) {
// load form elements in vars for ease of use
var frm = $('#contact-form');
var formMessages = $('#form-messages');
var loadingAnimation = $('#loading-container');
frm.submit(function (e) {
@EastSideCode
EastSideCode / functions.php
Created Dec 5, 2017
Put WordPress site into maintenance mode
View functions.php
// Put site into maintenance mode
function eastsideCode_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:purple">Website under Maintenance</h1><br />We are performing scheduled maintenance, and will be back online shortly. If you think you've received this notice in error, please contact your website administrator. Thanks!');
}
}
add_action('get_header', 'eastsideCode_maintenance_mode');
@EastSideCode
EastSideCode / functions.php
Created Dec 14, 2017
Adding google fonts
View functions.php
function wpb_add_google_fonts() {
wp_enqueue_style( 'wpb-google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false );
}
add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
@EastSideCode
EastSideCode / functions.php
Created Dec 14, 2017
Add layer slider CSS into HTML Body
View functions.php
// remove the default css
add_action( 'wp_enqueue_scripts', 'remove_layer_slider_stylesheet');
function remove_layer_slider_stylesheet() {
wp_dequeue_style( 'layerslider' );
}
// load layer slider styles on the page
@EastSideCode
EastSideCode / style.css
Created Dec 14, 2017
Sample table of contents
View style.css
/*
# Table of contents
# Normalize / reset
# Header
# Footer
# Menu
# Home
# Page and Post
# Page Specific Content
@EastSideCode
EastSideCode / functions.php
Created Jan 16, 2018
Add analytics to wordpress
View functions.php
// Include the Google Analytics Tracking Code (ga.js)
// @ https://developers.google.com/analytics/devguides/collection/gajs/
function google_analytics_tracking_code() { ?>
<!-- analytics script goes here -->
<script type="text/javascript">
</script>
<!-- analytics script ends here -->
@EastSideCode
EastSideCode / functions.php
Created Jan 22, 2018
Add a WordPress user via FTP
View functions.php
function ectuts_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
@EastSideCode
EastSideCode / .htaccess
Last active Feb 5, 2018
Leverage browser caching with .htaccess
View .htaccess
## EXPIRES CACHING ##
# In apache, be sure to enable mod_headers and mod_expires
# sudo a2enmod headers
# sudo a2enmod expires
#
# Then restart apache
# service apache2 restart
You can’t perform that action at this time.