Skip to content

Instantly share code, notes, and snippets.

View frankschrijvers's full-sized avatar

WPStudio frankschrijvers

View GitHub Profile
@frankschrijvers
frankschrijvers / text.txt
Created June 14, 2016 11:06
CTA text widget Seasons theme
<h3>Genesis e-commerce Theme</h3>
<h4>Start earning money by selling your products online</h4>
<a href class="button">Purchase Theme</a>
@frankschrijvers
frankschrijvers / widget.txt
Last active August 16, 2017 13:05
Tex twidget Seasons theme
<p><i class="fa fa-shopping-bag" aria-hidden="true"></i></p>
<h3>Sell Your Products</h3>
<p>Start earning money by selling your products with the Seasons theme.</p>
<a href class="button">Buy theme</a>
@frankschrijvers
frankschrijvers / text.txt
Created June 13, 2016 11:01
Shortcode WooCommerce
[recent_products per_page="5" columns="5"]
@frankschrijvers
frankschrijvers / functions.php
Last active October 24, 2016 02:40
Display field value on the WooCommerce order edition page and emails
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Display field value on the order edition page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'wps_select_checkout_field_display_admin_order_meta', 10, 1 );
function wps_select_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('Delivery option').':</strong> ' . get_post_meta( $order->id, 'daypart', true ) . '</p>';
}
@frankschrijvers
frankschrijvers / functions.php
Created June 9, 2016 14:29
Update the order meta with the field value
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Update the order meta with field value
add_action('woocommerce_checkout_update_order_meta', 'wps_select_checkout_field_update_order_meta');
function wps_select_checkout_field_update_order_meta( $order_id ) {
if ($_POST['daypart']) update_post_meta( $order_id, 'daypart', esc_attr($_POST['daypart']));
}
@frankschrijvers
frankschrijvers / functions.php
Created June 9, 2016 14:28
Process the checkout and set error message
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Process the checkout
add_action('woocommerce_checkout_process', 'wps_select_checkout_field_process');
function wps_select_checkout_field_process() {
global $woocommerce;
// Check if set, if its not set add an error.
if ($_POST['daypart'] == "blank")
@frankschrijvers
frankschrijvers / functions.php
Last active March 16, 2021 18:20
Add a custom select field to the WooCommerce checkout page
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add select field to the checkout page
add_action('woocommerce_before_order_notes', 'wps_add_select_checkout_field');
function wps_add_select_checkout_field( $checkout ) {
echo '<h2>'.__('Next Day Delivery').'</h2>';
woocommerce_form_field( 'daypart', array(
@frankschrijvers
frankschrijvers / functions.php
Last active June 6, 2016 12:16
Modify the Genesis content read more link
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Modify the Genesis content read more link
add_filter( 'get_the_content_more_link', 'wps_read_more_link' );
add_filter( 'the_content_more_link', 'wps_read_more_link' );
function wps_read_more_link($more) {
$read_more_title = sprintf( '<span class="screen-reader-text">%s %s</span>', __( 'about ', 'seasons' ), get_the_title() );
return sprintf( ' ... <a href="%s" class="more-link">%s %s</a>', get_permalink(), __( 'Continue Reading', 'seasons' ), $read_more_title );
@frankschrijvers
frankschrijvers / functions.php
Created June 3, 2016 14:34
Add Accessibility support
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add Accessibility support
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
@frankschrijvers
frankschrijvers / index.html
Created June 3, 2016 14:20
read more link genesis
<a href="https://www.wpstud.io/post-examples class="more-link">[Read more...] <span class="screen-reader-text">about Post examples</span></a>