Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick R. Duncan rickrduncan

View GitHub Profile
@rickrduncan
rickrduncan / schema-logo.php
Last active May 15, 2017
Filter the Genesis 2.0 SEO title to remove the H1 tag and implement the Organization/Logo schema.
View schema-logo.php
<?php
//* Do NOT include the opening php tag
//* Add Organization schema to our logo
//* Note that logo location is not inside WordPress. It's in a folder named 'img' off of the root of website.
add_filter( 'genesis_seo_title', 'b3m_header_title', 10, 3 );
function b3m_header_title( $title, $inside, $wrap ) {
$inside = sprintf( '<div itemscope="itemscope" itemtype="http://schema.org/Organization"><a itemprop="url" href="%s" title="%s"><img class="logo" itemprop="logo" src="http://www.YOUR-DOMAIN.com/img/YOUR-LOGO.png" alt="%s" /></a></div>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
return sprintf( '<%1$s id="title">%2$s</%1$s>', 'span', $inside );
}
@rickrduncan
rickrduncan / google-cse-genesis.php
Last active Nov 19, 2016
Google CSE for WordPress/Genesis Framework
View google-cse-genesis.php
<?php
/*
* Template Name: Google CSE
*
* This file adds the Google SERP template to our Genesis Child Theme.
*
* @author Rick R. Duncan
* @link http://rickrduncan.com
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
*
View genesis-search-form-label.php
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize Genesis search form label
add_filter( 'genesis_search_form_label', 'b3m_search_form_label' );
function b3m_search_form_label ( $text ) {
return esc_attr( 'Enter your text here...' );
View customize-genesis-search-button.php
<?php
//* Do NOT include the opening php tag above
//* Customize the default search button text
add_filter( 'genesis_search_button_text', 'b3m_genesis_search_button_text' );
function b3m_genesis_search_button_text( $text ) {
return esc_attr( 'Go' );
}
View genesis-search-form-input-box.php
<?php
//* Do NOT include the opening php tag above
//* Customize search form input box text of Genesis child themes
add_filter( 'genesis_search_text', 'b3m_genesis_search_text' );
function b3m_genesis_search_text( $text ) {
return esc_attr( 'Search my blog...' );
View functions.php
<?php
//* Do NOT include the opening php tag
//* Enqueue FontAwesome. Note that the current version in the code is 4.5.0. Update as necessary.
//* https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts
//* https://fortawesome.github.io/Font-Awesome/icons/
<?php
//* Do NOT include the opening php tag
@rickrduncan
rickrduncan / 0_reuse_code.js
Created Jan 17, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View dashicon-genesis-searchbox-styles.css
.search-form {
position: relative;
}
.search-form > input {
padding-left: 40px;
}
.search-form input[type="submit"] {
background: none !important;
View dashicon-search-button-genesis.php
<?php
//* Do NOT include the opening php tag
//* Use dashicon for search button
//* http://melchoyce.github.io/dashicons/
add_filter( 'genesis_search_button_text', 'b3m_search_button_dashicon' );
function b3m_search_button_dashicon( $text ) {
return esc_attr( '&#xf179;' );
View enqueue-dashicons.php
<?php
//* Do NOT include the opening php tag
//* Enqueue Dashicons
add_action( 'wp_enqueue_scripts', 'b3m_enqueue_dashicons' );
function b3m_enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
You can’t perform that action at this time.