Skip to content

Instantly share code, notes, and snippets.

/* Navigation
---------------------------------------------------------------- */
/* Below Header
---------------------------------------------- */
/* active menu items */
.navbar .nav > .active > a, .navbar .nav > .active > a:hover, .navbar .nav > .active > a:focus {
background-color: #99ca3c;
@chrisrouse
chrisrouse / Custom Media Size Dropdown
Created May 10, 2013 12:46
This is a pretty cool function. Sometimes the default Medium and Large sizes when inserting an image into a post just isn’t enough range. Maybe you have a special size you use in posts but don’t want to change your Medium and Large file sizes just for that? Well this snippet will allow you to add another image size to the WordPress drop down men…
// Set the new image sizes
if(function_exists( 'add_image_size')){
add_image_size('blog-large', 900, 700, false);
}
// Tell the media panel to add the new size to the dropbown
function custom_image_sizes($sizes) {
$addsizes = array(
"blog-large" => __("X-Large")
);
@chrisrouse
chrisrouse / Remove WordPress Version
Created May 10, 2013 12:48
Hides the WordPress version, making the site more secure
// Remove the WP version for extra WordPress Secruty
function remove_wp_version(){
return '';
}
add_filter('the_generator', 'remove_wp_version');
@chrisrouse
chrisrouse / Custom Class To Last Post In A Loop
Created May 10, 2013 12:49
Adds a custom class to the last post in a loop
// Add a class to the last post in a loop
function last_post_class($classes){
global $wp_query;
if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last';
return $classes;
}
add_filter('post_class', 'last_post_class');
@chrisrouse
chrisrouse / Anti-spam email link
Created May 10, 2013 12:52
To use this shortcode just add the following where you want the link to appear in your posts. [email][email protected][/email]
@chrisrouse
chrisrouse / Show Feature Image on Post Admin
Created May 21, 2013 02:48
This adds a custom column to show the feature image of a post.
<?php
/*
Plugin Name: Featured Image in Post List
Description: This plugin allows you to see the featured image for each post in the Post list.
Version: 0.1
License: GPL
Author: Chris Rouse
Author URI: www.chrisrouse.us
*/
.input-focus(@r, @g, @b) {
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="week"]:focus,
.circle {
border-radius: 50%;
width: 100px;
height: 100px;
line-height:100px;
text-align:center;
border:1px solid black;
/* width and height can be anything, as long as they're equal */
}
@chrisrouse
chrisrouse / padding-with-four-values.less
Created December 7, 2013 18:23
LESS mixins for generating pixel and rem values for padding using one to four values.
.padding-four-values (@padding1: 16; @padding2: 16; @padding3: 16; @padding4: 16;) {
@padding1Value: (@padding1 / 10);
@padding2Value: (@padding2 / 10);
@padding3Value: (@padding3 / 10);
@padding4Value: (@padding4 / 10);
padding: (@padding1 * 1px) (@padding2 * 1px) (@padding3 * 1px) (@padding4 * 1px);
padding: ~"@{padding1Value}rem" ~"@{padding2Value}rem" ~"@{padding3Value}rem" ~"@{padding4Value}rem";
}
usage: