CCT repeater tree callback

// Callback pre JetEngine Dynamic Field – vykreslí vnorený repeater ako strom add_filter( ‘jet-engine/listings/allowed-callbacks’, function ( $callbacks ) { $callbacks[‘gruppa_render_terms_tree’] = ‘Render terms tree’; return $callbacks; } ); function gruppa_render_terms_tree( $items, $child_key = ‘terms’ ) { $items = maybe_unserialize( $items…Continue reading

PHP Runtime Diagnostic

add_filter( ‘debug_information’, function ( $info ) { if ( ! current_user_can( ‘manage_options’ ) ) { return $info; } $settings = ini_get_all( null, true ); $memory = $settings[‘memory_limit’] ?? []; $values = [ ‘PHP version’ => PHP_VERSION, ‘PHP handler’ => PHP_SAPI,…Continue reading

Enable Admin Email after Formidable Forms Entry Saved as Spam

add_action( ‘frm_after_create_entry’, ‘rd_email_admin_on_spam_entry’, 30, 2 ); function rd_email_admin_on_spam_entry( $entry_id, $form_id ) { $entry = FrmEntry::getOne( $entry_id ); if ( ! $entry || ! FrmSpamEntriesHelper::is_spam( $entry ) ) { return; } $recipient = ‘[email protected]’; $url = admin_url( ‘admin.php?page=formidable-entries&frm_action=show&id=’ . $entry_id );…Continue reading

CCT ID display as name

function gt_id_label_map() { return array( // CCT slug => [ field => target ] ‘cct’ => array( // ‘articles’ => array( ‘type’ => ‘term:article-types’ ), ), // CPT slug => [ meta_key => target ] (adds a new admin column)…Continue reading

CCT select field width 100%

add_action( ‘admin_head’, function () { $page = isset( $_GET[‘page’] ) ? sanitize_key( $_GET[‘page’] ) : ”; if ( strpos( $page, ‘jet-cct-‘ ) !== 0 ) { return; } ?>Continue reading

Logout without confirmation

add_action(‘check_admin_referer’, ‘logout_without_confirm’, 10, 2); function logout_without_confirm($action, $result) { if ($action == “log-out” && !isset($_GET[‘_wpnonce’])) { $redirect_to = isset($_REQUEST[‘redirect_to’]) ? $_REQUEST[‘redirect_to’] : ‘https://gruppa.cloud’; /* https://gruppa.cloud/wp-login.php?action=logout */ $location = str_replace(‘&’, ‘&’, wp_logout_url($redirect_to)); header(“Location: $location”); die; } }Continue reading

CCT SEO post relations

/** * ========================================= * Gruppa CCT SEO * Relation: post_id -> WP Post ID * ========================================= */ /** * ========================================= * SAFE GET * ========================================= */ function gt_safe($obj, $key, $default = ”) { if (is_object($obj) && isset($obj->$key)) { return trim((string)…Continue reading

CCT overrides CPT slug

// 1. Zachytíme dáta tesne pred zápisom do DB add_filter( ‘wp_insert_post_data’, function( $data, $postarr ) { // Overíme, či ide o CPT, ktoré má prepojenie na CCT (Has Single Page) // JetEngine posiela v $_POST dáta z CCT pri ukladaní…Continue reading