Skip to content

Instantly share code, notes, and snippets.

View ginsterbusch's full-sized avatar

Fabian Wolf ginsterbusch

View GitHub Profile
@ginsterbusch
ginsterbusch / ui-masto-verification-link.php
Created November 7, 2022 05:49
UI Mastodon Verification Link plugin for ClassicPress and WordPress
@ginsterbusch
ginsterbusch / fix-admin-page-title.php
Last active August 15, 2022 13:35
Fix annoying meaningless page titles in the WordPress post editor. Very helpful if you have to edit multiple posts at once and dont want to lose track.
add_filter( 'admin_title', 'fix_admin_page_title' , 10, 2 );
function fix_admin_page_title( $admin_title, $title ) {
global $post, $title, $action, $current_screen;
$return = $admin_title;
if( isset( $current_screen->post_type ) && $action == 'edit' ) {
//$return = $post->post_title . ' (' . $post->ID . ') - ' . get_bloginfo('name');
$return = $post->post_title . ' (' . $post->ID . ') - ' . $admin_title;
@ginsterbusch
ginsterbusch / shortcode-micro-plugin.php
Created May 27, 2021 12:25
Inserts content of a custom meta field using a shortcode. Use [mfs_custom_field field='my_field_name'] to insert any kind of meta field value inside of your posts.
<?php
/**
* Plugin Name: Metafield Shortcode Micro Plugin.
* Description: Inserts content of a custom meta field using a shortcode. Use [mfs_custom_field field='my_field_name'] to insert any kind of meta field value inside of your posts. Works both in WP v3.7 - 5.x and ClassicPress.
* Version: 1.0
* Author: Fabian Wolf
* Author URI: https://usability-idealist.net/
* License: GNU GPL v2
*/
<?php
/**
* When looking into how to properly and useful reorder the total / subtotal sum in the Invoice PDF which is generated by Germanized for WooCommerce, I stumbled upon this .. gem .. o.O
* I'd call it one of the most useless incremental counts I've ever seen so far.
* @file woocommerce-germanized-pro/templates/invoives/table-gross.php
*
*/
?>
<?php if ( $order_totals = $invoice->get_totals() ) : $i = 0; ?>
[ui_leaflet_map latitude="51.51752" longitude="7.14518" height="99vh" zoom="12" use_search="true" search_position="topright" use_locate="1" locate_marker="Sie befinden sich <strong>derzeit HIER</strong>." zoom_position="bottomleft" marker_icon_fa_class="anchor"]<strong>Mittelpunkt des Ruhrgebiets</strong><br />Quartier Röhlinghausen, Rolandstr. 49/51[/ui_leaflet_map]
@ginsterbusch
ginsterbusch / shortcode-functions.php
Last active November 5, 2019 20:52
RSS Feed embedding using shortcode(s). Implemented as function instead of class, both for easier copy + paste into the functions.php file of your current (child) theme, and also quicker understanding whats going on :) #wordpress #classicpress
<?php
/**
* RSS Feed embedding using shortcode(s). Implemented as function instead of class, both for easier copy + paste into the functions.php file of your current (child) theme, and also quicker understanding whats going on :)
* Normally, this would be implemented as a class with a nifty auto-loader / auto-shortcode registration.
*
* @author Fabian Wolf (@link https://wp-devil.de/)
*/
if( !function_exists( 'wp_rss' ) ) {
include_once( ABSPATH . WPINC . '/rss.php' );
@ginsterbusch
ginsterbusch / remove-woocommerce-nag.php
Created October 16, 2019 18:29
Quick enhancement of the micro plugin to "Remove WooCommerce Nag" :)
<?php
/**
* Plugin Name: Remove WooCommerce Nag
* Plugin URI: https://devanswers.co/remove-woocommerce-nag/
* Description: Gets rid of nag: "Connect your store to WooCommerce.com to receive extensions updates and support.". Enhanced by <a href="https://usability-idealist.net">Fabian Wolf</a>.
* Version: 1.1
* Author: DevAnswers
* Author URI: https://devanswers.co/
*/
if ( !class_exists( 'RemoveWooCommerceNag') ) :
@ginsterbusch
ginsterbusch / cryptic-bs.php
Created August 19, 2019 18:30
Komische kryptische Zeichen in Shortcodes
<?php
$x = 'eyJoYWxsbyI6IndlbHQiLCJzb25nLXRpdGVsIjp7Im1laW4iOiJnZWhpcm4iLCJkZWluIjoiZ2VoaXJuIn0sInVybCI6Imh0dHBzJTNBJTJGJTJGdXNhYmlsaXR5LWlkZWFsaXN0Lm5ldCUyRiUyM2tvbnRha3QiLCJlaW5zX3BsdXMiOnRydWV9';
$y = base64_decode( $x );
$z = json_decode( urldecode( $y ), true ); // true ergibt ein array, ohne haben wir reine StdClass-Objektorgie
?>
@ginsterbusch
ginsterbusch / gtk-youtube-viewer-players_snippet.config
Last active May 28, 2019 17:00
GTK Youtube Viewer configuration for allowing the usage of totem video player
video_player_selected => "totem",
video_players => {
mplayer => {
arg => "-prefer-ipv4 -really-quiet -title *TITLE*",
audio => "-audiofile *AUDIO*",
cmd => "/usr/bin/mplayer",
fs => "-fs",
srt => "-sub *SUB*",
},
mpv => {
@ginsterbusch
ginsterbusch / assets-loader-example.class.php
Created February 5, 2019 04:09
Copy + paste of the assets preloader from the soon-to-be released next version of UI Leaflet Integration plugin (https://github.com/ginsterbusch/ui-leaflet-integration ).
<?php
/**
* @author Fabian Wolf (https://wp-devil.de)
* @license GNU GPL v2 or later
*/
class AssetsPreloaderExample {
function __construct() {
add_action( 'wp', array( $this, 'preload_assets' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'init_assets' ) );