Skip to content

Instantly share code, notes, and snippets.

View chancecorbeil's full-sized avatar
🐢
Turtle Stuff

Chance Corbeil chancecorbeil

🐢
Turtle Stuff
View GitHub Profile
@mikejolley
mikejolley / gist:1604009
Created January 13, 2012 00:31
WooCommerce - Add a special field to the checkout, order emails and user/order meta
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
/**
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@jameskoster
jameskoster / functions.php
Last active November 22, 2022 13:34
WooCommerce - Rename product data tabs
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab
return $tabs;
}
@intelliweb
intelliweb / is_tree.php
Last active March 1, 2021 20:57
WP: is_tree() function to check if the current page is the page or a sub page of the page ID specified. Can be used as conditional tag with Widget Logic. Source: http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page
<?php
// This function will return true if we are looking at the page in question or one of its sub pages
function is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( is_page($pid) )
return TRUE; // we're at the page or at a sub page
$anc = get_post_ancestors( $post->ID );
@chancecorbeil
chancecorbeil / Alternate title tags in WordPress
Created June 27, 2015 23:48
Alternating h1 and h2 title tags, depending if page is home page or not
<?php if(is_front_page()) : ?>
<!-- This is a homepage -->
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php endif; ?>
<?php if(!is_front_page()) : ?>
<!-- This is not a homepage -->
<h2 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
<?php endif; ?>
@rveitch
rveitch / sass-7-1-pattern.scss
Last active July 4, 2024 17:36
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@jpcontrerasv
jpcontrerasv / ACF If Else field.php
Created August 26, 2016 04:46
ACF If Else field
<?php if ( get_field( 'field_name' ) ): ?>
This is displayed when the field_name is TRUE or has a value.
<?php else: // field_name returned false ?>
This is displayed when the field is FALSE, NULL or the field does not exist.
<?php endif; // end of if field_name logic ?>
@paulfarino
paulfarino / sass-theme.scss
Created October 21, 2016 22:02
Sass Theming
// Variables
$black : #000000;
$white : #FFFFFF;
$alpha : #FF0000;
$themes: (
blue: (
alpha: blue,
beta: orange
),
@sanoop-jose
sanoop-jose / sass-theme.scss
Created June 14, 2018 19:32
SASS Theme example theme file
$themes: (
light: (
backgroundLight: #fff,
backgroundDark: #f7f7f8,
textColor: #fff,
textDark: #000,
textLight: #919394,
contentColor: #b9baba,
iconColor: #000,