Skip to content

Instantly share code, notes, and snippets.

@sambody
sambody / rounded corners
Created June 11, 2013 22:46
CSS: Rounded corners, border radius
-webkit-border-radius: 4px;
border-radius: 4px;
@sambody
sambody / dropshadow
Created June 11, 2013 22:50
CSS: Drop shadow and inner shadow (IE9+), with box-shadow
/* normal dropshadow :
horizontalOffset verticalOffset blur spread(size) color inset
*/
-webkit-box-shadow: 0px 0px 4px 0px #ffffff;
box-shadow: 0px 0px 4px 0px #ffffff;
/* inset (inner) dropshadow */
-webkit-box-shadow: inset 0px 0px 4px 0px #ffffff;
box-shadow: inset 0px 0px 4px 0px #ffffff;
@sambody
sambody / gradient
Created June 11, 2013 23:04
CSS: Background gradient (IE10+), linear gradient
background-color: #444444;
background-image: -webkit-linear-gradient(top, #444444, #999999);
background-image: -moz-linear-gradient(top, #444444, #999999);
background-image: -o-linear-gradient(top, #444444, #999999);
background-image: linear-gradient(to bottom, #444444, #999999);
@sambody
sambody / transition
Created June 11, 2013 23:22
CSS: Transition hover effects examples (IE10+)
/* specify property to change, and duration
transition: property duration timing-function delay;
Set on NORMAL state, not hover;
*/
/* shorthand */
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
/* multiple transitions */
transition: background 0.2s ease, padding 0.8s linear;
@sambody
sambody / text shadow
Created June 11, 2013 23:28
CSS: Text shadow (IE 10+)
/* simple */
text-shadow: 1px 1px 3px #888; /* h-shadow v-shadow (blur) (color) */
/* multiple shadows, rgba for transparency */
text-shadow: 1px 1px 1px #000, 3px 3px 5px rgba(255, 255, 255, 0.4);
@sambody
sambody / box sizing
Created June 11, 2013 23:35
CSS: Box sizing for all (IE8+)
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@sambody
sambody / font face
Created June 11, 2013 23:38
CSS: Font face, web font
@font-face {
font-family: 'WebFont';
src: url('myfont.woff') format('woff'),
url('myfont.ttf') format('truetype');
}
@sambody
sambody / category template
Created June 13, 2013 11:54
WP: Templates for specific category archive pages. Just use category-catSlug.php or *category-catID.php*. Or for more customization, use the code below. (not for Hybrid theme)
// Just use category-catSlug.php or *category-catID.php*, no code necessary.
// Or for more customization, use the code below.
// add to functions.php:
/* Template for certain categories (archive pages, not single) */
add_filter( 'category_template', 'my_category_template' );
// easy to apply to other templates as well ?
function my_category_template( $template ) {
@sambody
sambody / Category template
Created June 13, 2013 11:57
Hybrid: Set Hybrid theme category template (archive, not single).
/* For Hybrid theme, simply create a file taxonomy-category-catSlug.php (or catID),
no extra code required in functions. */
@sambody
sambody / Custom fields - output
Created June 13, 2013 13:19
WP: Custom fields output. Input: use page editor metabox
/* simple output of value (url) custom field with key "post-icon", in your page/template.
*/
<?php echo get_post_meta($post->ID, 'post-icon', true); ?> // 'true' means string instead of array
/* use 2 */
<img src="<?php echo get_post_meta($post->ID, 'post-icon', true); ?>" alt="Icon for Post #<?php the_ID(); ?>" />
/* use 3 - outside of the loop (eg in sidebar or...), make new loop */
<?php query_posts('showposts=10&offset=0'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>