Skip to content

Instantly share code, notes, and snippets.

View epschmidt's full-sized avatar

Eric Schmidt epschmidt

View GitHub Profile
@epschmidt
epschmidt / functions.php
Last active October 19, 2021 17:40
Add a checkbox to the Add/Edit Link popup in WordPress to add a 'button' class to links. Replaces default wplink.js script. Current as of WordPress 4.2.4.
<?php
// adds checkbox to make link a button
function add_class_wplink() {
wp_deregister_script( 'wplink' );
wp_register_script( 'wplink', get_template_directory_uri() . '/js/admin/wplink.js', array( 'jquery', 'wpdialogs' ), false, 1 );
wp_localize_script( 'wplink', 'wpLinkL10n', array(
'title' => __('Insert/edit link'),
'update' => __('Update'),
@epschmidt
epschmidt / functions.php
Created September 8, 2017 13:32
Return video embed info from YouTube and Vimeo by URL
function get_video_data($url) {
$id = '';
$result = '';
$video = array();
$split_url = parse_url( $url );
if ( isset( $split_url['host'] ) ) {
$video['host'] = $split_url['host'];
// Youtube Thumbnail
if (preg_match("/^(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?(?=.*v=((\w|-){11}))(?:\S+)?$/", $url, $matches))
{
@epschmidt
epschmidt / tiny_login.php
Created April 6, 2020 13:28 — forked from ideag/tiny_login.php
WordPress front-end login and registration forms
<?php
/*
Plugin Name: tinyLogin
Plugin URI: http://wp.tribuna.lt/tiny-login
Description: A simple front-end login/registration system. Adds template tags and shortcodes. Shortcodes: [tiny_form_login]/[tiny_form_register]. Template tags: get_tiny_form_login()/get_tiny_form_register() and the_tiny_form_login()/the_tiny_form_register()
Version: 0.1
Author: Arūnas
Author URI: http://wp.tribuna.lt/
Text Domain: tiny_login
*/
@epschmidt
epschmidt / app.yaml
Last active April 16, 2021 19:44
gae-app.php and app.yaml setup for WordPress Multisite in subfolders on Google App Engine Standard
# App Engine runtime configuration
runtime: php74
instance_class: F4
# Defaults to "serve index.php" and "serve public/index.php". Can be used to
# serve a custom PHP front controller (e.g. "serve backend/index.php") or to
# run a long-running PHP script as a worker process (e.g. "php worker.php").
entrypoint: serve gae-app.php
# Defines static handlers to serve WordPress assets