Skip to content

Instantly share code, notes, and snippets.

View jerewall's full-sized avatar

Jeremy Wallace jerewall

View GitHub Profile
@jerewall
jerewall / header.php
Created May 16, 2016 13:48
Wordpress Blog Feed (While in the loop (using wordpress) )
<?php
if(function_exists('the_permalink')) :
$my_query = new WP_Query( 'posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<div class="entry">
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<a class="readmore" href="<?php the_permalink(); ?>">Read more »</a>
</div>
@jerewall
jerewall / header.php
Created May 16, 2016 13:47
RSS Feed Embed Code
<?php
function limit_words($string, $word_limit) {
$words = explode(" ",$string);
return implode(" ",array_splice($words,0,$word_limit)).'…';
}
$url="http://www.jetwhine.com/feed/";
$limit=2;
$xml = simplexml_load_file($url);
$res=$xml->channel;
$count=0;
@jerewall
jerewall / header.php
Created May 16, 2016 13:46
Widget Sidebar Code / sscarousel
<?php if (is_active_sidebar('webcom_sidebar_01') ) : ?>
<div class="webcom-cta ssgrid-margin">
<?php dynamic_sidebar('webcom_sidebar_01'); ?>
</div>
<?php endif; ?>
<?php if (is_active_sidebar('sscarousel_sidebar_slick_01') ) : ?>
<div class="slider slick-slider-responsive">
<?php dynamic_sidebar('sscarousel_sidebar_slick_01'); ?>
</div>
@jerewall
jerewall / header.php
Created May 16, 2016 13:44
Embed YouTube Channel
<script>
/*
Copyright 2011 : Simone Gianni <simoneg@apache.org>
-- update by tcuttrissweb --
adds in title besdie thumbs in carousel.
adjusted css from the original to make room for this
allows resizing
to adjust size of the player adjust the css for:
.youtube iframe.player width / height accordingly.
@jerewall
jerewall / header.php
Created May 16, 2016 13:43
Scroll To ID (easing)
<!-- //SCROLL TO ID -->
<script type="text/javascript" src="scripts/jquery.scrollTo.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var pageName =document.location.pathname.match(/[^\/]+$/)[0];
$('a[href^="#"], a[href^="'+pageName+'#"]').click(function() {
$(window).scrollTo($(this.hash), 1500, {easing:'easeOutQuart'});
return false;
});
@jerewall
jerewall / style.css
Created May 16, 2016 13:43
Font Awesome li Hover
#cats li:before {
font-family: 'FontAwesome';
content: '\f111';
margin:0 10px 0 -15px;
color: blue;
}
#cats li:hover:before {
font-family: 'FontAwesome';
content: '\f111';
@jerewall
jerewall / header.php
Created May 16, 2016 13:42
Wordpress Blog Feed RSS
<?php
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/blog/wp-blog-header.php')):
include($_SERVER['DOCUMENT_ROOT'].'/blog/wp-blog-header.php');
remove_filter('the_excerpt', 'wpautop'); // Remove p tag from the_excerpt
$posts = get_posts('numberposts=2&order=DESC&orderby=date');
foreach ($posts as $post) : start_wp();
?>
<div class="blog-article">
<p class="post-title"><?php echo the_title(); ?></p>
<?php the_excerpt() ?> <a href="<?php echo the_permalink() ?>">Read more...</a>
@jerewall
jerewall / style.css
Created May 16, 2016 13:41
Equal Height Sidebar (non-jquery version)
.webcom-columns {
display: table;
width: 100%;
.webcom-main {
display:table-cell;
vertical-align: top;
background: #FFFFFF;
}
.webcom-sidebar {
@jerewall
jerewall / global.js
Created May 16, 2016 13:40
Equal Height Columns With Jquery
<script>
$(window).load(function() {
var tallest = 0;
$('.col').each(function(){
if($(this).outerHeight() > tallest) tallest = $(this).outerHeight();
});
$('.col').css('height', tallest);
@jerewall
jerewall / header.php
Created May 16, 2016 13:40
Wordpress Login Form
<?php wp_login_form(); ?>