Skip to content

Instantly share code, notes, and snippets.

View gmmedia's full-sized avatar

Jochen Gererstorfer gmmedia

View GitHub Profile
@gmmedia
gmmedia / wp-config.php
Created May 16, 2022 12:40
WordPress SVG upload error: Add this line to the end of your wp-config.php
define('ALLOW_UNFILTERED_UPLOADS', true);
@gmmedia
gmmedia / SVG image
Last active May 16, 2022 12:40
SVG: declaration: Add this line to the top of you SVG, if you can't upload it to WordPress.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@gmmedia
gmmedia / style.css
Last active February 20, 2023 03:51
Kadence Timeline Block
/*
* Create Timeline Block with the Kadence Icon List Block
* See: https://bloggerpilot.com/timeline-css/
*/
.timeline li {
list-style: none;
padding-bottom: 1.8rem !important;
border-left: 1px dotted #897B76;
position: relative;
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:04
Allow SVG usage in WordPress
<?php
// Allow SVG usage in WordPress
function bloggerpilot_cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'bloggerpilot_cc_mime_types');
@gmmedia
gmmedia / functions.php
Last active February 2, 2025 05:16
Add alt tag to WordPress Gravatar images
<?php
// Add alt tag to WordPress Gravatar images
// Full how-to: https://bloggerpilot.com/gravatar-alt-tag/
function bloggerpilot_gravatar_alt($bloggerpilotGravatar) {
if (have_comments()) {
$alt = get_comment_author();
}
else {
$alt = get_the_author_meta('display_name');
@gmmedia
gmmedia / page-something.php
Last active October 8, 2021 23:50
Kadence page template with the_content
<?php
/**
* Template Name: something
*
* @package kadence
*/
namespace Kadence;
@gmmedia
gmmedia / page-tools.php
Last active June 22, 2021 14:55
Kadence page template wp_footer
<?php
/**
* Template Name: Tools
*
* @package kadence
*/
namespace Kadence;
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:04
WordPress: Remove unwonted image sizes, like medium_large, 1536x1536, 2048x2048
<?php
/*
* WordPress: Remove unwonted image sizes.
* In this code I remove the three sizes medium_large, 1536x1536, 2048x2048
* See full article:
*/
add_filter('intermediate_image_sizes', function($sizes) {
return array_diff($sizes, ['medium_large']); // Medium Large (768 x 0)
@gmmedia
gmmedia / functions.php
Last active January 17, 2024 13:56
Enable Gutenberg editor for WooCommerce
<?php
// Find the description at https://bloggerpilot.com/en/gutenberg-for-woocommerce/
// Disable new WooCommerce product template (from Version 7.7.0)
function bp_reset_product_template($post_type_args) {
if (array_key_exists('template', $post_type_args)) {
unset($post_type_args['template']);
}
return $post_type_args;
}
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:05
WordPress: Wiederverwendbaren Block erstellen
<?php
function j0e_register_block_patterns() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
register_block_pattern(
'j0e-header-pattern',
array(
'title' => __( 'Überschrift', 'j0e-patterns' ),