Skip to content

Instantly share code, notes, and snippets.

View hsquareweb's full-sized avatar

Hassan Elhassan hsquareweb

View GitHub Profile
@hsquareweb
hsquareweb / gist:3151332
Created July 20, 2012 15:28
WP: Body Class
<?php
// ADDING A CLASS TO THE BODY TAG
function page_bodyclass( $classes ){
if( is_singular() ) {
global $post;
$parent = get_page($post->post_parent);
array_push( $classes, "{$post->post_type}-{$post->post_name}" );
array_push( $classes, "{$post->post_type}-parent-{$parent->post_name}" );
}
return $classes;
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>
<?php
@hsquareweb
hsquareweb / gist:3248941
Created August 3, 2012 15:58
HTML+jQuery: Simple Show/Hide Toggle
<h3 class="showhide">&raquo; <a href="javascript:void(0)">Our Volunteers Make Us Strong</a></h3>
<div class="hidden" style="display: none;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
@hsquareweb
hsquareweb / gist:3349717
Created August 14, 2012 14:24
WP: Simple Banner Slider
<!-- BANNER SLIDER -->
<div id="branding-area">
<div class="banners">
<?php
$loop = new WP_Query(array(
'post_type' => 'brandingslides',
'post_status' => 'publish',
'numberposts' => 4,
'posts_per_page' => -1,
'orderby'=> 'ASC'
@hsquareweb
hsquareweb / script.js
Created August 14, 2012 17:33
jQuery: Remove Empty "p" Tags
//remove empty p tags
$("p").filter(function () {
return $.trim($(this).html()) == '';
}).remove();
@hsquareweb
hsquareweb / script.js
Created August 14, 2012 17:34
jQuery: Text Resizing Feature
// text resizing feature
$(".text-size").on('click','a',function(){
var $this = $(this),
$body = $("body").eq(0);
if($this.hasClass("small")){
$body.addClass("small").removeClass("large normal");
}
else if($this.hasClass("normal")){
$body.addClass("normal").removeClass("large small");
@hsquareweb
hsquareweb / stylesheet.css
Created September 17, 2012 15:29
CSS: YUI Fonts Conversions
/**************************
YUI Fonts Conversions
10px = 77%
11px = 85%
12px = 93%
13px = 100%
14px = 108%
15px = 116%
16px = 123.1%
17px = 131%
@hsquareweb
hsquareweb / functions.php
Created September 18, 2012 13:34
WP: Basic Shortcode
function CodepadShortcode() {
return '<p>I love Codepad!</p>';
}
add_shortcode('codepad', 'CodepadShortcode');
@hsquareweb
hsquareweb / gist:3745444
Created September 18, 2012 19:54
HTML: Embed Clean YouTube Video
<object width="100%" height="315">
<param name="movie" value="URL-VIDEO&amp;ap=%2526fmt%3D18?version=3&amp;hl=en_US&amp;showinfo=0&amp;autohide=1">
<param name="allowFullScreen" value="true">
<param name="allowscriptaccess" value="always"><embed src="URL-VIDEO&amp;ap=%2526fmt%3D18?version=3&amp;hl=en_US&amp;showinfo=0&amp;autohide=1" type="application/x-shockwave-flash" width="100%" height="315" allowscriptaccess="always" allowfullscreen="true"></object>
@hsquareweb
hsquareweb / reset.css
Created September 26, 2012 22:58
CSS: BoilerPlate/WordPress/Clearfix Reset
/************************************
HTML5 RESET BOILERPLATE
************************************/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
audio:not([controls]) { display: none; }
[hidden] { display: none; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
html, button, input, select, textarea { font-family: sans-serif; color: #222; }
body { margin: 0; font-size: 1em; line-height: 1.4; }