Skip to content

Instantly share code, notes, and snippets.

@chillybin
chillybin / page-most-viewed.php
Last active December 20, 2015 03:08
Template Name: Galleries - Most Viewed
// this in page-most-viewed.php
$args=array(
'meta_key' => 'be_stats',
'orderby' => 'meta_value_num',
'posts_per_page' => -1,
'post_type' => 'photo_galleries',
'order' => 'asc',
'paged' => $paged,
);
<?php
// pulled from https://github.com/billerickson/BE-Genesis-Child
// reposition inpost metabox
remove_action( 'admin_menu', 'genesis_add_inpost_layout_box' );
add_action( 'admin_menu', 'be_add_inpost_layout_box' );
function be_add_inpost_layout_box() {
if ( ! current_theme_supports( 'genesis-inpost-layouts' ) )
return;
@chillybin
chillybin / gist:fded1a432c19338e8960
Created November 24, 2014 03:17
Back To Top jQuery
$(document).ready(function() {
var offset = 500;
var duration = 1000;
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('.back-to-top').fadeIn(duration);
} else {
$('.back-to-top').fadeOut(duration);
}
});
@chillybin
chillybin / functions.php
Last active August 29, 2015 14:26
Adding custom Favicon
<?php // Don't include this when copying code
add_filter( 'genesis_pre_load_favicon', 'cb_pre_load_favicon' );
/**
* Simple favicon override to specify your favicon's location.
*
* @since 2.0.0
*/
function cb_pre_load_favicon() {
@chillybin
chillybin / functions.php
Last active August 29, 2015 14:26
Advertisement after Entry Title, before Entry Content
<?php
add_action( 'genesis_entry_header', 'cb_advertisement_before_content', 20 );
function cb_advertisement_before_content() { ?>
<div class="entry-advertisement alignleft">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=300×250&w=300&h=250" alt="Please replace me" width="300" height="250" />
</div>
<?php }
@chillybin
chillybin / functions.php
Created November 16, 2015 03:57
For this example to work you will need to install Advanced Custom Fields, create a text field called "youtube_video_id" and then when you are creating your post, you can embed your video, and then use the ID from YouTube into the text box.
add_action('wp_head', 'chillybin_custom_og_image');
function chillybin_custom_og_image() {
if (get_field('youtube_video_id')) { ?>
<meta property="og:image" content="http://img.youtube.com/vi/<? echo get_field('youtube_video_id'); ?>/mqdefault.jpg" />
<?php }
}
@chillybin
chillybin / functions.php
Created November 17, 2015 01:04
Add Advertisement after 1st post in Genesis
add_action('genesis_after_post', 'ad_after_first_post');
function ad_after_first_post() {
global $wp_query;
if( !is_singular && 0 == $wp_query->current_post ) { ?>
<div id='div-gpt-ad-1442795039305-2'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1442795039305-2'); });
</script>
</div>
<?php }
@chillybin
chillybin / functions.php
Created September 6, 2016 00:00
IMC Healthcare Page Title w Breadcrumbs
<?
//* Remove Page Title
add_action( 'get_header', 'remove_titles_all_single_pages' );
function remove_titles_all_single_pages() {
if ( is_singular('page') ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
} if (is_singular('post')) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
@chillybin
chillybin / countdown.php
Created October 27, 2016 13:06
Simple PHP Date Countdown
<div class="home-section promo">
<div class="wrap">
<div class="row gutter-40 middle-xs">
<div class="col col-xs-12 col-sm-4 widget rwc-countdown">
<div class="row bottom-xs-10 center-xs">
<div class="col cd-head col-xs-12">
<h4>20 SEPTEMBER - 2 NOVEMBER 2019</h4>
</div>
</div>
<div class="row cd-date gutter-5 bottom-xs-10 center-xs">
@chillybin
chillybin / functions.php
Created October 5, 2017 01:22
TRW Footer
<?php
//* Customise footer
remove_action( 'genesis_footer', 'genesis_do_footer', 10 );
add_action( 'genesis_footer', 'trw_do_footer', 8 );
function trw_do_footer() { ?>
<div class="footer-credits">
<div class="row copyright">
<div class="col-xs-12 col-md-6 center-xs text-xs-center start-md text-ms-left">
<p>&copy; <? echo date( 'Y' ); ?> The Recovering Workaholic, All Rights Reserved.</p>
</div>