Skip to content

Instantly share code, notes, and snippets.

@FellowshipAgency
Created June 14, 2017 09:51
Show Gist options
  • Save FellowshipAgency/60517f35071b195abe6f8d854afbd1d7 to your computer and use it in GitHub Desktop.
Save FellowshipAgency/60517f35071b195abe6f8d854afbd1d7 to your computer and use it in GitHub Desktop.
Holiday Messages for Rubious plugin
<?php
/* ==========================================================================
Holiday Message Hooks
============================================================================= */
if(function_exists('holiday_messages')) {
// Before Cart
add_action('woocommerce_before_cart', 'rubious_holiday_messages_before_cart');
function rubious_holiday_messages_before_cart() {
$holidays = holiday_messages();
foreach($holidays as $holiday) { ?>
<div class="woocommerce-info holiday_error theme-<?php echo $holiday["Theme"];?>">
<?php if($holiday["Link"]) { ?><a href="<?php echo $holiday["Link"]; ?>" class="dark-btn">Read more</a><?php } ?>
<p style="max-width:90%;margin-bottom:0px;">
<?php if($holiday["Title"]) { ?><strong><?php echo $holiday["Title"]; ?></strong><br><?php } ?>
<?php echo $holiday["Message"];?></p>
</div>
<?php
}
}
// Emailer
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );
function add_order_email_instructions( $order, $sent_to_admin ) {
if ( ! $sent_to_admin ) {
$holidays = holiday_messages();
foreach($holidays as $holiday) { ?>
<div class="woocommerce-info holiday_error theme-<?php echo $holiday["Theme"];?>">
<?php if($holiday["Link"]) { ?><a href="<?php echo $holiday["Link"]; ?>" class="dark-btn">Read more</a><?php } ?>
<p style="max-width:90%;margin-bottom:0px;">
<?php if($holiday["Title"]) { ?><strong><?php echo $holiday["Title"]; ?></strong><br><?php } ?>
<?php echo $holiday["Message"];?></p>
</div>
<?php
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment