Skip to content

Instantly share code, notes, and snippets.

View dknauss's full-sized avatar

Dan Knauss dknauss

View GitHub Profile
<?php
/* a couple of filters to remove elements from titles */
add_filter( 'get_the_archive_title', 'wptv_remove_title_elements', 10, 1);
function wptv_remove_title_elements($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
<?php
/*
Plugin Name: ER Post Password Expires
Plugin URI: https://squareone.software
Description: Sets the expiration of a post/page password protected page
Version: 1.0.0
Author: Elliott Richmond
Author URI: https://squareone.software
Text Domain: er-post-password-expires
@shaunlebron
shaunlebron / realtalk.md
Last active October 29, 2025 13:21
why Dynamicland Realtalk isn't open source

Transcribed from an interview with Toby Schachman and Paula Te on The Afrofuturist Podcast:

There's this notion of the open-source movement. There are a lot of things
that we totally resonate with that because it's about understanding how your
technology works. We're totally 100% on board with that.

But then there are other issues with the open-source community, where it's
very internet-based and so open-source ends up benefitting this group of
people who have really strong access to internet and understand how to use
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
@pento
pento / php-block.js
Last active January 20, 2026 00:20
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@nicomollet
nicomollet / polylang-langswitcher-shortcode.php
Last active April 16, 2025 15:26
Polylang shortcode for lang switcher
<?php
/**
* Polylang Shortcode - https://wordpress.org/plugins/polylang/
* Add this code in your functions.php
* Put shortcode [polylang_langswitcher] to post/page for display flags
*
* @return string
*/
function custom_polylang_langswitcher() {
$output = '';
@joshfitzgerald
joshfitzgerald / new_gist_file_0
Created August 18, 2017 01:57
Disable unfiltered HTML Although low-level users (subscribers, contributors, authors) can’t publish unfiltered HTML in WordPress, editors and administrators are allowed to do so. By adding the following line of code to your wp-config file, you can increase security by preventing high-level users from publishing unfiltered HTML.
# Disables unfiltered HTML for admins and editors
define( 'DISALLOW_UNFILTERED_HTML', true );
@felixarntz
felixarntz / wp-scoped-mu-plugin-loader.php
Last active December 28, 2024 23:12
WP Scoped MU Plugin Loader
<?php
/*
Plugin Name: WP Scoped MU Plugin Loader
Plugin URI: https://gist.github.com/felixarntz/9b3bed66099641a45ce437b067fea547
Description: Loads scoped MU plugins for specific sites or networks for an improved organization of those more specific tweaks.
Version: 1.0.0
Author: Felix Arntz
Author URI: https://leaves-and-love.net
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Morning routine template

Part 1: Wake up

Remember not to snooze, get some natural light on your face, and turn on as many lights as you can to signal to your body that it’s time to be awake. If you don’t shower immediately, try washing your face right after getting up to help your eyes feel more awake, too.

  • 1.
  • 2.
  • 3.
@carlodaniele
carlodaniele / media-hacks.php
Last active August 4, 2025 15:55
An example WP plugin which adds functionalities to the WordPress Media Library
<?php
/**
* @package Media_hacks
* @version 1.0
*/
/*
Plugin Name: Media hacks
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele