Skip to content

Instantly share code, notes, and snippets.

View duroe5698's full-sized avatar

Marc Duroe duroe5698

View GitHub Profile
@duroe5698
duroe5698 / custom-wordpress-genesis-loop-widget.php
Last active November 25, 2015 17:20
Custom WordPress Genesis Loop Widget
<?php
class YOURCUSTOMWidget extends WP_Widget
{
function YOURCUSTOMWidget()
{
$widget_ops = array('classname' => 'YOURCUSTOMWidget', 'description' => 'Widget Description' );
parent::__construct('YOURCUSTOMWidget', 'YOURCUSTOM Widget', $widget_ops);
}
function form($instance)
@duroe5698
duroe5698 / custom-home-page-template-wordpress-genesis.php
Last active November 25, 2015 17:20
Custom Homepage Template WordPress Genesis
<?php
add_action( 'genesis_meta', 'md_home_genesis_meta' );
/**
* Add custom loop/widget support for homepage. File name should be home.php
*
*/
function md_home_genesis_meta() {
//* Add md-home body class
@duroe5698
duroe5698 / add-custom-header-support-wordpress-genesis.php
Last active November 25, 2015 17:20
Add Custom Header Support WordPress Genesis
<?php
add_theme_support( 'custom-header', array(
'header-selector' => '.site-title a',
'header-text' => false,
'height' => 157,
'width' => 1200,
) );
?>
@duroe5698
duroe5698 / remove-cpt-name-slug-from-permalink-wordpress.php
Last active November 25, 2015 17:19
Remove CPT Name Slug From Permalink WordPress
@duroe5698
duroe5698 / simple-lightweight-jquery-accordion.css
Created November 25, 2015 17:18
Simple Lightweight jQuery Accordion for WordPress
/* --------------------------------------------
Accordion Styles
----------------------------------------------*/
.accordion { margin: 0 0 30px; border-top: 1px solid #DDD; border-right: 1px solid #DDD; border-left: 1px solid #DDD; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
.accordion dt { border-bottom: 1px solid #DDD; }
.accordion dd { display: none; padding: 20px; border-bottom: 1px solid #DDD; }
@duroe5698
duroe5698 / add-genesis-after-entry-widget-on-pages-genesis-wordpress.php
Created November 25, 2015 17:34
Add Genesis After Entry Widget on Pages Genesis WordPress
<?php
add_action( 'genesis_after_entry', 'md_after_entry_widget_area' );
/*Display after-entry widget area on the genesis_after_entry action hook.*/
function md_after_entry_widget_area() {
if ( ! is_singular( 'page' ) || ! current_theme_supports( 'genesis-after-entry-widget-area' ) ) {
return;
}
genesis_widget_area( 'after-entry', array(
@duroe5698
duroe5698 / get-shortened-meta-excerpt-with-tags-stripped-wordpress.php
Created November 28, 2015 19:01
Get Shortened Meta Excerpt With Tags Stripped Wordpress.php
<?php
echo wpautop(substr(strip_tags(( get_post_meta( get_the_ID(), 'GET CUSTOM META FIELD ID', true ) )), 0,200) . '...');
?>
@duroe5698
duroe5698 / jquery.localScroll.min.js
Created December 2, 2015 16:40
Smooth Scrolling To In Page Links WordPress
/**
* Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Licensed under MIT
* @author Ariel Flesler
* @version 1.4.0
*/
;(function(a){if(typeof define==='function'&&define.amd){define(['jquery'],a)}else{a(jQuery)}}(function($){var g=location.href.replace(/#.*/,'');var h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1000,axis:'y',event:'click',stop:true,target:window};$.fn.localScroll=function(a){a=$.extend({},h.defaults,a);if(a.hash&&location.hash){if(a.target)window.scrollTo(0,0);scroll(0,location,a)}return a.lazy?this.on(a.event,'a,area',function(e){if(filter.call(this)){scroll(e,this,a)}}):this.find('a,area').filter(filter).bind(a.event,function(e){scroll(e,this,a)}).end().end();function filter(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')===g&&(!a.filter||$(this).is(a.filter))}};h.hash=function(){};function scroll(e,a,b){var c=a.hash.slice(1),elem=document.getElementById(c)||document.getElementsByName(c)[0];if(
@duroe5698
duroe5698 / tab-index.css
Last active December 2, 2015 18:14
Hover Content Tab Index
/*
Tab Index Styles
---------------------------------------------------------------------------------------------------- */
.tab-index-list {
margin-top: 0px;
}
.tab-index {
display: inline-block;
@duroe5698
duroe5698 / Add Page Templates To WordPress via Plugin.php
Created December 14, 2015 17:49
Add Page Templates To WordPress via Plugin
<?php
//* Add this code to your plugin and it will register all templates defined in array on line 66 to your theme.
class PageTemplater {
/**
* A Unique Identifier
*/
protected $plugin_slug;