div {
font: caption;
}
font: caption verwendet die Systemschriftart für den angesprochenen Container.
div {
font: caption;
}
font: caption verwendet die Systemschriftart für den angesprochenen Container.
In der Theme-Entwicklung kann es interessant sein, das Widget Schlagwörter-Wolke anzupassen. Dabei stehen die gleichen Parameter zu Verfügung, wie wenn die Wolke via wp_tag_cloud
in das Theme integriert wird. In diesem Beispiel wird die Anzahl der Schlagwörter auf 24 begrenzt.
add_filter( 'widget_tag_cloud_args' , 'tag_cloud_args' );
function tag_cloud_args($args) {
$args = array( 'number' => 24 );
return $args;
}
<?php
/**
* Plugin Name: Beispiel Plugin
* Plugin URI: http://domain.tld/beispiel-plugin/
* Description: Mit diesem Beispiel Plugin wird der Plugin-Header erklärt.
* Version: 0.1
* Author: Vorname Nachname
* Author URI: http://domain.tld
* Text Domain: beispiel-plugin
* Domain Path: /languages
* License: GPL2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
/**
* GPL2 License Text
Copyright JAHR VORNAME NACHNAME E-MAIL-ADRESSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Avoid direct calls
*/
defined('ABSPATH') or die("No direct requests for security reasons.");
?>
functions.php
add_theme_support('automatic-feed-links');
generiert am Beispiel von wpdoc.de:
<link rel="alternate" type="application/rss+xml" title="WordPress Doc » Feed" href="https://wpdoc.de/feed/" />
<link rel="alternate" type="application/rss+xml" title="WordPress Doc » Kommentar-Feed" href="https://wpdoc.de/comments/feed/" />
<?php
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
echo $published_posts; echo(' Beiträge wurden bisher veröffentlicht'); }
?>
Als Plugin realisieren (z.B. emaillogin.php in den Plugin-Ordner).
/* Plugin Name: Login mit E-Mail-Adresse
Description: Anmelden zum Administrationsbereich mit der dort hinterlegten E-Mail-Adresse.
Version: 1.0 */
add_action( 'wp_authenticate', 'login_with_email_address' );
function login_with_email_address( $username ) {
$user = get_user_by_email( $username );
if ( ! empty( $user->user_login ) )
$username = $user->user_login;
return $username;
}
/*
Theme Name: Childthemename
Description: Ein Originaltheme-Childtheme.
Author: Johannes
Author URI: https://wpdoc.de
Template: Originalthemename
Version: 1.0
*/
Im Anschluss kann durch erstellen einzelner Styles, Funktionen oder Template-Dateien das Original-Theme angepasst werden.
functions.php
add_filter( 'wp_editor_set_quality', '100' );
function custom_login_message( $message ) {
if ( empty($message) ){
echo "<p class='message'>Herzlich Willkommen im Backend von ";
echo get_bloginfo('name', display);
echo ". Bitte melde dich an.</p>";
} else {
return $message;
}
}
add_filter( 'login_message', 'custom_login_message' );
Plugin zur Veränderung der Admin-Toolbar:
<?php
/*
Plugin Name: Custom Adminbar
Plugin URI: https://wpdoc.de/?p=214
Description: Benutzerdefinierte Adminbar mit Abmelde-Link und Suche im Backend.
Author: Johannes Ries
Author URI: http://johannesries.de
Version: 1.0
*/
function custom_admin_bar() {
$form = '<form action="' .esc_url( admin_url('edit.php') ). '" method="get" id="adminbarsearch">';
$form .= '<input name="s" tabindex="1" type="text" value="" maxlength="54" />';
$form .= '<input type="submit" value="' .__('Search'). '"/>';
$form .= '</form>';
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('my-account');
$wp_admin_bar->remove_menu('search');
$wp_admin_bar->add_menu( array(
'id' => 'wp-custom-edit-profile',
'title' => 'Mein Profil bearbeiten',
'parent'=>'my-sites',
'href' => self_admin_url('profile.php'),
'meta' => array('title' => 'Passwort, E-Mail-Adresse und weitere Details ändern')
));
$wp_admin_bar->add_node( array(
'parent' => 'top-secondary',
'id' => 'custom-logout',
'title' => 'Abmelden',
'href' => wp_logout_url(),
'meta' => array('title' => 'Abmelden')
) );
$wp_admin_bar->add_menu(
array(
'parent' => 'top-secondary',
'id' => 'custom-search',
'title' => $form,
'meta' => array('class' => 'admin-bar-search')
)
);
}
add_action(
'plugins_loaded',
function () {
if ( is_admin_bar_showing() ) {
add_action('wp_before_admin_bar_render','custom_admin_bar');
}
}
);
?>