Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / WP Customizer - URL
Created June 19, 2018 08:01 — forked from ajskelton/WP Customizer - URL
Add a URL field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_url_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_url',
) );
$wp_customize->add_control( 'themeslug_url_setting_id', array(
'type' => 'url',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom URL' ),
'description' => __( 'This is a custom url input.' ),
<?php
// Change the footer text in Genesis with a back up if blank
add_filter('genesis_footer_creds_text', 'genesischild_footer_text');
function genesischild_footer_text() {
if( get_theme_mod( 'footer_text_block') != "" ) {
echo get_theme_mod( 'footer_text_block');
}
else{
@jamiemitchell
jamiemitchell / functions.php
Created June 17, 2018 07:25 — forked from wpspeak/functions.php
Add shortcode for search form in Genesis Framework
<?php
/**
* Search Shortcode Excerpt
* @since 1.1 Genesis 404 Page plugin
* @author Bill Erickson
*/
function search_shortcode() {
return '<div class="genesis-404-search">' . get_search_form( false ) . '</div>';
}
@jamiemitchell
jamiemitchell / 404.php
Created June 17, 2018 07:22 — forked from pamhirsch/404.php
Custom 404 page for Genesis
<?php
/**
*
* @package LCW\Templates
* @author Pamela Hirsch
* @license GPL-2.0+
* @link http://www.pamelahirsch.com/services
*/
add_action( 'genesis_meta', 'phc_genesis_meta' );
@jamiemitchell
jamiemitchell / function.php
Created June 17, 2018 07:22 — forked from Komock/function.php
Genesis remove .site-inner markup
<?php
//* Remove .site-inner
add_filter( 'genesis_markup_site-inner', '__return_null' );
add_filter( 'genesis_markup_content-sidebar-wrap_output', '__return_false' );
add_filter( 'genesis_markup_content', '__return_null' );
?>
jQuery( document ).ready( function( $ ) {
jQuery( '.content' ).masonry();
} );
jQuery( 'img' ).load(function() {
jQuery( '.content' ).masonry();
} );
@jamiemitchell
jamiemitchell / get-woocommerce-categories.php
Created April 5, 2018 01:58 — forked from rajeebbanstola/get-woocommerce-categories.php
Simple way to fetch WooCommerce Categories with Image and Description
<?php
$get_featured_cats = array(
'taxonomy' => 'product_cat',
'orderby' => 'name',
'hide_empty' => '0',
'include' => $cat_array
);
$all_categories = get_categories( $get_featured_cats );
$j = 1;
@jamiemitchell
jamiemitchell / remove-standard-and-load-custom-genesis-sidebar.php
Created April 2, 2018 03:48 — forked from duroe5698/remove-standard-and-load-custom-genesis-sidebar.php
Remove Primary Sidebar and Replace with Custom Sidebar Genesis Framework Snippet
<?php
//* Insert into custom page template to remove primary sidebar and replace with your custom sidebar.
function md_do_sidebar() {
dynamic_sidebar( 'SIDEBAR ID' );
}
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'md_do_sidebar' );
?>
@jamiemitchell
jamiemitchell / Genesis Custom Sidebar
Created April 2, 2018 03:35 — forked from jacobwise/Genesis Custom Sidebar
Switch Genesis Primary sidebar for a custom sidebar
<?php
//* Remove Primary Sidebar if blog, single, or CPT
add_action( 'get_header', 'jw_remove_primary_sidebar' );
function jw_remove_primary_sidebar() {
if ( is_singular( 'post' ) || is_home() || is_singular( 'code' ) || is_singular( 'tutorial' ) || is_archive() ) {
/** Remove default sidebar */
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize search form input box text
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
return esc_attr( 'Search my blog...' );
}