Skip to content

Instantly share code, notes, and snippets.

@MrThiemann
MrThiemann / daemon.json
Created May 16, 2022 16:24
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,
@MrThiemann
MrThiemann / wordpress_translate_snippet.php
Last active March 2, 2021 20:19
entweder in die functions.php einfügen oder mit dem Wordpress-Plugin "Code Snippet"
// Übersetzungen und Texte anpassen
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('this is your text in english', 'dies ist euer text in englisch', $translated);
$translated = str_ireplace('noch ein Text', 'another text', $translated);
$translated = str_ireplace('wordpress', 'kann natürlich auch durch alles andere ersetzt werden', $translated);
<?php
$data = get_option('bo_options');
$response = isset( $data['contact']['bo_contact_response'] ) ? $data['contact']['bo_contact_response'] : null;
$recipient = isset( $data['contact']['bo_formmail_address'] ) ? $data['contact']['bo_formmail_address'] : null;
$shdata = isset( $data['contact']['bo_show_dataprot'] ) ? $data['contact']['bo_show_dataprot'] : null;
$datalink = isset( $data['contact']['bo_dataprot_page_url'] ) ? $data['contact']['bo_dataprot_page_url'] : null;
$bloginfo = get_bloginfo('admin_email');
if ($recipient == '') {
$rec = $bloginfo;
@MrThiemann
MrThiemann / index.html
Created September 6, 2020 08:06
jOqYyRN
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:Condensed" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,800' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
@MrThiemann
MrThiemann / functions.php
Created September 1, 2020 04:11
allow editors to edit menu
<?php
function hide_menu() {
if (current_user_can('admin-clone')) {
remove_submenu_page( 'themes.php', 'themes.php' ); // hide the theme selection submenu
remove_submenu_page( 'themes.php', 'widgets.php' ); // hide the widgets submenu
remove_submenu_page( 'themes.php', 'customize.php?return=%2Fwp-admin%2Ftools.php' ); // hide the customizer submenu
remove_submenu_page( 'themes.php', 'customize.php?return=%2Fwp-admin%2Ftools.php&#038;autofocus%5Bcontrol%5D=background_image' ); // hide the background submenu
@MrThiemann
MrThiemann / wc-price-range.php
Last active August 31, 2020 03:11
WooCommerce price range: From to change prices in From prices
<?php
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
function wc_wc20_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( ' ab %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
// Sale Price
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
sort( $prices );
@MrThiemann
MrThiemann / translate.php
Created August 29, 2020 18:36
translate
// Übersetzungen und Texte anpassen
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('hours', 'Stunden', $translated);
$translated = str_ireplace('adress', 'Adresse', $translated);
return $translated;
@MrThiemann
MrThiemann / README.md
Last active August 24, 2020 05:01
woo-translation
<div class="druckerimage">
<?php $image = get_field('image');
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full', false, '' );
if( has_post_thumbnail() ) {
echo '<figure class="gesamt">';
the_post_thumbnail('medium');
echo '<figcaption>'.the_field( 'image_description' ).'</figcaption>';
echo '</figure>';
}
@MrThiemann
MrThiemann / functions.php
Created August 19, 2020 09:51
custom tab in vendor store page
<?php
add_action( 'wcfmmp_rewrite_rules_loaded', function( $wcfm_store_url ) {
add_rewrite_rule( $wcfm_store_url.'/([^/]+)/printer_information?$', 'index.php?'.$wcfm_store_url.'=$matches[1]&printer_information=true', 'top' );
add_rewrite_rule( $wcfm_store_url.'/([^/]+)/printer_information/page/?([0-9]{1,})/?$', 'index.php?'.$wcfm_store_url.'=$matches[1]&paged=$matches[2]&printer_information=true', 'top' );
}, 50 );
add_filter( 'query_vars', function( $vars ) {
$vars[] = 'printer_information';
return $vars;
}, 50 );