Skip to content

Instantly share code, notes, and snippets.

@zimaben
Last active December 30, 2021 11:36
Show Gist options
  • Save zimaben/291fa687287cfffe12cc96db899aec0b to your computer and use it in GitHub Desktop.
Save zimaben/291fa687287cfffe12cc96db899aec0b to your computer and use it in GitHub Desktop.
<?php
use Carbon_Fields\Container;
use Carbon_Fields\Field;
/*
* This File Creates a Theme Options page with Carbon Fields and adds the info
* we need to do basic Slack Integration
*
*/
if( class_exists('Carbon_Fields\Container')){
\add_action('carbon_fields_register_fields', function(){
Container::make( 'theme_options', __( 'Theme Options', 'theme_slug ) )
->add_tab( 'Slack', array(
Field::make( 'complex', 'slack_bots', 'Slack Integrations' )
->add_fields( array(
Field::make( 'text', 'slack_bot_name', 'Bot Name' )
->set_help_text('Example: Slack Notification Bot'),
Field::make( 'text', 'slack_bot_channel', 'Channel to Post to')
->set_help_text('Without the # please'),
Field::make( 'text', 'slack_bot_customer_id', 'Optional Field To Look Up Client in DB'),
Field::make( 'text', 'slack_bot_webhook', 'Webhook')
) ),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment