Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Plugin Name: Remember Me
* Description: Play song from Coco when checking the Remember Me checkbox on the login screen.
* Plugin URI: https://gist.github.com/westonruter/86a191a898015f26e603d6594cc282d2
* Author: Weston Ruter
* Author URI: https://weston.ruter.net
* Gist Plugin URI: https://gist.github.com/westonruter/86a191a898015f26e603d6594cc282d2
*/
@fernandiez
fernandiez / functions.php
Last active March 11, 2019 12:25
Create menu section under Tools in WordPress admin dashboard and Editor role redirect
<?php
// Create menu section under Tools in WordPress admin
add_action( 'admin_menu', 'docs_admin_menu' );
// New section under Tools
function docs_admin_menu() {
add_management_page( 'Docs', 'Docs', 'manage_categories', 'docs', 'content_docs_admin_menu' );
}
@pento
pento / stars-block.js
Last active January 4, 2022 14:00
Gutenberg Stars Block
( function( blocks, element ) {
var el = element.createElement;
function Stars( { stars } ) {
return el( 'div', { key: 'stars' },
'★'.repeat( stars ),
( ( stars * 2 ) % 2 ) ? '½' : '' );
}
blocks.registerBlockType( 'stars/stars-block', {
@BinaryMoon
BinaryMoon / jetpack-related-posts-test.php
Last active December 2, 2019 06:45
Display Jetpack Related Posts in a local environment. Note that the thumbnails won't load - but it's good enough to be able to test styles
@banago
banago / get-fisrt-paragraph.php
Created November 6, 2012 09:18
Get first paragraph from a WordPress post.
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @return string
*/
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: