Skip to content

Instantly share code, notes, and snippets.

@kirstenschelper
kirstenschelper / responsiveness-columns-block.css
Last active March 15, 2021 09:09
Responsiveness Columns Block
/*
Sources:
https://stackoverflow.com/questions/8720931/can-css-detect-the-number-of-children-an-element-has
https://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/
https://gist.github.com/Zodiac1978/d3a857b0520db51e84c0939cab853ebb
https://die-netzialisten.de/responsiveness-spalten-block-anpassen/
*/
@media (min-width: 600px) and (max-width: 781px) {
@kirstenschelper
kirstenschelper / block-patterns.php
Created January 19, 2021 09:37
Zwei Block Patterns
add_action( 'init', function() {
register_block_pattern(
'ks-testimonial-pattern',
[
'title' => __('Testimonials', 'ks-block-pattern'),
'description' => _x('Drei Testimonials', 'ks-block-pattern'),
'categories' => ['columns'],
'content' => '
<!-- wp:group -->
<div class="wp-block-group ks-testimonials"><div class="wp-block-group__inner-container"><!-- wp:heading {"level":3} -->
@kirstenschelper
kirstenschelper / remove-core-block-pattern-categories.php
Created January 19, 2021 09:28
Core Block Pattern Kategorien entfernen
function removeCorePatternsCategories() {
unregister_block_pattern_category('buttons');
unregister_block_pattern_category('columns');
unregister_block_pattern_category('gallery');
unregister_block_pattern_category('header');
unregister_block_pattern_category('text');
unregister_block_pattern_category('uncategorized');
}
add_action('init', 'removeCorePatternsCategories');
@kirstenschelper
kirstenschelper / custom-block-pattern-category.php
Last active January 19, 2021 09:36
Eigene Block Pattern Kategorie erstellen
function netzialisten_register_block_categories() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
register_block_pattern_category(
'Netzialisten',
array( 'label' => _x( 'Patterns Netzialisten', 'Block pattern category', 'netzialisten' ) )
);
}
}
add_action( 'init', 'netzialisten_register_block_categories' );
@kirstenschelper
kirstenschelper / block-pattern-preistabelle.css
Created January 18, 2021 15:51
CSS für Block Pattern Preistabelle
/*Resets*/
.preistabelle .wp-block-column:not(:first-child) {
margin-left: 1em;
}
.preistabelle p{
margin-top:0;
}
.preistabelle .wp-block-group{
padding:1em 0.5em;
@kirstenschelper
kirstenschelper / block-pattern-testimonial.php
Last active January 19, 2021 09:37
Block Pattern Testimonial
add_action( 'init', function() {
register_block_pattern(
'ks-testimonial-pattern',
[
'title' => __('Testimonials', 'ks-block-pattern'),
'description' => _x('Drei Testimonials', 'ks-block-pattern'),
'categories' => ['columns'],
'content' => '
<!-- wp:group -->
<div class="wp-block-group ks-testimonials"><div class="wp-block-group__inner-container"><!-- wp:heading {"level":3} -->
@kirstenschelper
kirstenschelper / index.php
Created January 18, 2021 11:46
Plugin Block Styles
<?php
/**
* Plugin Name: Kirstens Gutenberg Block Styles
* Plugin URI: https://die-netzialisten.de
* Description: Block Styles für Absatz-Block und Listen-Block
* Version: 1.0
* Author: Kirsten Schelper
*/
@kirstenschelper
kirstenschelper / block-styles.css
Created January 18, 2021 11:45
CSS Block Styles
/*Paragraph Red Box*/
.is-style-paragraph-red-box {
padding: 1em;
background-color: #dc143c;
color:white;
font-family: "fira_sansmedium";
text-align: center;
border-radius:6px;
}
@kirstenschelper
kirstenschelper / block-styles.js
Last active January 18, 2021 11:44
JS Block Styles
//Paragraph Box
wp.blocks.registerBlockStyle( 'core/paragraph', {
name: 'paragraph-red-box',
label: 'Rote Box'
} );
//List with checkmarks
@kirstenschelper
kirstenschelper / Simple toggle button
Last active July 9, 2020 09:22
Simple toggle button with jQuery
<a class="my-toggle" style="cursor:pointer;" onclick="jQuery('#some-container').toggle();">some text</a>