Skip to content

Instantly share code, notes, and snippets.

View ramiabraham's full-sized avatar

Rami Abraham ramiabraham

View GitHub Profile
@ramiabraham
ramiabraham / basic wp-login.php and wp-admin customization
Last active December 17, 2015 09:39
Some wp-login.php and wp-admin customization examples
<?php
/*
* Here are some basic WordPress admin customizations.
*/
// load a custom stylesheet for wp-login.php
function neato_prefix_custom_login_stylesheet() {
wp_enqueue_style( 'custom_login_stylesheet', get_template_directory_uri() . '/css/login.css' );
}
@ramiabraham
ramiabraham / gist:5603837
Created May 18, 2013 09:19
jquery load content on scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");
@ramiabraham
ramiabraham / gist:5603869
Created May 18, 2013 09:34
Easy lettering.js setup
// Easy lettering.js
$('.splitWord').children().andSelf().contents().each(function() {
if (this.nodeType == 3) {
$(this).replaceWith(
$(this).text().replace(/(\w)/g, "<span class='char'>$&</span>")
);
}
});
// Adds class,to each letter `.char1`, `.char2`, `.char3`, ...
@ramiabraham
ramiabraham / mixins
Created August 9, 2013 02:34
just some mixins
@function black($opacity){
@return rgba(0,0,0,$opacity)
}
@function white($opacity){
@return rgba(255,255,255,$opacity)
}
@mixin box-emboss($opacity, $opacity2){
box-shadow:white($opacity) 0 1px 0, inset black($opacity2) 0 1px 0;
}
@ramiabraham
ramiabraham / togetherjs.php
Last active September 5, 2024 01:43 — forked from anonymous/togetherjs.php
Just a plugin to load together.js in WP.
<?php
/*
Plugin Name: TogetherJS for WordPress
Plugin URI: http://www.rami.nu
Description: Integrates TogetherJS with WordPress
Version: 0.1
Author: ramiabraham
Author URI: http://rami.nu
License: GPL 2.0
*
@ramiabraham
ramiabraham / gist:8142319
Created December 27, 2013 03:46
widgets.php
<?php
/**
* Include and setup custom widgets
*
*/
/**
* display featured posts
*
* @return OTT_Widgets
<?php
/**
* Disable all non-whitelisted jetpack modules.
*
* This will allow all of the currently available Jetpack modules to work
* normally. If there's a module you'd like to disable, simply comment it out
* or remove it from the whitelist and it will no longer load.
*
* @author FAT Media, LLC
* @link http://wpbacon.com/tutorials/disable-jetpack-modules/
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
@ramiabraham
ramiabraham / debug.php
Last active August 29, 2015 13:57
WP_DEBUG via query parameter, WP_DEBUG dev stack
// Allows you to add ?debug=true query parameter
// For live sites in which a dev environment is not possible.
if ( isset($_GET['debug']) && $_GET['debug'] == 'true') {
define('WP_DEBUG', true);
}
// A nice stack recommended by @jjeaton,
// for dev environments:
@ramiabraham
ramiabraham / thesis_5_4.php
Created July 8, 2014 17:01
Adjusts Thesis themes to be compliant with PHP >= 5.4 in options_post.php
if (($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {
to:
if ((is_array($meta_field['type'])) && ($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {