Skip to content

Instantly share code, notes, and snippets.

View tomfinitely's full-sized avatar

Tom Finley tomfinitely

View GitHub Profile
@cjkoepke
cjkoepke / functions.php
Last active August 29, 2015 14:26
Apply a single custom class to the body element using a filter.
<?php
//* Do NOT copy this line or above
add_filter( 'body_class', 'ck_custom_body_class' );
function ck_custom_body_class( $classes ) {
$classes[] = 'custom-class';
return $classes;
function add_featured_img( $item ) {
$img = get_the_post_thumbnail();
return str_replace( '<li>', '<li>' . $img, $item );
}
add_filter( 'TEC_VenueOrganizer_List.list.item', 'add_featured_img' );
@roytanck
roytanck / autoautoptimize.php
Last active January 25, 2023 06:45
Auto-configure Autoptimize across a WordPress network
<?php
/**
* Plugin Name: RT Autoautoptimize
* Plugin URI: http://www.this-play.nl
* Description: Automatically configures default settings for the Autoptimize plugin across a WordPress network
* Version: 0.9
* Author: Roy Tanck
* Author URI: http://www.this-play.nl
* License: GPL2
*/
@midoriberlin
midoriberlin / connect-custom-editor-style
Last active August 29, 2015 14:19
Connecting the WordPress post editor to your custom stylesheet
// Connect the WordPress post editor to your custom stylesheet
function my_theme_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'my_theme_add_editor_styles' );
@duogeekdev
duogeekdev / code.php
Last active January 23, 2017 19:34
Add featured image in rss feed in a wordpress site
<?php
function add_featured_image_in_rss() {
if ( function_exists( 'get_the_image' ) && ( $featured_image = get_the_image('format=array&echo=0') ) ) {
$featured_image[0] = $featured_image['url'];
} elseif ( function_exists( 'has_post_thumbnail' ) and has_post_thumbnail() ) {
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumbnail' );
} elseif ( function_exists( 'get_post_thumbnail_src' ) ) {
$featured_image = get_post_thumbnail_src();
@webmasterninjay
webmasterninjay / featured-image.php
Created April 8, 2015 23:13
Wordpress Genesis: Add featured image conditionally
@tomfinitely
tomfinitely / events-widgets.php
Last active December 4, 2021 01:23
The Events Calendar Pro - Cross-site Events Widget
<?php
if ( ! defined( 'ABSPATH' ) ) die('-1');
/*
* WDG-customized version of the Events Calendar Pro mini calendar widget.
* Changes are noted inline.
* Replacing class name: Tribe__Events__Pro__Mini_CalendarWidget
*/
class MultisiteTribeEventsProMiniCalendarWidget extends WP_Widget {
function __construct() {
@About2git
About2git / archive-books.php
Last active November 17, 2020 18:12 — forked from srikat/archive-books.php
Single and Archive templates for Custom Post Type in Genesis
<?php
//* Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Force full width content
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Remove entry meta in entry header
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
@jesseeproductions
jesseeproductions / ecp-genesis-sharing
Last active August 29, 2015 14:11
The Events Calendar Include Genesis Simple Sharing Above Event Calendar
/**
* The Events Calendar - Include Genesis Simple Sharing Above Single Events Content
*
*/
add_filter( 'tribe_events_single_event_before_the_content', 'tribe_genesis_event_share' );
function tribe_genesis_event_share( $post_info ) {
if ( is_singular('tribe_events') && function_exists( 'genesis_share_get_icon_output' ) ) {
global $Genesis_Simple_Share;
$share = genesis_share_get_icon_output( 'entry-meta', $Genesis_Simple_Share->icons );
@neilgee
neilgee / sidebar-cpt.php
Last active December 2, 2017 05:02
Genesis Simple Sidebar - Conditionally change cased on CPT
<?php
//do not copy the above opening php tag
/**
* Conditionally Change Sidebar in Genesis whilst using Simple Sidebars
*
* @package Genesis Simple Sidebar on Custom Post Type
* @author Neil Gee
* @link http://wpbeaches.com/set-sidebar-custom-post-type-genesis/
* @copyright (c) 2014, Neil Gee