Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
@braddalton
braddalton / wc-change-placeholder-image.php
Created October 2, 2023 08:26 — forked from woogists/wc-change-placeholder-image.php
[Theming Snippets] Change the placeholder image
/**
* Change the placeholder image
*/
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
// replace with path to your image
$src = $uploads . '/2012/07/thumb1.jpg';
@braddalton
braddalton / class-custom-feed.php
Created May 30, 2019 22:16 — forked from ocean90/class-custom-feed.php
How to add a custom feed to WordPress
<?php
/**
* Add a custom feed to WordPress.
*
* The feed will be rendered through the wp-includes/feed-rss2.php template
* and avaiable under example.com/feed/{$feed_slug}.
*
* Note: Don't forget to flush the rewrite rules once.
*
* @author Dominik Schilling
@braddalton
braddalton / credits-1.php
Created March 9, 2019 19:33 — forked from studiopress/credits-1.php
Genesis footer.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize the credits
add_filter( 'genesis_footer_creds_text', 'sp_footer_creds_text' );
function sp_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date('Y');
echo ' &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
@braddalton
braddalton / functions.php
Last active October 11, 2017 05:12 — forked from pippinsplugins/gist:9641841
Track Users I.P Address in WordPress Theme
add_action( 'loop_start', 'display_users_ip_address' );
function display_users_ip_address() {
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
@braddalton
braddalton / functions.php
Last active April 16, 2019 14:43 — forked from studiopress/nav-extras.php
Add Search Form To Nav Menu In Genesis
add_filter( 'wp_nav_menu_items', 'add_search_genesis_menu', 10, 2 );
function add_search_genesis_menu( $menu, $args ) {
if ( 'primary' !== $args->theme_location )
return $menu;
ob_start();
get_search_form();
$search = ob_get_clean();
$menu .= '<li class="search">' . $search . '</li>';
@braddalton
braddalton / page_blog.php
Last active September 5, 2017 05:26 — forked from studiopress/page_blog.php
Remove Featured Image From Genesis Blog Page https://wp.me/p1lTu0-gNB
<?php
//* Template Name: Custom Blog
genesis();
@braddalton
braddalton / gist:e1e1e69ceea697fb20fcc6fb3b4e216a
Created December 5, 2016 15:16 — forked from mikejolley/gist:2044101
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
var position = 0,
images = [
'image1.jpg',
'image2.jpg',
'image3.jpg'
];
$.backstretch(images[position]);
setInterval(function() {
if(position++ > images.length) position = 0;
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Setup Theme
include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
//* Set Localization (do not remove)
load_child_theme_textdomain( 'outreach', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'outreach' ) );
@braddalton
braddalton / columns.css
Created June 20, 2016 04:41 — forked from studiopress/columns.css
Genesis column classes.
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,