Skip to content

Instantly share code, notes, and snippets.

@chssweb
chssweb / functions.php
Created May 3, 2012 08:43
Wordpress Media Bank - Filter by Mime Type
function modify_post_mime_types($post_mime_types) {
$post_mime_types['application/pdf'] = array(__('PDF'), __('Manage PDF'), _n_noop('pdf <span class="count">(%s)</span>', 'pdfs <span class="count">(%s)</span>'));
$post_mime_types['application/msword'] = array(__('Word doc file'), __('Manage Doc'), _n_noop('word doc <span class="count">(%s)</span>', 'word docs <span class="count">(%s)</span>'));
return $post_mime_types;
$post_mime_types['application/rtf'] = array(__('Rich text file'), __('Manage RTF'), _n_noop('rtf <span class="count">(%s)</span>', 'rtfs <span class="count">(%s)</span>'));
return $post_mime_types;
}
add_filter('post_mime_types', 'modify_post_mime_types');
@chssweb
chssweb / 1column macro
Created May 3, 2012 11:32
IMacro for adding articles to a Polopoly section
SET !DATASOURCE course_list.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !VAR1 EVAL("var s =\"{{!COL1}}\";s = s.toLowerCase();s = s.replace(/ /g,\"-\"); s.substring(0,24);")
FRAME F=3
TAG POS=1 TYPE=BUTTON ATTR=TXT:Create
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:mainform ATTR=ID:work_* CONTENT={{!COL1}}
TAG POS=2 TYPE=INPUT:TEXT FORM=NAME:mainform ATTR=ID:work_* CONTENT={{!COL1}}
@chssweb
chssweb / example CSV
Created May 17, 2012 10:57
Lates iMacro for adding a mix of article and sections to a new section
Name,Heading,Breadcrumb,Menu,Friendly URL,Type
"Programmes","Programmes","Programmes","Programmes","programmes","Section"
"Staff","Staff","Staff","Staff","staff","Section"
"Overview","Overview",,,"overview","Article"
@chssweb
chssweb / Free Tools of choice
Created July 26, 2012 13:01
ffmpeg html5 links
##Video
AviDemux - Great all rounder(2.5 as 2.6 crashes all the time for me. Watch out for strange aac flutter at beginning of videos if you use this to encode the audio as well)
VirtualDub (the is a mp4 import plugin that is good, and the beta versions allow setting up external tools so mp4 output may be available http://code.google.com/p/ffinputdriver/downloads/list)
Avisynth - the beast of video manipulation (if you like scripting - see Doom9 forum for advice) (useful with a frameserver http://www.videohelp.com/tools/sections/video-frameservers)
SolveigMM AVI Trimmer + MKV 2 http://www.solveigmm.com/en/products/avi-trimmer-mkv/ (was freeware when I got it.) Seemed to be able to crop/trim MKV containers and edit a frame accuracy better than other tools (Still a last choice if avidemux etc work fine)
FFMPEG - great allinone encoder (see above notes)
Windows live movie maker is probably good as long as the conversion is a straight forward one.
@chssweb
chssweb / Valid_xhtml.html
Created August 21, 2012 09:06
Vimeo snippets
<object type="application/x-shockwave-flash" style="width:400px; height:300px;" data="http://vimeo.com/moogaloop.swf?clip_id=43463508&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" allowfullscreen="true" allowscriptaccess="always">
<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=43463508&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" allowfullscreen="true" allowscriptaccess="always" />
</object>
@chssweb
chssweb / Redirect if iP(ad)(hone).js
Created August 21, 2012 11:19
iPhone and iPad sniffer & redirects variations
if (navigator.userAgent && ( navigator.userAgent.indexOf("iPad") > -1 || navigator.userAgent.indexOf("iPhone") > -1 ))
{
window.location.replace("http://www.YOUR-URL-GOES-HERE.com/iPhone-iPad.html");
}
/* change the ‘www.YOUR-URL-GOES-HERE.com” to your site and change the ‘iPhone-iPad.html’ to the name of your iPhone / iPad message or experience.
http://blog.stephengates.com/2010/06/03/easy-iphoneipad-sniffer/
@chssweb
chssweb / bcn_after_fill.php
Last active December 15, 2015 06:59
Breadcrumbs navxt - http://wordpress.org/extend/plugins/breadcrumb-navxt/ Modifiying the output with its actions
<?php
/* Original breadcrumb: Home >> Section1 >> SubSection1 >> taxonomy
* Becomes: Home >> Section1 >> taxonomy
*/
add_action('bcn_after_fill','fix_keyword_breadcrumb');
function fix_keyword_breadcrumb($trail) {
if (is_tax( 'keywords')){
unset($trail->trail[1]);
@chssweb
chssweb / Event
Last active December 19, 2015 21:38
Microdate markup
[Event itemscope itemtype="http://schema.org/Event"]
Title (itemprop="name")
URL (itemprop="url")
Image (itemprop="image")
description (itemprop="description")
Start Date (itemprop="startDate" content="ISO 8601 date format")
End Date (itemprop="endDate" content="ISO 8601 date format")
[Venue (itemprop="location" itemscope itemtype="http://schema.org/Place")]
@chssweb
chssweb / shortcode.php
Last active December 28, 2015 00:18
Shortcode code to display custom post by date range
function fellows_shortcode($atts)
{
// Extract Shortcode Attributes
extract(shortcode_atts(
array(
'range' => 'all',
), $atts)
);
@chssweb
chssweb / publications
Created November 11, 2013 13:56
Publications post type
function register_cpt_publication() {
$labels = array(
'name' => _x( 'Publications', 'publication' ),
'singular_name' => _x( 'Publication', 'publication' ),
'add_new' => _x( 'Add New', 'publication' ),
'all_items' => _x( 'Publications', 'publication' ),
'add_new_item' => _x( 'Add New Publication', 'publication' ),
'edit_item' => _x( 'Edit Publication', 'publication' ),
'new_item' => _x( 'New Publication', 'publication' ),