Skip to content

Instantly share code, notes, and snippets.

René A. Da Rin radarin

Block or report user

Report or block radarin

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
@radarin
radarin / wp.customizer.css.php
Last active Feb 22, 2019
Wordpress Customizer Steuerung verbreitern
View wp.customizer.css.php
<?php
/* CSS im Cusomizer erweitern, Steuerelemente verbreitern */
add_action( 'customize_controls_print_styles', 'customizer_width_400', 999 );
function customizer_width_400() {
?>
<style>
#customize-controls {
width:400px;
max-width:400px;
}
@radarin
radarin / wp.place.menu.php
Last active Feb 12, 2019
Menu in Theme einfügen
View wp.place.menu.php
<?php
//
wp_nav_menu( array( 'theme_location' => 'additional-menu' ) );
//
wp_nav_menu( array( 'theme_location' => 'additional-menu', 'container_class' => 'new_menu_class' ) );
//
if (has_nav_menu( 'master-menu' )) {
wp_nav_menu( array('theme_location' => 'master-menu', 'items_wrap' => '<ul id="mainmenuentry">%3$s</ul>' ));
@radarin
radarin / wp.add.menu.php
Last active Feb 12, 2019
Neue Menuposition
View wp.add.menu.php
<?php
// Ein einzelnes Menu registrieren
add_action ('init', 'register_my_menus');
function register_my_menus() {
register_nav_menus(
/* Der erste Wert ist die Theme Location, der Zweite der Name im Backend */
array( 'master-menu' => __( 'Master Menu' ))
);
}
@radarin
radarin / wp.lastupdate.php
Last active Feb 5, 2019
Letzte Änderung eines Beitrages/Seite
View wp.lastupdate.php
<?php
/*
Quelle: Zeile 11: Thomas Weiland, http://www.weiland-thomas.de, 2016
GNU General Public License
Modifiziert: René A. Da Rin, www.darin.ch, 29.1.2019
*/
// Die Funktion radLastChange() zeigt Datum und Uhrzeit der letzten Änderung an.
add_shortcode('rad-last-change', 'radLastChange');
function radLastChange() {
global $wpdb;
View wp.header-footer-injection.php
View wp.delete-user-role.php
<?php
//check if role exists before removing it
if( get_role('entwurfsautor') ){
remove_role( 'entwurfsautor' );
}
?>
@radarin
radarin / wp.add-new-user-role.php
Created Jan 26, 2019
Neue Benutzerrolle anlegen
View wp.add-new-user-role.php
<?php
add_role(
'entwurfsautor',
__( 'Entwurfsautor' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => true,
'upload_files' => true,
'edit_published_posts' => true,
View php.pw-generator.php
<?php
// Quelle: SnowCrash
// Funktion
function generatePW($length=8)
{
// Zu verwendende Zeichen definieren
$dummy = array_merge(range('0', '9'), range('a', 'z'), range('A', 'Z'), array('#','&','@','$','_','%','?','+'));
// Array zufaellig fuellen
View php.randompic.php
<?php
// Allgemeine PHP-Variante
add_shortcode( 'randompic', 'rad_randompic' );
$vn = "./static-img/randompic";
$html_vn = "static-img/randompic/";
$barray = array(1,2,3,4,5);
$verzeichnis = opendir($vn);
while($file = readdir($verzeichnis)) {
$s = @getimagesize($vn."/".$file);
if(in_array($s[2], $barray))
@radarin
radarin / wp.glossar.frontend.content.php
Created Jan 14, 2019
Funktion zur Umwandlung der Glossar-Begriffe in Links
View wp.glossar.frontend.content.php
<?php
// Code folgt...
?>
You can’t perform that action at this time.