Skip to content

Instantly share code, notes, and snippets.

View rickrduncan's full-sized avatar

Rick R. Duncan rickrduncan

View GitHub Profile
@rickrduncan
rickrduncan / edd-downloads-name.php
Created January 17, 2014 20:03
Customizations for Easy Digital Downloads.
<?php
//* Do NOT include the opening php tag
//* Change default global labels of Download and Downloads to Product and Products
add_filter('edd_default_downloads_name', 'b3m_edd_product_labels');
function b3m_edd_product_labels( $labels ) {
$labels = array(
'singular' => __('Product', 'b3m'),
'plural' => __('Products', 'b3m')
@rickrduncan
rickrduncan / remove-editor-wp.php
Last active January 3, 2016 18:49
Remove 'Editor' from the 'Appearance' menu to keep users from editing your theme and plugin files from inside of WordPress.
<?php
//* Do NOT include the opening php tag
//* Remove 'Editor' from 'Appearance' Menu.
//* This stops users and hackers from being able to edit theme & plugiin files from within the WordPress dashboard.
if ( ! defined( 'DISALLOW_FILE_EDIT' ) )
define( 'DISALLOW_FILE_EDIT', true );
@rickrduncan
rickrduncan / custom-genesis-search-form.php
Last active November 9, 2017 07:29
508 compliant Genesis search form
<?php
//* Do NOT include the opening php tag
//* Alter the Genesis Search for so that we can change the destination page and our querystring parameter.
add_filter( 'genesis_search_form', 'b3m_search_form', 10, 4);
function b3m_search_form( $form, $search_text, $button_text, $label ) {
$onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
$onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";
$form = '<form role="search" method="get" class="searchform search-form" action="' . home_url() . '/search">
@rickrduncan
rickrduncan / remove-seo.php
Created February 7, 2014 11:47
Remove 'SEO' from admin bar for users of WordPress SEO by Yoast. The code belongs in your functions.php file or better yet a functionality plugin.
<?php
//* Do NOT include the opening php tag
//* Remove the link 'SEO' from admin bar. It's placed there by the plugin WordPress SEO by Yoast.
add_action( 'wp_before_admin_bar_render', 'wlwp_admin_bar' );
function wlwp_admin_bar(){
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wpseo-menu');
}
jQuery(function( $ ){
$("header #menu-right-menu").addClass("responsive-menu").before('<div id="responsive-menu-icon"></div>');
$("#responsive-menu-icon").click(function(){
$("header #menu-right-menu").slideToggle();
});
$(window).resize(function(){
if(window.innerWidth > 768) {
@rickrduncan
rickrduncan / oembed-gist.php
Last active October 3, 2019 04:34
A quick fix to this plugin: http://wordpress.org/plugins/oembed-gist/. Line 57, 61 & 69 were changed to rename the variable from 'gist' to 'oe-gist.' Line 79 was edited to add isset() to stop the error I was getting while testing.
<?php
/*
Plugin Name: oEmbed Gist
Plugin URI: http://firegoby.jp/wp/oembed-gist
Description: Embed source from gist.github.
Author: Takayuki Miyauchi
Version: 1.4.0
Author URI: http://firegoby.jp/
*/
@rickrduncan
rickrduncan / jetpack-share-after-post-title.php
Last active August 29, 2015 13:59
Reposition JetPack share buttons to below post title for users of the Genesis Framework.
<?php
//* Do NOT include the opening php tag
//* Add Jetpack share buttons above post
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
add_filter( 'the_content', 'b3m_share_buttons_above_post', 19 );
add_filter( 'the_excerpt', 'b3m_share_buttons_above_post', 19 );
@rickrduncan
rickrduncan / child-theme-url.php
Created April 16, 2014 19:52
A shortcode to output your child theme URL to be used in Posts, Pages and/or Widgets.
<?php
//* Do NOT include the opening php tag
//* Get path to our child theme folder
//* Useage: [theme-url]
function b3m_theme_uri_shortcode( $attrs = array (), $content = '' ) {
$theme_uri = is_child_theme() ? get_stylesheet_directory_uri() : get_template_directory_uri();
return $theme_uri;
@rickrduncan
rickrduncan / archive-order-by.php
Created April 25, 2014 10:37
Order WordPress archive posts by "Title" in "Ascending" order for one specific category.
<?php
//* Do NOT include the opening php tag
function b3m_before_loop () {
if( is_category( '1' ) ) {
global $query_string;
query_posts( wp_parse_args( $query_string, array( 'orderby' => 'title', 'order' => 'ASC' ) ) );
.search-form {
position: relative;
}
.search-form > input {
padding-left: 40px;
}
.search-form input[type="submit"] {
background: none !important;