Skip to content

Instantly share code, notes, and snippets.

View Irfan-Ansari's full-sized avatar

Irfan Ansari Irfan-Ansari

View GitHub Profile
@Irfan-Ansari
Irfan-Ansari / gist:5bf91886cdbc4709c153
Last active September 11, 2015 16:31 — forked from davidmh/gist:5689418
Fast Next/Prev Post Links for large databases. http://wordpress.stackexchange.com/q/101435/
<?php # -*- coding: utf-8 -*-
namespace WPSE;
/* Plugin Name: Fast Next/Prev Post Links
* Plugin URI: http://wordpress.stackexchange.com/q/101435/
*/
add_action(
'fast_prev_post_link',
__NAMESPACE__ . '\fast_prev_post_link',
10,
<?
function mandatory_excerpt($data) {
$excerpt = $data['post_excerpt'];
if (empty($excerpt)) {
if ($data['post_status'] === 'publish') {
add_filter('redirect_post_location', 'excerpt_error_message_redirect', '99');
}
function THEMENAME_wrap_gumby_intrinsic($html, $url, $args){
$provider = '';
if (preg_match("#https?://youtu\.be/.*#i", $url) || preg_match("#https?://(www\.)?youtube\.com/watch.*#i", $url)) {
$provider = 'youtube';
}elseif (preg_match("/vimeo.com\/([^&]+)/i", $url)) {
$provider = 'vimeo';
}
//no oEmbed for Twich :<
//elseif (preg_match("/https?:\/\/(.*twitch\.tv\/.*|.*twitch\.tv\/.*\/b\/.*)/i", $url)){
//$provider = 'twitch';
<?php
/*
Plugin Name: Remove All Feeds [for WPSE33072]
Description: Remove all feeds from WordPress
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
*/
// Use the new media manager to handle uploads to Soliloquy.
$('#soliloquy-area').on('click.soliloquyUpload', '#soliloquy-upload', function(e){
// Prevent the default action from occuring.
e.preventDefault();
// Variable to hold our media applicaton.
var soliloquy_frame;
// If the media frame already exists, reopen it and return.
if ( soliloquy_frame ) {
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
<?php
define('MY_POST_TYPE', 'my');
define('MY_POST_SLUG', 'gallery');
function my_register_post_type () {
$args = array (
'label' => 'Gallery',
'supports' => array( 'title', 'excerpt' ),
'register_meta_box_cb' => 'my_meta_box_cb',
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012, Faisalman <[email protected]>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
<style type="text/css">
body.about h1 { /*Let's presume your banner title is an h1 element */
width: 150px; /* Set this to the width of your image */
height: 75px; /* Set this to the height of your image */
background: transparent url('my-image.png') no-repeat top left; /* Change the URL to point to your image */
text-indent: -9999em; /* This ensures that the text itself will not show. */
}
</style>
<html>
<?php
add_filter('wp_title', 'archive_titles');
/**
* Modify <title> if on an archive page.
*
* @author Philip Downer <[email protected]>
* @link http://manifestbozeman.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version v1.0
*