Skip to content

Instantly share code, notes, and snippets.

View nextab's full-sized avatar

nexTab - Oliver Gehrmann nextab

View GitHub Profile
/* #region max-width 980px */
@media only screen and (max-width: 980px) {
header .et_pb_menu .et_pb_menu_inner_container {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
}
header .et_pb_menu .et_pb_menu_inner_container > .et_pb_menu__logo-wrap {
margin-bottom: 0;
}
# Standard Input Variables for the Divi Theme
php_value max_execution_time 240
php_value max_input_time 90
php_value max_input_vars 3000
php_value memory_limit 512M
# Redirect everything (no matter whether it's non-https or with www.) to https://yourdomain.com
RewriteEngine on
// Enqueue the script on the booking page
function zmmt_payment_enqueue_script() {
$temp_user_data = get_user_meta(get_current_user_id());
$user_data = array_map(function ($item) {
return $item[0];
}, $temp_user_data);
// Filter out all user data that we don't need
$keysToKeep = [
'nickname',
'first_name',
#region CCT Super Custom Lookup - Get everything from CCT
/**
*
* @param array $find_columns array of column names to find
* @param string $table_name - slug of the CCT; global WPDB prefix and 'jet_cct_' will be appended; defaults to 'event_registrations'
* @param string $where - where clause to check against
*
* @return array|null returns an associative array of the $find_columns if something was found for the where clause
*
*
#region CCT Lookup (multiple values) - Get multiple fields in CCT from JetEngine table
/**
*
* @param array $find_columns array of column names to find
* @param string $needle - value that needs to be checked against
* @param string $lookup_column - column name to check $needle against
* @param string $table - slug of the CCT; global WPDB prefix and 'jet_cct_' will be appended; defaults to 'user_information'
*
* @return array|null returns an associative array of the $find_columns if the $lookup_column matches the $needle; null if no match is found
*
// goes into constructor:
register_activation_hook(__FILE__, array($this, 'schedule_cache_update'));
register_deactivation_hook(__FILE__, array($this, 'clear_scheduled_event'));
add_action('proven_expert_update_cache_event', array($this, 'my_callback_function'));
// register / unregister hook on activation / deactivation of plugin
// -> proven_expert_update_cache_event wird als neue action im System registriert UND an einen cronjob gehängt!
#region Macro for JetEngine that looks up CCT values
/* This macro allows you to look up a CCT value from the connected CPT. Every custom content type that's connected to a CPT in JetEngine has a data column "cct_single_post_id" in which it saves the ID of the corresponding custom post type. Knowing that, you can access all the CCT keys with a custom lookup function and create a macro that wraps it and makes it relatively easy to use
*
* @param $prop_key - the CCT key you want to look up - defaults to "zmmt_email"
* @param $lookup_column - the column in the CCT table that contains the ID of the corresponding CPT - defaults to "cct_single_post_id"
* @param $table - the CCT table name - defaults to "zmmt_contacts"
*
* If you want to look up the field "zmmt_email" for a custom post type "contact", all you need to use is %get_cct_value% thanks to the defaults
* If you wanted to look up the field "zmmt_phone" for a custom post type "contact", you'd use %get_cct_value|zmmt_phone|cct_single_post_id|zmmt_cont
add_filter("jet-form-builder/render/hidden-field", function( $args ) {
if ( function_exists( 'jet_engine' ) ) {
$args[ 'field_value' ] = jet_engine()->listings->macros->do_macros( $args[ 'field_value' ] );
}
return $args;
});
// You can add this filter to functions.php:
add_filter('jet-search/ajax-search/custom-post-data', function( $custom_data, $data, $post ) {
$custom_data['post_id'] = $post->ID ?? 0;
return $custom_data;
}, 0, 3 );
// And then use {{{data.post_id}}} in the template.
/**
* Remove bloated inline core color styles.
*
* @param \WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
*
* @return \WP_Theme_JSON_Data
*/
add_filter(
'wp_theme_json_data_default',
function( $theme_json ) {