Skip to content

Instantly share code, notes, and snippets.

View UltraSimplified's full-sized avatar

Robin Layfield UltraSimplified

View GitHub Profile
@UltraSimplified
UltraSimplified / functions.php
Created February 26, 2016 12:31
WP > Hierarchical List of Ancestors, Siblings, Children of current page
/**
* Create HTML list of pages.
*
* @package Razorback
* @subpackage Walker
* @author Michael Fields <michael@mfields.org>
* @copyright Copyright (c) 2010, Michael Fields
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @uses Walker_Page
@UltraSimplified
UltraSimplified / functions.php
Last active November 24, 2022 17:27
Override the standard WordPress password messages
/*
* Change the password reset text
*
**/
function change_password_reset_text_filter( $translated_text, $untranslated_text, $domain ) {
switch( $untranslated_text ) {
case 'Enter your new password below.':
@UltraSimplified
UltraSimplified / relative-time.php
Last active November 26, 2024 16:42 — forked from mtttmpl/relative-time.php
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks')
<?php
function time2str($ts) {
if(!ctype_digit($ts)) {
$ts = strtotime($ts);
}
$diff = time() - $ts;
if($diff == 0) {
return 'now';
} elseif($diff > 0) {
$day_diff = floor($diff / 86400);
@UltraSimplified
UltraSimplified / Restrict_access_to_WP_Site_Health.php
Last active December 2, 2020 10:00
Restrict access to WordPress Site Health notices
add_action('wp_dashboard_setup', 'restrict_site_health_dashboard_widget' );
/**
* Restrict access to Site Health Dashboard Widget
*
*/
function restrict_site_health_dashboard_widget() {
// permitted users
$permitted_users = []; // Array of permitted user ids