Skip to content

Instantly share code, notes, and snippets.

View FernE97's full-sized avatar

Eric Fernandez FernE97

View GitHub Profile
@FernE97
FernE97 / search-form.css
Created April 9, 2012 21:21
css: search form
/*=Search Box
-----------------------------*/
#search-box {
position:absolute;
top:30px;
right:80px;
}
#search-box input[type=text] {
font-family:sans-serif;
background:#fff;
@FernE97
FernE97 / custom_posts.php
Created May 1, 2012 02:10
PHP: WordPress Custom Post Types Dynamic
<?php // requires php5.3
function add_post_type( $name, $args = array() ) {
add_action( 'init', function() use( $name, $args ) {
$upper = ucwords( str_replace( '_', ' ', $name ) );
$lower = strtolower( str_replace( '_', ' ', $name ) );
$name = strtolower( str_replace( ' ', '_', $name ) );
$labels = array(
'name' => _x( $upper . 's', $name ),
'singular_name' => _x( $upper, $name ),
@FernE97
FernE97 / get_featured_recursive.php
Created May 2, 2012 22:30
PHP: WordPress Parent Featured Image
@FernE97
FernE97 / equal-height.js
Created May 10, 2012 02:34
JS: Equal height containers
// equal height containers
var contentHeight = $('.content').height();
var sidebarHeight = $('.sidebar').height();
if (contentHeight < sidebarHeight) {
$('.content').css('height', sidebarHeight + 'px');
} else {
$('.sidebar').css('height', contentHeight + 'px');
}
@FernE97
FernE97 / mixins.less
Created May 24, 2012 17:42
css: LESS Mixins
/*=LESS Mixins
---------------------------------------*/
/*=Helpers
-----------------------------*/
.clearfix {
*zoom: 1;
&:before, &:after {
content: ""; display: table;
}
@FernE97
FernE97 / tabbed_taxonomy.php
Last active April 30, 2022 03:42
PHP: WordPress custom taxonomy/post query
<?php
$args = array(
'orderby' => 'ID'
);
$terms = get_terms( 'testimonial_category', $args );
?>
<!-- bootstrap tabs -->
<ul class="nav-tabs">
<?php
@FernE97
FernE97 / equal-height-columns.js
Created August 7, 2012 18:48
JS: Equal Height Columns
/* http://css-tricks.com/equal-height-blocks-in-rows/ */
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array();
function setConformingHeight(el, newHeight) {
// set the height to something new, but remember the original height in case things change
el.data("originalHeight", (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight")));
el.height(newHeight);
@FernE97
FernE97 / excerpt_count.php
Last active October 9, 2015 18:47
PHP: WP excerpt character counter
<?php
// Excerpt character count
function excerpt_count_js() { ?>
<script>
jQuery(document).ready(function ($) {
var counterVal = $('#excerpt-counter input').val($('#excerpt').val().length);
$('#postexcerpt .handlediv').after('<div id="excerpt-counter"><small>Excerpt length: </small> <input type="text" value="0" maxlength="3" size="1" readonly> <small>character(s)</small></div>');
counterVal
@FernE97
FernE97 / link-rel-seo.tpl
Created November 12, 2012 10:34
SMARTY: link rel seo
@FernE97
FernE97 / custom_trim_words.php
Last active November 16, 2020 16:14
PHP: WordPress modified wp_trim_words to include tags
<?php
// Custom Excerpt
function custom_trim_words( $text, $num_words = 55, $more = null ) {
if ( null === $more )
$more = __( '&hellip;' );
$original_text = $text;
$text = strip_shortcodes( $text );
// Add tags that you don't want stripped