Skip to content

Instantly share code, notes, and snippets.

Rick R. Duncan rickrduncan

Block or report user

Report or block rickrduncan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View metro-theme-footer.php
View widget-titles-1.css
/* Use CSS to customize WordPress widget titles */
.widget-area .widget_recent_entries h4 {
background: url("images/image-name.png") no-repeat scroll left 6px transparent;
padding-left: 40px;
}
.widget-area h4 {
border-bottom: 4px double #ccc;
border-top: 4px double #ccc;
font-size: 24px;
View widget-title-2.php
<?php
//* Do NOT include this comment or the opening php tag above
//* Insert SPAN tag into widgettitle
add_filter( 'dynamic_sidebar_params', 'b3m_wrap_widget_titles', 20 );
function b3m_wrap_widget_titles( array $params ) {
// $params will ordinarily be an array of 2 elements, we're only interested in the first element
$widget =& $params[0];
$widget['before_title'] = '<h4 class="widgettitle"><span class="sidebar-title">';
$widget['after_title'] = '</span></h4>';
View widget-title-3.php
<?php
//* Do NOT include this comment or the opening php tag above
//* Wrap first word of widget title into a span tag
add_filter ( 'widget_title', 'b3m_add_span_widgets' );
function b3m_add_span_widgets( $old_title ) {
$title = explode( " ", $old_title, 2 );
if ( isset( $title[0] ) && isset( $title[1] ) ) {
View widget-title-4.php
<?php
//-> Do NOT include the opening php tag
// Step 2: Place code below into your theme's functions.php file
if ( include( 'custom_widgets.php' ) ){
add_action( "widgets_init", "load_custom_widgets" );
}
function load_custom_widgets() {
unregister_widget( "WP_Widget_Text" );
register_widget( "WP_Widget_Text_Custom" );
View custom_widgets.php
<?php
/**
* Recent_Posts widget class
*
* @since 2.8.0
*/
class WP_Widget_Recent_Posts_Custom extends WP_Widget_Recent_Posts {
function __construct() {
View responsive-menu-genesis.js
<script type="text/javascript">// <![CDATA[
jQuery(document).ready(function($){
/* prepend menu icon */
$('#title-area').append('<div id="mobile-menu"></div>');
/* toggle nav */
$("#mobile-menu").on("click", function(){
$("#nav_menu-2").slideToggle();
$(this).toggleClass("active");
});
@rickrduncan
rickrduncan / google-adsense-archive-2.php
Last active Dec 20, 2015
Add Google AdSense into WordPress category pages.
View google-adsense-archive-2.php
<!-- STEP 2 -->
<!-- The code below is placed into a file named adsense-archive.php as noted in the Gist above. -->
<div id="archive-adsense-wrapper">
<div class="ad-left">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxx";
google_ad_width = 250;
google_ad_height = 250;
@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 );
}
View rvam-post-info.php
<?php
//* Do NOT include the opening php tag
/**
* Custom Post-Info with Google Rich Snippet support
* @link: https://gist.github.com/rickrduncan/6494748
* @author: Rick R. Duncan - www.rvamedia.com
* @credits: Greg Rickaby & Brad Dalton
*/
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
You can’t perform that action at this time.