Skip to content

Instantly share code, notes, and snippets.

View nextab's full-sized avatar

nexTab - Oliver Gehrmann nextab

View GitHub Profile
// In die Design-Einstellungen -> CSS von der ZEILE!
@media (min-width: 981px) {
selector .et_pb_column {
display: flex;
flex-flow: column nowrap;
align-items: flex-start;
justify-content: center;
gap: 0;
}
@nextab
nextab / functions.php Vorlage für ein Child Theme (für Divi)
Created April 18, 2025 11:56
Diverse Hacks und Vorlagen für ein besseres und sichereres WordPress
<?php
#region Clean Up WP Admin Bar
function remove_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo'); // Remove the Wordpress logo + sub links
// $wp_admin_bar->remove_menu('site-name'); // Remove the site name menu
// $wp_admin_bar->remove_menu('view-site'); // Remove the view site link
// $wp_admin_bar->remove_menu('updates'); // Remove the updates link
// $wp_admin_bar->remove_menu('comments'); // Remove the comments link
$wp_admin_bar->remove_menu('new-content'); // Remove the content link
<?php
// Get all ACF fields of the current post
$custom_fields = get_fields();
$available_fields = array();
if ($custom_fields) {
foreach ($custom_fields as $field_name => $field_value) {
$available_fields[$field_name] = $field_value;
}
}
(function() {
// Add scroll class to body when scrolling
function handleScroll() {
const scrollPosition = window.scrollY || document.documentElement.scrollTop;
if (scrollPosition > 0) {
document.body.classList.add('scrolling');
} else {
document.body.classList.remove('scrolling');
}
@nextab
nextab / Gutenberg für Posts deaktivieren.php
Created March 7, 2025 11:19
Kurzes Snippet für die functions.php des Child Themes in WordPress, um den Gutenberg Block Editor für Beiträge zu deaktivieren.
add_filter( 'use_block_editor_for_post', '__return_false' );
@nextab
nextab / Relevanssi Live Ajax Search Template.php
Created February 5, 2025 17:49
Vorlage für ein benutzerfreundlicheres Such-Ergebnis für die Live-Ajax-Ergebnisse des Plugins Relevanssi
<?php
/**
* Search results template
* @package Relevanssi Live Ajax Search
*/
function get_custom_post_type_labels() {
return array(
'projects' => 'Projekte',
'post' => 'Neuigkeiten',
<globalRules>
<responses>
- Repeat the question before thinking about the solution.
- Think before you write the code in <thinking> tags. Think through what effect it will have on other code. Think through whether this code would be better in another location. Think through whether any types need to be updated. Think through whether this code inherits code from a parent component or module or passes anything to a child component or module. Think through if it is the simplest solution. Think through whether the file is a client or server context and if your code can work in this context.
- Use reflection to verify your own answer.
- Show your "reflection".
- Show your "chain of thought" for suggestions.
- Be concise; remove any non-pertinent language from responses (ex: remove "I apologize")
- Add a "Confidence Score", as a % out of 100, that represents your confidence in your suggested code.
- Recommend best practices. Be opinionated.
@nextab
nextab / Viewport Meta Tag für Divi überschreiben – change user-scalable in Divi
Created December 14, 2024 09:04
Divi by Elegant Themes is a WordPress theme with a catch: You can't pinch zoom your website. This is not in accordance with WCAG standards, but you can change it very easily with this quick snippet for your child theme's functions.php.
function nxt_remove_et_viewport_meta() {
remove_action('wp_head', 'et_add_viewport_meta');
}
add_action('after_setup_theme', 'nxt_remove_et_viewport_meta');
function nxt_enable_zoom() {
echo '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">';
}
add_action('wp_head', 'nxt_enable_zoom');
@nextab
nextab / JS Teil für smooth animation
Last active December 10, 2024 13:11
Moved incorrect cursor: pointer to the correct element
class Accordion {
constructor(el) {
// Store the <details> element
this.el = el;
// Store the <summary> element
this.summary = el.querySelector('summary');
// Store the <div class="content"> element
this.content = el.querySelector('.sub-menu, .wp-block-group');
// Store the animation object (so we can cancel it if needed)
.white-stripe {
height: 30px;
background-image: linear-gradient(120deg, red 0%, red 30%, white 30%, white 35%, black 5%, black 100%);
}
/* Alternative Lösung: */
.skewed_container {
overflow: hidden;
}