Skip to content

Instantly share code, notes, and snippets.

View nextab's full-sized avatar

nexTab - Oliver Gehrmann nextab

View GitHub Profile
@nextab
nextab / Per PHP in File schreiben
Created February 10, 2022 10:24
Dies ist ein wenig Beispiel-Code, mit dem über PHP in ein File auf dem Webserver geschrieben wird.
function csv_update_action() {
$option_name = 'ots_points_updated' ;
$update_date = time();
if ( get_option( $option_name ) !== false ) {
// The option already exists, so we just update it.
update_option( $option_name, $update_date );
} else {
// The option hasn't been added yet. We'll add it with $autoload set to 'no'.
$deprecated = null;
$autoload = 'no';
@nextab
nextab / WordPress Shortcode Output filtern
Created February 22, 2022 15:16
Mit Hilfe des Filters "do_shortcode_tag" ist es möglich, jeden beliebigen Shortcode-Output vor der Ausgabe noch einmal zu überschreiben bzw. zu filtern.
#region Overwrite Social Follow Shortcode
add_filter( 'do_shortcode_tag','nxt_filter_shortcode_output',10,3);
function nxt_filter_shortcode_output($output, $tag, $attr){
if('nxt_share' != $tag){ //make sure it is the right shortcode
return $output;
}
if(!isset($attr['title'])){ //you can even check for specific attributes
return $output;
}
return "<p>Dies ist ein nichtssagender Hinweis</p>";
var throttledListener = throttle(scrollListener, 1000);
window.addEventListener('scroll', throttledListener);
function throttle(func, delay) { // run our function [func] every [delay] milliseconds
var func = func.bind(func),
last = Date.now();
return function() {
if (Date.now() - last > delay) {
func();
last = Date.now();
// Begin custom image size for Blog Module
add_filter( 'et_pb_blog_image_height', 'blog_size_h' );
add_filter( 'et_pb_blog_image_width', 'blog_size_w' );
function blog_size_h($height) {
return '628';
}
function blog_size_w($width) {
return '1200';
}
add_image_size( 'custom-blog-size', 1200, 628 );
User-agent: *
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins
Disallow: /wp-content/cache
Disallow: /wp-content/themes
Disallow: /tag
Disallow: /author
Disallow: /trackback
/* Fix the "jumping" effect on mobile devices for Divi's Fullscreen Header Module */
/* #region max-width 479px */
@media only screen and (max-width: 479px) {
/* #region Fixing jumping header on mobile devices */
.et_pb_fullwidth_header.et_pb_fullscreen {
min-height: 100vh !important;
padding-top: 0 !important;
.et_pb_fullwidth_header_container {
min-height: calc(100vh - 70px) !important;
// width: 100%;
@nextab
nextab / KenBurns auf Hintergrundbild (CSS)
Created March 29, 2022 16:04
Dieser CSS Code erlaubt es, ein Hintergrundbild per "Ken Burns Effekt" näher kommen zu lassen.
/* #region KenBurns Effect */
.et_pb_section.ken-burns .et_parallax_bg {
animation: kenburns-with-pause 60s alternate infinite;
}
@keyframes kenburns {
0% {
-ms-transform: scale3d(1.45, 1.45, 1.45) translate3d(-25px, -55px, 0px);
-webkit-transform: scale3d(1.45, 1.45, 1.45) translate3d(-25px, -55px, 0px);
transform: scale3d(1.45, 1.45, 1.45) translate3d(-25px, -55px, 0px);
@nextab
nextab / Code in den footer der Seite per functions-Hook einfügen
Created April 6, 2022 11:19
Mit diesem kurzen Code-Schnipsel, das in die functions.php des eigenen Child Themes in WordPress muss, könnt ihr Code in der Fußzeile eurer Seite ausführen lassen. In unserem speziellen Beispiel wollen wir, dass der Code überall ausgeführt wird bis auf der Hauptseite.
@nextab
nextab / Shortcode, um Inhalt überall nur nicht auf Homepage anzuzeigen
Created April 6, 2022 11:21
Dieser Code muss in die functions.php eures Child Themes. Sollte euch Child Theme nichts sagen bzw. ihr noch keines haben, so folgt einfach unserer Anleitung auf: https://divi-tutorials.com/programmierung/wie-erstelle-ich-ein-wordpress-child-theme/
function only_show_when_not_on_homepage($atts, $content = null) {
$a = shortcode_atts([
'class' => ''
], $atts);
if(!is_front_page()) {
return '<div class="' . $a["class"] . '">' . $content . '</div>';
}
return;
}
add_shortcode('nohome', 'only_show_when_not_on_homepage');
@nextab
nextab / Änderung der Größe von Bildern im Galerie-Modul von Divi
Created May 17, 2022 08:42
Dieses Code Snippet muss in deine functions.php, um eine neue Vorschaubilder-Größe für das Galerie-Modul von Divi anzulegen.
// Begin custom image size for Gallery Module
add_filter( 'et_pb_gallery_image_height', 'gallery_size_h' );
add_filter( 'et_pb_gallery_image_width', 'gallery_size_w' );
function gallery_size_h($height) {
return '750';
}
function gallery_size_w($width) {
return '1500';
}
add_image_size( 'custom-gallery-size', 1500, 750 );