Skip to content

Instantly share code, notes, and snippets.

@sillybean
sillybean / functions.php
Created Oct 16, 2016
Genesis breadcrumbs for tag1+tag2 or tag1,tag2 combined term archives
View functions.php
<?php
// Display titles of all terms in combined term archive breadcrumbs (tag1+tag2 or tag1,tag2)
function scl_multiple_tax_breadcrumbs( $crumbs, $args ) {
if ( !is_tax() )
return $crumbs;
$taxonomy = get_query_var( 'taxonomy' );
$topics = get_query_var( $taxonomy );
if ( empty( $topics ) )
@sillybean
sillybean / functions.php
Created Oct 16, 2016
Genesis titles for tag1+tag2 or tag1,tag2 combined term archives
View functions.php
<?php
// Have to unhook the original function early
add_action( 'init', 'scl_fix_taxonomy_archive_titles' );
function scl_fix_taxonomy_archive_titles() {
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
add_action( 'genesis_before_loop', 'scl_do_taxonomy_title_description', 14 );
}
@sillybean
sillybean / archive-courses.php
Created Oct 16, 2016
Course catalog using table loop for Genesis
View archive-courses.php
<?php
// replace the usual post listing with directory table
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'scl_course_table_loop', 10 );
function scl_course_table_loop() {
if ( have_posts() ) :
@sillybean
sillybean / taxonomy.php
Created Oct 16, 2016
List post type links instead of posts if this taxonomy archive includes multiple post types
View taxonomy.php
<?php
add_action( 'genesis_meta', 'scl_taxonomy_loop_switch' );
function scl_taxonomy_loop_switch() {
if ( function_exists( 'scl_find_post_type' ) )
$type = tees_find_post_type();
else
$type = get_query_var( 'post_type' );
@sillybean
sillybean / blockquote-cite-tinymce.php
Last active Aug 1, 2017
Blockquote + Cite TinyMCE button PHP
View blockquote-cite-tinymce.php
<?php
function scl_pullquote_mce_button() {
// check if WYSIWYG is enabled
if ( 'true' == get_user_option( 'rich_editing' ) ) {
add_filter( 'mce_external_plugins', 'scl_pullquote_add_tinymce_plugin' );
add_filter( 'mce_buttons', 'scl_pullquote_register_mce_button' );
// enforce Dashicon font
echo '<style>
.dashicons-testimonial::before {
@sillybean
sillybean / blockquote-cite-tinymce.js
Created Oct 16, 2016
Blockquote + Cite TinyMCE button JS
View blockquote-cite-tinymce.js
(function() {
tinymce.PluginManager.add('blockquote_cite', function( editor, url ) {
editor.addButton( 'blockquote_cite', {
title: 'Blockquote & Cite',
icon: "icon dashicons-testimonial",
onclick: function() {
editor.windowManager.open( {
title: 'Insert Blockquote and Citation',
body: [
{
@sillybean
sillybean / sidebars.php
Created Oct 16, 2016
CPT-specific sidebars
View sidebars.php
<?php
add_action( 'get_header', 'scl_cpt_switch_sidebar' );
function scl_cpt_switch_sidebar() {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'scl_do_sidebar' );
}
function scl_do_sidebar() {
@sillybean
sillybean / screen-options.php
Created Oct 16, 2016
Turn off some screen options; turn ON others
View screen-options.php
<?php
add_filter( 'default_hidden_meta_boxes', 'scl_toggle_meta_boxes', 10, 2 );
function scl_toggle_meta_boxes( $hidden, $screen ) {
$hide_these = array(
'people_typediv',
'facility_typediv',
'genesis-theme-settings-version',
'genesis-theme-settings-feeds',
@sillybean
sillybean / footer-rich-text.php
Created Oct 16, 2016
Use an ACF rich text option instead of Genesis footer
View footer-rich-text.php
@sillybean
sillybean / footer-links.php
Last active Oct 17, 2016
Centrally managed footer links for TAMU sites
View footer-links.php
You can’t perform that action at this time.