Skip to content

Instantly share code, notes, and snippets.

View nextab's full-sized avatar

nexTab - Oliver Gehrmann nextab

View GitHub Profile
@nextab
nextab / Cross-Vergleich von 2 MySQL Tabellen.sql
Created September 2, 2022 13:03
Dieses kurze "Script" liefert eine Tabelle zurück, in der alle unterschiedlichen Rows von 2 verschiedenen MySQL Tables gelistet sind.
/*
Konkretes Beispiel: Wir hatten die Tabellen "bceup_options_new" sowie "bceup_options_old" und wollten diese beiden miteinander vergleichen. In beiden Tabellen waren die für uns relevanten Spalten die "option_id", der "option_name" sowie die "option_value".
Als Ergebnis haben wir dann eine neue Auflistung aller Zeilen in BEIDEN Tabellen, die sich voneinander unterscheiden.
*/
SELECT option_id,option_name,option_value
FROM (
SELECT option_id, option_name, option_value FROM bceup_options_new
UNION ALL
/* Möglichkeit 1 mit absolut positionierten Elementen: */
/* #region min-width: 981px */
@media only screen and (min-width: 981px) {
.services-presentation .et_pb_column .et_pb_module:nth-last-child(2) { margin-bottom: 4rem; }
.services-presentation .et_pb_column .et_pb_module:last-of-type {
position: absolute;
bottom: 0;
left: 0;
}

Ausnahmen für Removed Unused CSS:

/wp-content/themes/Divi/style(.*).css
/et-cache/(.*)
#divi-overlay-container-(.*)
#et-boc
#overlay-(.*)
#page-container
#sidebar-overlay
#region Render Shortcodes inside Divi Modules
add_filter( 'do_shortcode_tag','nxt_filter_shortcode_output',10,3);
function nxt_filter_shortcode_output($output, $tag, $attr){
$allowed_shortcodes = [
'et_pb_button',
'et_pb_accordion',
'et_pb_toggle',
'et_pb_cta',
];
if(!in_array($tag, $allowed_shortcodes)){ //make sure it is the right shortcode
/* #region max-width 980px */
@media only screen and (max-width: 980px) {
.et_fixed_nav header#main-header {
left: 0;
position: fixed;
top: 0;
width: 100%;
}
/* #region Pimp my mobile Menu Icon */
.mobile_menu_bar::before {
/* If you want to use the fullwidth menu nav, simply use:
header#main-header {
@extend %fullwidth-mobile-nav;
}
and you're done. ;-) */
/* #region max-width 980px */
@media only screen and (max-width: 980px) {
.et_fixed_nav {
header#main-header {
@nextab
nextab / add-custom-bulk-edit-options-wordpress.php
Created July 29, 2022 13:18
Bulk Edit Optionen in WordPress für Custom Post Type erweitern
#region Add Bulk Edit for Applications
// We are adding custom bulk actions in the WP Admin Backend for the post type "application"
function nxt_custom_bulk_actions($bulk_array) {
$application_status_fields = get_field_object('field_62daaf75105aa');
foreach($application_status_fields['choices'] as $status_option_key => $status_option_value) {
$bulk_array[$status_option_key] = 'Set application status to ' . $status_option_key;
}
return $bulk_array;
}
add_filter('bulk_actions-edit-application', 'nxt_custom_bulk_actions');
@nextab
nextab / mousekiller.js
Created July 29, 2022 10:14
Bei Klick auf das Element #mousekiller wird dieses auf display: none; gesetzt.
<script>
// Implementation for our hacky Google Map Embed - add this code to your footer!
const mousekiller = document.getElementById("mousekiller");
if(mousekiller) {
mousekiller.addEventListener('click', function (event) {
mousekiller.style.display = "none";
});
};
</script>
/* Centered Text / Img on one side, text on other */
%centered-text {
display: flex;
.et_pb_column {
display: flex;
flex-flow: column nowrap;
float: none;
justify-content: center;
.et_pb_module {
margin: 0 auto 30px;
function nxt_load_dynamically() {
$tempContent = get_the_content();
$tempCheck = '[nxt_application';
$tempVerify = strpos($tempContent,$tempCheck);
if($tempVerify === false) {
// Dein Code, wenn die Nadel im Heuhaufen NICHT gefunden wurde
} else {
// Dein Code, WENN die Nadel GEFUNDEN wurde, z. B.
acf_form_head();
wp_enqueue_style('mein-style');