This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('template_redirect', function() { | |
if (!isset($_GET['import_ciso_workshops'])) { | |
return; | |
} | |
global $wpdb; | |
$data_to_import = json_decode(file_get_contents(dirname(__FILE__) . '/import_data/Programs/ciso-workshops.json'), TRUE); | |
if (empty($data_to_import)) { | |
echo 'Invalid file'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', 'crb_remove_editor_init'); | |
function crb_remove_editor_init() { | |
if (!is_admin()) { | |
return; | |
} | |
$current_post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT ); | |
$update_post_id = filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function crb_encode_short_ref_code($id) { | |
// if (!is_int($id)) { | |
// echo 'not an int'; | |
// } | |
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | |
if ($id == 0) { | |
return $chars[0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Home | |
*/ | |
get_header(); ?> | |
<?php if (have_posts()): ?> | |
<?php while (have_posts()): the_post(); ?> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Carbon_Fields\Container\Container; | |
use Carbon_Fields\Field\Field; | |
Container::make('post_meta', __('Homepage Options', 'crb')) | |
->show_on_post_type('page') | |
->show_on_template('templates/home.php') | |
->add_fields(array( | |
Field::make('complex', 'crb_home_slides', __('Slides', 'crb'))->add_fields(array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($found_users) { | |
$salons_sql = " | |
SELECT DISTINCT um.meta_value | |
FROM $wpdb->usermeta AS um | |
WHERE um.meta_key = '_crb_user_salon' | |
AND um.meta_value<>'' | |
AND um.user_id IN(".implode(', ', array_fill(0, count($found_users), '%s')).") | |
"; | |
$salons_query = call_user_func_array(array($wpdb, 'prepare'), array_merge(array($salons_sql), $found_users)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Carbon_Container::factory('user_meta', 'User Additional Info') | |
->add_fields(array( | |
Carbon_Field::factory('text', 'crb_user_phone', 'Phone'), | |
Carbon_Field::factory('select', 'crb_user_location_type', 'Location Type')->add_options(array( | |
'flexible' => 'Flexible Location', | |
'fixed' => 'Fixed Location', | |
)), | |
Carbon_Group::factory('Freelance Stylist Additional Options') | |
->set_conditional_logic(array( | |
'relation' => 'AND', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!empty($_POST['field-password'])) { | |
$default_user_id = carbon_get_theme_option('crb_default_user'); | |
if (!$default_user_id) { | |
echo 'Something went wrong'; | |
return; | |
} | |
$default_user = get_user_by('id', $default_user_id); | |
$errors=array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'gform_after_submission', 'crb_send_dynamic_email', 10, 2 ); | |
function crb_send_dynamic_email( $entry, $form ) { | |
// Check for only Popup Form | |
$custom_form = carbon_get_theme_option('crb_popup_form'); | |
if ($custom_form != $entry['form_id']) { | |
return; | |
} | |
//Simple validation | |
$email = $entry[2]; |
NewerOlder