Skip to content

Instantly share code, notes, and snippets.

View 3200creative's full-sized avatar

3200 Creative 3200creative

View GitHub Profile
@3200creative
3200creative / functions.php
Created April 1, 2015 14:36
Add Category To Body Class Of Singular Page
/* Add Category Type To Body Class Of Single Article */
add_filter('body_class','add_category_to_single');
function add_category_to_single($classes, $class) {
if (is_single() ) {
global $post;
foreach((get_the_category($post->ID)) as $category) {
// add category slug to the $classes array
$classes[] = $category->category_nicename;
}
@3200creative
3200creative / global.js
Created March 18, 2015 16:15
add class to body dependent on another class existing.
jQuery(function( $ ){
if($('.class-name').length !== 0)
{
$('body').addClass('class-name-added-to-body');
}
});
@3200creative
3200creative / home.js
Created March 13, 2015 18:42
Fade out on Scroll Down
$(window).scroll(function() {
$(".fade-on-scroll").css({
'opacity' : 1-(($(this).scrollTop())/250)
});
});
@3200creative
3200creative / functions.php
Created March 11, 2015 01:39
Section With Wrap Shortcode
//* Page Section with field for unique class.
function contentSection( $atts, $content = null ) {
$content = preg_replace('#^<\/p>|<p>$#', '', $content);
$a = shortcode_atts( array(
'class' => 'Add Classes Here',
), $atts );
return '<div class="full-block '."{$a['class']}".' "><div class="wrap">' . do_shortcode($content) . '</div></div>';
}
@3200creative
3200creative / functions.php
Created March 10, 2015 21:08
Add clear-line shortcode
//* General Class Shortcode
function clearline_func() {
return '<section class="clear-line"></section>';
}
add_shortcode( 'clear-line', 'clearline_func' );
@3200creative
3200creative / style
Created February 20, 2015 00:24
FontAwesome 4 Menus - customization
/*Install Font Awesome 4 Menus plugin*/
/*Create Menu - this is for a social icon menu*/
/*Add classes to menu class (i.e. fa fa-facebook)*/
/* FontAwesome Menu */
.menu-social-menu-container {
width: 100%;
}
.menu-social-menu-container ul {
@3200creative
3200creative / functions
Created February 11, 2015 20:59
Add Font Awesome
//* Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'themename_enqueue_scripts_styles' );
function themename_enqueue_scripts_styles() {
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' );
}
@3200creative
3200creative / index.html
Created December 23, 2014 21:15
Livechat A link setup
<a href="#" onclick="LC_API.show_full_view();return false;">
@3200creative
3200creative / style.css
Created December 3, 2014 17:20
Font Awesome CSS Integration: Before Content
:before {
content:"\f128";
font-size:120px;
font-family: FontAwesome;
color:#060;
float:left;
padding-right:10px;
line-height: 1;
}
@3200creative
3200creative / Functions.php
Created December 3, 2014 17:09
Font Awesome
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' );