This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Adminbereich, neuer Eintrag */ | |
add_shortcode('rad-glossar-admin-insert', 'radGlossarAdminInsert'); | |
function radGlossarAdminInsert() { | |
// Das Formular wird nur dem Admin angezeigt | |
if(current_user_can('administrator')){ | |
// Hier die URL eintragen, auf welcher die Seite verwendet wird | |
$url = "https://computer-for-dummies.ch/glossar/eintrag"; | |
$ausgabe = "<p class='glossartitel'>Neuer Eintrag</p>"; | |
if(!isset($_POST['glossar_term']) OR $_POST['glossar_term'] == "" ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Inhalt listen (Admin) */ | |
add_shortcode('rad-glossar-adminlist', 'radGlossarAdminlist'); | |
function radGlossarAdminlist() { | |
global $wpdb; | |
$ausgabe = ""; | |
// Formular wird nur Admin angezeigt | |
if(current_user_can('administrator')){ | |
// Hier die URL eintragen, auf welcher die Seite verwendet wird | |
$url = "https://computer-for-dummies.ch/glossar/bearbeiten/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Index erstellen */ | |
add_shortcode('rad-glossar-index', 'radGlossarIndex'); | |
function radGlossarIndex() { | |
global $wpdb; | |
// Alle Einträge listen (Begriff und Beschreibung) | |
$sql = $wpdb->get_results("SELECT glossar_term, glossar_description | |
FROM ".$wpdb->prefix."rad_glossar | |
ORDER BY glossar_term ASC"); | |
$numrows = $wpdb->num_rows; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); | |
/* also read https://codex.wordpress.org/Writing_a_Plugin */ | |
/* | |
Plugin Name: Mein neues Plugin | |
Description: Das Plugin macht was es soll | |
Version: 0.1.01 | |
Date: 11.1.2019 | |
Author: Hans Muster | |
Author URI: https://domain.name/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$protocol = $_SERVER['SERVER_PROTOCOL']; | |
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) { | |
$protocol = 'HTTP/1.0'; | |
} | |
header( "$protocol 503 Service Unavailable", true, 503 ); | |
header( 'Content-Type: text/html; charset=utf-8' ); | |
header( 'Retry-After: 600' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Auszug und Inhalt vergleichen | |
function vs_excerpt_content(){ | |
global $post; | |
// Auszug laden | |
$auszug = get_the_excerpt($post->ID); | |
// HTML und PHP entfernen | |
$auszug = strip_tags($auszug); | |
// Shortcodes entfernen | |
$auszug = strip_shortcodes($auszug); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( is_category() == true OR is_search() == true ) { the_excerpt(); } else { the_content(); } | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp_admin_style() { | |
wp_enqueue_style('admin-styles', get_template_directory_uri().'_child/style-admin.css'); | |
} | |
add_action('admin_enqueue_scripts', 'wp_admin_style'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_head', 'my_custom_admin_css'); | |
function my_custom_admin_css() { | |
echo '<style> | |
/* Schriften anpassen */ | |
body, td, textarea, input, select { | |
font-family: "Lucida Grande"; | |
font-size: 12px; } | |
/* oberen Balken färben */ |