Skip to content

Instantly share code, notes, and snippets.

WordPress-Handbuch WordPress-Handbuch

Block or report user

Report or block WordPress-Handbuch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View listing-15-5.php
<?php
echo 'basename(dirname(__FILE__)) = ' . basename(dirname(__FILE__)) . "<br/>";
echo '$_SERVER["PHP_SELF"] = ' . $_SERVER["PHP_SELF"] . "<br/>";
echo '$_SERVER["DOCUMENT_ROOT"] = ' . $_SERVER["DOCUMENT_ROOT"] . "<br/>";
echo 'dirname(__FILE__) = ' . dirname(__FILE__) . "<br/>";
echo 'getcwd() = ' . getcwd() . "<br/>";
echo '__FILE__ = ' . __FILE__ . "<br/>";
phpinfo();
?>
@WordPress-Handbuch
WordPress-Handbuch / listing-18-18.php
Created Apr 23, 2019
WordPress 5 dropin /wp-content/maintenance.php, a custom maintenance message when using the .maintenance-mechanism in the main directory
View listing-18-18.php
<?php
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600');
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Website wird gewartet</title>
</head>
@WordPress-Handbuch
WordPress-Handbuch / listing-18-17.php
Created Apr 23, 2019
WordPress 5 dropin for db-error.php, a custom error message in case of a failed database connection
View listing-18-17.php
<?php ob_start();
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600');
mail("info@ihredomain", "Datenbankfehler", "Schon wieder die Datenbank!", "From: Meine Website");
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Website nicht erreichbar</title>
View listing-21-5.css
/* CSS Styles ausserhalb der folgenden speziellen Media Querys sind fuer grosse Monitore, breiter als 1199px, vorgesehen */
@media all and (max-width: 1199px) {
/* CSS Styles fuer grosse Displays */
}
@media all and (max-width: 991px) {
/* CSS Styles fuer Tablets hochkant */
}
@media all and (max-width: 768px) {
/* CSS Styles fuer Smartphones, horizontal */
}
@WordPress-Handbuch
WordPress-Handbuch / listing-18-16.php
Created Apr 11, 2019
Display new image sizes choices set through add_image_size() also in the backend in the right sidebar when editing an image
View listing-18-16.php
function wh_add_image_sizes_to_backend( $existingsizes ) {
$addsizes = array(
"wh-homepage-teaser" => 'WH Homepage Teaser',
"wh-landingpage-stage" => 'WH Landingpage Stage',
"wh-detailpage-feature" => 'WH Detailpage Feature'
);
$newsizes = array_merge( $existingsizes, $addsizes );
return $newsizes;
}
add_filter( 'image_size_names_choose', 'wh_add_image_sizes_to_backend' );
@WordPress-Handbuch
WordPress-Handbuch / listing-18-15.php
Created Apr 10, 2019
WordPress 5 Hello Word with translations commands
View listing-18-15.php
<?php
/**
* @package WH_Hello_World
* @version 1.1.0
*/
/*
Plugin Name: WH Hello World
Plugin URI: https://wordpress-handbuch.com
Description: Testausgabe in Front- und Backend
Author: Johannes Mustermann
@WordPress-Handbuch
WordPress-Handbuch / listing-22-2.js
Created Mar 27, 2019
WordPress 5 plugin admin js code for the backend preview part of the WH Eyecatcher example project https://wordpress.org/plugins/wh-eyecatcher/
View listing-22-2.js
jQuery(document).ready(function( $ ){
jQuery('select#wh_eyecatcher_style').on('change', function () {
$("textarea#wh_eyecatcher_css").val(this.value);
$("div#wh-eyecatcher").attr("style",this.value);
});
jQuery('textarea#wh_eyecatcher_css').on('change keyup paste', function () {
$("div#wh-eyecatcher").attr("style",this.value);
});
jQuery('input#wh_eyecatcher_slogan').on('change keyup paste', function () {
$("div#wh-eyecatcher").html($("input#wh_eyecatcher_slogan").attr("value"));
@WordPress-Handbuch
WordPress-Handbuch / listing-22-1.php
Last active Apr 24, 2019
WordPress 5 plugin main php code of the WH Eyecatcher example project https://wordpress.org/plugins/wh-eyecatcher/
View listing-22-1.php
<?php
/*
Plugin Name: WH Eyecatcher
Plugin URI: https://wordpress-handbuch.com/wh-eyecatcher
Description: Add a floating slogan to eyery page of your website
Version: 1.0.0
Author: WordPress-Handbuch
Author URI: https://wordpress-handbuch.com
License: GPL v2 or later
Copyright 2018 Richard Eisenmenger
@WordPress-Handbuch
WordPress-Handbuch / listing-21-3.php
Created Mar 26, 2019
Example functions.php with activated WordPress 5 features
View listing-21-3.php
<?php
/**
* WH HTML Vorlage functions and definitions
*
* @link @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package WH_HTML_Vorlage
*/
/**
@WordPress-Handbuch
WordPress-Handbuch / listing-21-4.css
Created Mar 26, 2019
Example Gutenberg editor styles to be included via add_editor_style( 'listing-21-4.css' );
View listing-21-4.css
body {
background-color: #00ffff;
color: #0000ff;
}
.wp-block {
max-width: 300px;
}
.wp-block[data-align="wide"] {
max-width: 500px;
}
You can’t perform that action at this time.