Skip to content

Instantly share code, notes, and snippets.

@malachi358
malachi358 / gist:5609942
Created May 20, 2013 01:46
Adding Classes to Gravity Forms plugin for WP, You can add this code in Dashboard -> your theme -> Custom Javascript to make the gravity forms pick up the theme styling.
jQuery(document).ready(function(){
jQuery('input[type="text"]').addClass('textfield');
jQuery('input[type="submit"]').addClass('fancy_button');
jQuery('textarea').addClass('textarea');
});
@malachi358
malachi358 / gist:5609952
Created May 20, 2013 01:48
Show div by page id in PHP for Worpdress.
<?php if( is_page(4) ) { ?>
<div id="yourId" class="yourClass">You Info</div>
<?php } ?>
@malachi358
malachi358 / gist:5609966
Created May 20, 2013 01:52
Animate a png onclick with a loop that fades in and out and stop it with onclick of another button.
<!--Html-->
<img src="l1.png" class="lights">
<a href="#" class="play">click me</a>
<a href="#" class="pause">Stop Lights</a>
<!--Jquery-->
<script type="text/javascript">
@malachi358
malachi358 / gist:5609972
Created May 20, 2013 01:54
NON-CONFLICT READY JS IN WORDPRESS, BASICALLY TO USE IT “$” ESTABLISH THE JQUERY LIKE THIS AND THEN WORDPRESS WILL NORMALLY RUN THE JQUERY CODE.
jQuery(document).ready(function ($) {// ...You Code!...
});
@malachi358
malachi358 / gist:5650422
Created May 25, 2013 19:18
Call images from WP template directory(Your Theme).
<img src="<?php bloginfo('template_directory'); ?>/images/example.png"/>
@malachi358
malachi358 / gist:5655495
Created May 27, 2013 06:39
center div with absolute property
<body>
<div style="position: absolute; left: 50%;">
<div style="position: relative; left: -50%; border: dotted red 1px;">
I am some centered shrink-to-fit content! <br />
tum te tum
</div>
</div>
</body>
@malachi358
malachi358 / gist:5655782
Last active December 17, 2015 18:49
CSS3 animate background color infinite loop :)
body, #logo h1 a, ul#menu li.on {background-color: #39f !important;}
@-webkit-keyframes colours {
0% {background-color: #39f;}
15% {background-color: #8bc5d1;}
30% {background-color: #f8cb4a;}
45% {background-color: #95b850;}
60% {background-color: #944893;}
75% {background-color: #c71f00;}
90% {background-color: #bdb280;}
100% {background-color: #39f;}
@malachi358
malachi358 / PreloadIMGjQuery
Created June 24, 2013 10:08
Preloading images with jQuery
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
// Alternatively you could use:
// (new Image()).src = this;
});
}
// Usage:
@malachi358
malachi358 / wp-page-css
Created July 15, 2013 07:26
Page Specific CSS for Wordpress
body.page-id-2821 {
}
@malachi358
malachi358 / gist:6077468
Created July 25, 2013 07:03
Remove Inline Styles with Jquery Plugin.
(function($)
{
$.fn.removeStyle = function(style)
{
var search = new RegExp(style + '[^;]+;?', 'g');
return this.each(function()
{
$(this).attr('style', function(i, style)
{