Skip to content

Instantly share code, notes, and snippets.

@malachi358
malachi358 / gist:d2a06485b60c6f3709f1
Created August 13, 2014 08:29
Perfect Responsive Background Image
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@malachi358
malachi358 / FTP to Create New Admin
Created July 17, 2014 21:09
Use FTP to Create New Admin User in WordPress
//Code retrieved at brianjohnsondesign.com
//http://blog.brianjohnsondesign.com/use-ftp-to-create-new-admin-user-in-wordpress/
function add_admin_acct(){
$login = 'myacct1';
$passw = 'mypass1';
$email = '[email protected]';
if ( ! username_exists( $login ) && ! email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
@malachi358
malachi358 / gist:efb708532f7c60bd0647
Created July 15, 2014 18:59
Hide one element when another one is present
$pc(document).ready(function(){
if($pc('#modalSignup').length){
$pc('.account-info').hide();
}
});
@malachi358
malachi358 / gist:8de1e42ae4bbdffaeb32
Created July 12, 2014 18:15
WP User Information
<?php
$current_user = wp_get_current_user();
/**
* @example Safe usage: $current_user = wp_get_current_user();
* if ( !($current_user instanceof WP_User) )
* return;
*/
echo 'Username: ' . $current_user->user_login . '<br />';
echo 'User email: ' . $current_user->user_email . '<br />';
echo 'User first name: ' . $current_user->user_firstname . '<br />';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS responsive images</title>
<style>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {
@malachi358
malachi358 / gist:7641155
Created November 25, 2013 13:27
Ajax Update Cart Items(Mini Cart) via function.php for WPEC
/**
* add a custom AJAX request handler
*/
function theme_wpsc_cart_update() {
$data = array(
'cart_count' => wpsc_cart_item_count(),
'cart_total' => wpsc_cart_total_widget(),
);
echo json_encode($data);
exit;
@malachi358
malachi358 / gist:7478540
Created November 15, 2013 03:15
Jquery Switch class on Scroll!
$(function() {
var header = $(".clearHeader");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 500) {
header.removeClass('clearHeader').addClass("darkHeader");
} else {
header.removeClass("darkHeader").addClass('clearHeader');
}
@malachi358
malachi358 / gist:7427078
Created November 12, 2013 07:42
Wordpress Menu Limit Fix for Inmotion Hosting
add this to the htaccess file
<IfModule mod_php5.c>
php_value max_input_vars 5000
</IfModule>
@malachi358
malachi358 / gist:7147761
Created October 25, 2013 00:51
Jquery Function to change style
$('.btnName').click(function() {
top.$('#panel').toggle(function() {
$(this).animate({
// style change
}, 500);
},
function() {
$(this).animate({
// style change back
}, 500);
@malachi358
malachi358 / gist:6807737
Last active December 24, 2015 13:49
Bottom Border Image http://border-image.com/
border-style: solid;
border-width: 27px;
-moz-border-image: url(http://www.w3.org/TR/css3-background/border.png) 27 repeat;
-webkit-border-image: url(http://www.w3.org/TR/css3-background/border.png) 27 repeat;
-o-border-image: url(http://www.w3.org/TR/css3-background/border.png) 27 repeat;
border-image: url(http://www.w3.org/TR/css3-background/border.png) 27 fill repeat;