Skip to content

Instantly share code, notes, and snippets.

View FernE97's full-sized avatar

Eric Fernandez FernE97

View GitHub Profile
@FernE97
FernE97 / acf-slider.php
Created May 9, 2013 23:45
PHP: WordPress - Advanced Custom Fields Slider
<?php if ( get_field( 'slides' ) ) : // repeater field ?>
<ul class="slider">
<?php while ( the_repeater_field( 'slides' ) ) :
$image = get_sub_field( 'slide' ); // sub-field image ID
$slide = wp_get_attachment_image_src( $image, 'slides' );
$alt = get_post_meta( $image, '_wp_attachment_image_alt', true );
?>
<li><img src="<?php echo $slide[0]; ?>" alt="<?php echo $alt; ?>"></li>
<?php endwhile; ?>
@FernE97
FernE97 / remove-junk.php
Created May 7, 2013 20:46
PHP: WordPress Remove scripts & styles
<?php
// Remove Unecessary Styles & Scripts
function h5bs_remove_junk() {
if ( ! is_admin() ) :
global $WP_Views;
remove_action( 'wp_print_styles', array( $WP_Views, 'add_render_css' ) );
wp_dequeue_style( 'views-pagination-style' ); // plugins/wp-views/embedded/res/css/wpv-pagination.css
wp_dequeue_style( 'date-picker-style' ); // plugins/wp-views/embedded/res/css/datepicker.css
@FernE97
FernE97 / wp-slides.php
Created April 30, 2013 00:02
PHP: WordPress Slides v2
<?php
$args = array(
'post_type' => 'slides', // custom post type
'orderby' => 'menu_order',
'posts_per_page' => -1
);
$slides = new WP_Query( $args );
if ( $slides->have_posts() ) : $count = 0; ?>
@FernE97
FernE97 / modernizr-mq.js
Created March 28, 2013 19:15
JS: Modernizr media query
jQuery(document).ready(function ($) {
'use strict';
function doneResizing() {
if (Modernizr.mq('screen and (min-width:768px)')) {
// action for screen widths including and above 768 pixels
} else if (Modernizr.mq('screen and (max-width:767px)')) {
// action for screen widths below 768 pixels
}
}
@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
@FernE97
FernE97 / link-rel-seo.tpl
Created November 12, 2012 10:34
SMARTY: link rel seo
@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 / 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 / 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 / mixins.less
Created May 24, 2012 17:42
css: LESS Mixins
/*=LESS Mixins
---------------------------------------*/
/*=Helpers
-----------------------------*/
.clearfix {
*zoom: 1;
&:before, &:after {
content: ""; display: table;
}