Skip to content

Instantly share code, notes, and snippets.

View eccentricpixel's full-sized avatar

Eccentric Pixel eccentricpixel

View GitHub Profile
@yratof
yratof / functions.php
Created March 10, 2015 14:37
ACF OEmbed with thumbnails
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
@eccentricpixel
eccentricpixel / gist:c8ac4a7534facb51aa4c
Last active August 29, 2015 14:07
Upgrade of Wordpress' media search function to find matches in the filename which is stored in the GUID column. In the end, a much more user-friendly (client-friendly) experience. Works with modal select windows too (ex: add media buttons).
/* Upgrade the Media search to allow for searching the filename.
* =========================================================== */
add_filter( 'posts_search', 'guid_search_media', 10, 2 );
function guid_search_media( $search, $a_wp_query )
{
global $wpdb, $pagenow;
// Only Admin side && Only Media Library page
@cliffordp
cliffordp / functions.php
Last active September 23, 2023 06:22
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@Burrer
Burrer / Form.css
Last active May 25, 2023 05:28
Contact Form: Using SendGrid WebAPI and cURL PHP
/* Form.html CSS, just copy and paste any where in your style.css file, or customize to fit with your domain */
form.contact p {
font-size: 15px;
padding: 0 0 15px 0;
margin: 0;
}
form.contact input, form.contact textarea {
font-family: Arial;
font-size: 15px;
@zigotica
zigotica / youtube-poster-frame.css
Last active August 8, 2024 22:50
Very simple method to add custom poster frame to youtube video without using youtube API. This code is also valid in browsers not supporting window.postMessage (API uses postMessage). The trick is adding the iframe in a comment. Javascript reads comment contents and saves iframe definition to a var. When JQuery (for the sake of brevity, not real…
.video { position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; }
.video img { position: absolute; display: block; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; cursor: pointer; }
.video:after { content: ""; position: absolute; display: block;
background: url(play-button.png) no-repeat 0 0;
top: 45%; left: 45%; width: 46px; height: 36px; z-index: 30; cursor: pointer; }
.video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* image poster clicked, player class added using js */
.video.player img { display: none; }
.video.player:after { display: none; }
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);