Skip to content

Instantly share code, notes, and snippets.

View melvinlauber's full-sized avatar
🍩
eating donuts.

melvinlauber

🍩
eating donuts.
View GitHub Profile
@melvinlauber
melvinlauber / index.js
Last active March 20, 2025 14:52
feather icons js
$(document).ready(function () {
// Insert Feather-Icons
feather.replace()
});
@melvinlauber
melvinlauber / block-pattern Head.php
Last active September 6, 2024 12:39
Wordpress pattern.php Start of file
<?php
/**
* Title: Pattern Name
* Slug: theme/pattern
* Categories: pattern-category
*/
@melvinlauber
melvinlauber / Register block pattern.php
Last active September 6, 2024 12:39
Block Pattern Kategorie registrieren
<?php
register_block_pattern_category(
'slug',
array('label' => __('Name of Category', 'themename'))
);
?>
@melvinlauber
melvinlauber / WP style.css Head.css
Last active September 6, 2024 12:39
Start of the style.css file you don't need all information
/*
Theme Name: INSERT THEME HERE
Author: INSERT AUTHOR HERE
Author URI: INSERT URL HERE
Description: INSERT DESCRIPTION HERE
Version: 1.0
*/
@melvinlauber
melvinlauber / notenschnitt.php
Last active March 10, 2023 13:56
Notenschnitt
<?php
$numberOne = 10;
$numberTwo = 5;
$numberThree = 0.5;
// Rechne den Notendurchschnitt aus. Folgende Schritte müssen dabei unternommen werden.
// 1. Multipliziere $numberOne mit $numberThree und speichere den Wert in einer neuen Variable ($numberFour);
// 2. Multipliziere die neue Variable erneut mit $numberOne und speichere auch diesen Wert in einer Variable ($numberFive);
@melvinlauber
melvinlauber / window resize changer js
Last active September 6, 2024 14:12
check if window is getting resized
$(window).on("load resize",function(e) {
if ($(window).width() > 960) {
$('body').addClass('blue');
var imageUrl = $('.wp-block-cover__image-background').attr('src');
$('body.blue').css('background-image', 'url(' + imageUrl + ')');
}
else {
$('body').removeClass('blue');
$('body').css('background-image', '');
}
@melvinlauber
melvinlauber / wordpress newest post wrapper and add link button
Last active September 6, 2024 14:15
Wraps newest posts and adds a link to project button
$(function () {
$('.wp-block-latest-posts__list li').each(function () {
// Wrap integrieren
$('<div class="project-content"></div>').prependTo(this);
// URL des Projekts holen
var url = $(this).find('> a').attr('href');
@melvinlauber
melvinlauber / while_wp.php
Last active April 5, 2022 10:53
While WP.php
<?php
// WP Query definieren (wie viele Posts/Beiträge soll es holen)
$the_query = new WP_Query( 'posts_per_page=5' ); ?>
<!-- While Schleife von den Anzahl definierten Posts durchgehen -->
<?php while ($the_query -> have_posts()) { $the_query -> the_post(); ?>
<!-- Aufbau vom Beiträg / Projekt mittels HTML -->
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
@melvinlauber
melvinlauber / prexit
Last active September 6, 2024 14:17
Print exit Snippet
echo '<pre>';print_r();exit;
echo '<pre>';print_r($variable);echo '</pre>';