Skip to content

Instantly share code, notes, and snippets.

@ElmahdiMahmoud
ElmahdiMahmoud / gist:6917661
Created October 10, 2013 12:39
wp: the_breadcrumb
<?php
function the_breadcrumb() {
global $wp_query, $wp;
$total_results = $wp_query->found_posts;
echo '<ul id="crumbs">';
if(!is_home() && is_search()) {
@ElmahdiMahmoud
ElmahdiMahmoud / gist:6413336
Created September 2, 2013 14:15
js: Customize twitter feed
// Customize twitter feed
var hideTwitterAttempts = 0;
function hideTwitterBoxElements() {
setTimeout( function() {
if ( $('[id*=twitter]').length ) {
$('[id*=twitter]').each( function(){
if ( $(this).width() == 220 ) {
$(this).width( 220 );
$(this).height( 425 );
}
@ElmahdiMahmoud
ElmahdiMahmoud / gist:6353516
Last active December 21, 2015 19:19
jquery: plugin pattern
/*!
* jQuery pattern - 24.01.14
* Author: @ElmahdiMahmoud
* Licensed under the MIT license
*/
;(function ( $, window, document, undefined ) {
$.fn.plugiName = function (options) {
// set up default options
@ElmahdiMahmoud
ElmahdiMahmoud / gist:6052741
Created July 22, 2013 10:03
js: toggle text
$('.selector').html(
$(this).is(':visible') ? "Hide" : "Show"
);
@ElmahdiMahmoud
ElmahdiMahmoud / gist:5965872
Last active December 19, 2015 13:58
php: contact form
<form id="contactForm" method="post">
<fieldset class="grid halves">
<div class="grid-item">
<ol>
<li>
<label class="label--has-placeholder" for="firstName">First Name</label>
<input type="text" placeholder="First Name" name="firstName" id="firstName">
</li>
<li>
<label class="label--has-placeholder" for="lastName">Last Name</label>
@ElmahdiMahmoud
ElmahdiMahmoud / gist:5964178
Last active December 19, 2015 13:48
js: placeholder for oldIE
/* placeholder for oldIe */
$('.ie8 [placeholder], .ie9 [placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
@ElmahdiMahmoud
ElmahdiMahmoud / gist:5908995
Created July 2, 2013 12:47
Carousel Plugin
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Carousel</title>
<style>
.carousel_container {
margin-top: 10px;
}
.carousel_inner {
$(".clone").on('click', function(e) {
e.preventDefault();
var $repeatable = $(this).closest('.toclone').find('.repeatable').eq(0).clone();
var $selectAll = $repeatable.find('select').clone();
$repeatable.empty();
$repeatable.append($selectAll).addClass('cloned');
$repeatable.append('<a class="removeCloned" href="#">x</a><div class="clear"></div>');
@ElmahdiMahmoud
ElmahdiMahmoud / gist:5831027
Created June 21, 2013 13:09
html: clone structure
<div class="toclone">
<div class="repeatable">
<select>
<option value="title">Theme title</option>
</select>
</div>
<a class="clone" href="#">+Add</a>
</div>
@ElmahdiMahmoud
ElmahdiMahmoud / index.html
Created May 21, 2013 19:42
A CodePen by ElmahdiMahmoud. Progressbar | jQuery UI - Progressbar | jQuery UI with custom data attribute.
<div class="progressbar" data-value="20"></div>
<div class="progressbar" data-value="40"></div>
<div class="progressbar" data-value="60"></div>
<div class="progressbar" data-value="80"></div>
<div class="progressbar" data-value="100"></div>