Skip to content

Instantly share code, notes, and snippets.

View gmmedia's full-sized avatar

Jochen Gererstorfer gmmedia

View GitHub Profile
@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' ),
@gmmedia
gmmedia / functions.php
Last active December 7, 2024 02:00
Add featured image column to WP admin panel - posts AND pages
<?php
/**
* Add featured image column to WP admin panel - posts AND pages
* See: https://bloggerpilot.com/featured-image-admin/
*/
// Set thumbnail size
add_image_size( 'j0e_admin-featured-image', 60, 60, false );
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:07
Astra Theme: Display last modified and publisheddate in the post metadata.
<?php
/**
* Astra Theme: Display last modified and published date in the post metadata.
* See: https://j0e.org/astra-tipps-tricks/
*/
function j0e_post_date( $output ) {
$output = '';
$format = apply_filters( 'astra_post_date_format', '' );
$published_date = esc_html( get_the_date( $format ) );
@gmmedia
gmmedia / Custom Post Type Landingpage
Last active March 11, 2023 10:07
Landingpage Abschnitt in WordPress
<?php
/**
* Custom Post Type: Landingpages.
* Add to your functions.php
*/
function cptui_register_my_cpts_landingpage() {
/**
* Post Type: Landingpages.
@gmmedia
gmmedia / German Stopwords - Deutsche Stop Wörter
Created February 11, 2021 16:46
Stop Wörter für SEO und Crawling
ab
aber
abermaliges
abermals
abgerufen
abgerufene
abgerufener
abgerufenes
abgesehen
acht
@gmmedia
gmmedia / .htaccess
Last active February 4, 2021 20:39
Perfect WordPress .htaccess
# WordPress .htaccess von Jochen Gererstorfer
# https://j0e.org/wordpress-htaccess/
# http zu https weiterleiten
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:07
Astra Theme: Display only last modified date in the post metadata.
<?php
/**
* Astra Theme: Display only last modified date in the post metadata.
*
*/
function j0e_post_date( $output ) {
$output = '';
$format = apply_filters( 'astra_post_date_format', '' );
$modified_date = esc_html( get_the_modified_date( $format ) );
@gmmedia
gmmedia / AutoHotkey.ahk
Last active August 27, 2019 17:55
Deutsche Anführungszeichen unter Windows mit AutoHotkey
; Vollständiger Artikel auf https://j0e.org/forum/thread/anfuehrungszeichen/
; Deutsche Anführungszeichen unten und oben -> auf ALT+1 und Alt+2
!1::Send „ ; Alt+1 anstatt Alt+0132
!2::Send “ ; Alt+2 anstatt Alt+0147
; Französische Anführungszeichen, Chevrons oder Guillemets -> auf ALT+3 und Alt+4
!3::Send » ; Alt+3 anstatt Alt+0187
!4::Send « ; Alt+4 anstatt Alt+0171
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:08
Artikel und Seiten Aktualisierungsdatum
<?php
// Änderungsdatum automatisch einfügen
function j0e_change_date($content) {
if ( (is_single() && get_post_type() == 'post') || is_page() ) {
$artikel_erstellt = get_the_date('U');
$artikel_aktualisiert = get_post_modified_time('U');
// Nur ausgeben, wenn Aktualisierung älter als einen Tag ist
if (($artikel_aktualisiert - $artikel_erstellt) > 86400)
<?php
// Add featured image to RSS feed
function j0e_imagetoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '
' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:left; margin:0 10px 10px 0;' ) ) . '
' . $content;
}