Skip to content

Instantly share code, notes, and snippets.

@zarankumar
Created October 6, 2015 10:55
Show Gist options
  • Save zarankumar/6a788f0cd0c4c8cdacf4 to your computer and use it in GitHub Desktop.
Save zarankumar/6a788f0cd0c4c8cdacf4 to your computer and use it in GitHub Desktop.
/** Custom Tabs for Opening Hours. **/
function opening_hours_options_tab() {
?>
<li class="opening_hours"><a href="#opening_hours_data"><?php _e('Cab Price Settings', 'yatramantra'); ?></a></li>
<li class="opening_hours"><a href="#opening_hours_data"><?php _e('Hotel Price Settings', 'yatramantra'); ?></a></li>
<?php
}
add_action('woocommerce_product_write_panel_tabs', 'opening_hours_options_tab');
/**
* Custom Tab Options
*
* Provides the input fields and add/remove buttons for custom tabs on the single product page.
*/
function opening_hours_options() {
global $post;
$opening_hours_options = array(
'title' => get_post_meta($post->ID, 'opening_hours_title', true),
'content' => get_post_meta($post->ID, 'opening_hours_content', true),
);
?>
<div id="opening_hours_data" class="panel woocommerce_options_panel">
<div class="club-opening-hours">
<p class="form-field">
<?php
// Opening Hours Custom field Type
?>
<p class="form-field day_field_type">
<label for="day_field_type"><?php echo __( 'Opening Hours', 'woocommerce' ); ?></label>
<span class="wrap">
</span>
<span class="description"><?php _e( 'e.g. 06:00-22:00', 'woocommerce' ); ?></span>
</p>
</div>
</div>
<?php
}
add_action('woocommerce_product_write_panels', 'opening_hours_options');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment