Skip to content

Instantly share code, notes, and snippets.

View roose's full-sized avatar
🐢
Looking for a job

roose roose

🐢
Looking for a job
View GitHub Profile
@clawfire
clawfire / functions.php
Created May 7, 2011 23:36
Wordpress custom post
<?php
/*-----------------------------------------------------------------------------------*/
/* Create a new post type called course
/*-----------------------------------------------------------------------------------*/
function create_post_type_courses()
{
$labels = array(
'name' => __( 'Course'),
'singular_name' => __( 'Course' ),
@olostan
olostan / gist:954605
Created May 4, 2011 01:45
fifteen (pure css)
<!DOCTYPE html>
<html>
<head>
<style type="text/css" id="s1" name="s1">
span[class*="row"] {
position: absolute;
width: 25px;
height: 25px;
background: #eee;
padding: 5px;
@jankeesvw
jankeesvw / Functions.php
Created April 19, 2011 08:58
Grayscale image in wordpress
<?php
add_filter('update_attached_file', 'convertToGrayscale');
function convertToGrayscale($location,$id)
{
$info = getimagesize($location);
switch ($info['mime'])
{
case 'image/jpeg':
@patrickarlt
patrickarlt / awesome_twitter.php
Created April 12, 2011 16:11
A dead simple wordpress plugin to get your tweets on a wordpress site.
<?php
/*
Plugin Name: Awesome Twitter Plugin
Plugin URI:
Description: Adds a function to grab your latest tweets and caches them in the database.
Author: Patrick Arlt
Version: 0.01
Author URI: http://patrickarlt.com
*/
<?php
// Register the column
function price_column_register( $columns ) {
$columns['price'] = __( 'Price', 'my-plugin' );
return $columns;
}
add_filter( 'manage_edit-post_columns', 'price_column_register' );
@scribu
scribu / gist:906872
Created April 7, 2011 01:21
'price' sortable column example
<?php
// Register the column
function price_column_register( $columns ) {
$columns['price'] = __( 'Price', 'my-plugin' );
return $columns;
}
add_filter( 'manage_edit-post_columns', 'price_column_register' );
@scribu
scribu / wp-hooks-filters-flow.php
Created March 31, 2011 00:38
WordPress Hooks & Filters Flow
<?php
/*
Script Name: Wordpress Hooks & Filters Flow
Plugin URI: http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/
Description: Lists hooks and their associated filters/actions for your blog. Meant to provide debugging help.
Version: 1.0
Author: Ozh
Author URI: http://planetOzh.com/
*/
@gfscott
gfscott / Better Wordpress excerpt link
Created March 29, 2011 18:30
Wordpress's default the_excerpt() function includes no link at the end, just [...]. This snippet adds a "Read More" permalink to the end of the excerpt.
<div id="feedbackGadget" style="left: 359px; top: 20px; visibility: hidden; display: none; " class="gn-gaiabar-gadget">
<div id="feedbackIframe">
<iframe id="feedbackIframeId" name="feedbackIframeId" class="gn-gaiabar-iframe" src="https://spreadsheets.google.com/embeddedform?key=pPo2nzr1TywUz6Kp4cvV6NA&amp;hl=en&amp;gridId=0" frameborder="0" style="height: 320px; width: 480px;">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Feedback</title>
@thefuxia
thefuxia / utf8_truncate.php
Created March 10, 2011 16:09
function utf8_truncate() for WordPress
<?php
/**
* Shortens an UTF-8 encoded string without breaking words.
*
* @link http://wordpress.stackexchange.com/q/11085/11089#11089
* @param string $string string to shorten
* @param int $max_chars maximal length in characters
* @param string $append replacement for truncated words.
* @return string
*/