Instantly share code, notes, and snippets.

View functions.php
<?php
add_action( "customize_register", "am_customizer_mods" );
function am_customizer_mods( $wp_customize ) {
//* Remove 'header image' Control
$wp_customize->remove_control("header_image");
//* Remove 'widgets' Panel
$wp_customize->remove_panel("widgets");
View functions.php
<?php
//* Add support for a Custom Logo
add_theme_support( 'custom-logo', array(
'width' => 260,
'height' => 100,
'flex-width' => true,
'flex-height' => true,
) );
View theme-setup.php
<?php
// Add featured image on single post
add_action( 'genesis_entry_header', 'hellopro_featured_image', 1 );
function hellopro_featured_image() {
$image = genesis_get_image( array(
'format' => 'html',
'size' => 'featured',
'context' => '',
'attr' => array ( 'class' => 'aligncenter' ),
View functions.php
<?php
/* ADD 'WEBSITE' REQUIRED FIELD TO CHECKOUT PAGE
----------------------------------------------------------------------------- */
//* Check if a specific product ID is in the cart
function hm_product_is_in_cart( $ids ) {
// Products currently in the cart
$cart_ids = array();
// Find each product in the cart and add it to the $cart_ids array
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) {
View functions.php
<?php
// WooCommerce -- allow editing of Orders regardless of Status
add_filter ( 'wc_order_is_editable', 'force_order_statuses_to_editable' );
function force_order_statuses_to_editable () {
return TRUE;
}
?>
View theme-setup.php
<?php
// Copy/Paste this code to overwrite the current code, starting at Line 220 of /coaching-pro/lib/theme-setup.php
add_action( 'genesis_entry_header', 'coaching_pro_show_featured_post_image', 1 );
function coaching_pro_show_featured_post_image() {
// only show on single posts and pages
if ( ! is_single() && ! is_page() || ! has_post_thumbnail() ) {
return;
}
View functions.php
<?php
function is_product_in_cart( $prodID ) {
$cartID = WC()->cart->generate_cart_id( $prodID );
$in_cart = WC()->cart->find_product_in_cart( $cartID );
if ( $in_cart ) {
return true;
}
return false;
}
View sticky-nav.js
jQuery(document).ready(function($) {
// Optimization: Store the references outside the event handler:
var $window = $(window);
// maximum height of site-header element (before sticky)
var maxHeaderHeight = $('body.sticky-header .site-header:not(.sticky)').outerHeight();
/* De-Bouncer script: pause resize calculations until last resize event is finished */
/* http://www.hnldesign.nl/work/code/debouncing-events-with-jquery/ */
View form-content.html
<!-- // The HTML (could be part of page content) // -->
<input type="text" name="keyword" id="keyword" onkeyup="fetch()"></input>
<div id="datafetch">Search results will appear here</div>
View functions.php
<?php
/* CREATE THE NEW CUSTOM TAB
---------------------------------------------------- */
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'woocommerce' ),
'target' => 'my_custom_product_data',