Skip to content

Instantly share code, notes, and snippets.

View karks88's full-sized avatar

Eric Karkovack karks88

View GitHub Profile
<?php
// Show the Emergency Message, if it is set to "Yes".
if( get_field('show_the_emergency_notice') == 'yes' ): ?>
<div class="emergency">
<div class="emergency-inner"><?php if ( get_field('icon') ): ?><?php the_field( 'icon' ); ?><?php endif; ?> <?php the_field('emergency_notice'); ?></div>
</div>
<?php endif; // end of Emergency Message ?>
[
{
"key": "group_5812148bf1470",
"title": "Emergency Notice",
"fields": [
{
"key": "field_581214f410f14",
"label": "About Emergency Notices",
"name": "",
"type": "message",
@karks88
karks88 / woocommerce_add_product_message_based_on_category
Last active December 13, 2019 18:50
Show a message based on WooCommerce product category
<?php
// Add a message on the top of each product in the "Toys" category.
add_action( 'woocommerce_before_single_product', 'my_product_notice_function' );
function my_product_notice_function() { // Custom function.
if ( is_product() && has_term( 'Toys', 'product_cat' ) ) { // Only run this code if the product is in the “Toys” category.
echo '<p><strong>Note: Place your order by December 20 and select 1-Day shipping for guaranteed holiday delivery!</strong></p>'; // Message we're adding to the top of the product page.
@karks88
karks88 / woocommerce_add_product_message
Last active December 13, 2019 18:48
Add a message to the top of every WooCommerce product page.
<?php
// Add a message on the top of each product's page.
add_action( 'woocommerce_before_single_product', 'my_product_notice_function' );
function my_product_notice_function() { // Custom function.
echo '<p><strong>Note: Place your order by December 20 and select 1-Day shipping for guaranteed holiday delivery!</strong></p>'; // Message we're adding to the top of each product page.
}
?>
@karks88
karks88 / remove_woocommerce_related_products
Last active December 13, 2019 17:31
Remove WooCommerce Related Products
@karks88
karks88 / handy-links-widget.php
Last active March 25, 2023 00:31
Handy Links Widget for WordPress