Skip to content

Instantly share code, notes, and snippets.

View jeremyboggs's full-sized avatar

Jeremy Boggs jeremyboggs

View GitHub Profile
@jeremyboggs
jeremyboggs / custom_nav_menu_item_id.php
Created August 23, 2012 18:13
Use menu title for ID attribute instead of an number in WordPress's wp_nav_menu output
<?php
/**
* Use menu title for ID attribute instead of an number.
*
* Sanitizes the menu item's title to get a valid string for use in an ID
* attribute.
*/
function custom_nav_menu_item_id($id, $item) {
$title = sanitize_title_with_dashes($item->title);
@jeremyboggs
jeremyboggs / load_theme_javascripts.php
Created September 24, 2012 19:33
Function to add Modernizr, Respond.js, and Selectivizr to Omeka
<?php
/**
* Adds and displays the following JavaScript assets:
*
* - Modernizr - http://modernizr.com/
* - Respond.js - https://github.com/scottjehl/Respond
* - Selectivizr - http://selectivizr.com/
*
* Be sure to put copies of each in your theme's 'javascripts' directory.
@jeremyboggs
jeremyboggs / structure.html
Created September 25, 2012 15:19
html structure
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>CSS Layout</title>
<style type="text/css" media="screen">
</style>
@jeremyboggs
jeremyboggs / neatline_maps.js.diff
Created September 25, 2012 18:42
Diff that adds the Imperium Romanum map as a baselayer in Neatline
diff --git a/views/shared/javascripts/neatline_map.js b/views/shared/javascripts/neatline_map.js
index 8894897..253d73a 100644
--- a/views/shared/javascripts/neatline_map.js
+++ b/views/shared/javascripts/neatline_map.js
@@ -848,6 +848,17 @@
}
);
+ this.imrm = new OpenLayers.Layer.XYZ(
+ "Imperium Romanum",
@jeremyboggs
jeremyboggs / queue_theme_assets.php
Created September 25, 2012 20:04
Queues Omeka theme assets
<?php
function queue_theme_assets() {
queue_js('modernizr.min');
$respondSrc = src('respond.min.js', 'javascripts');
$modernizrLoad = "Modernizr.load([{test: Modernizr.mq(), nope: " . "['$respondSrc']}]);";
queue_js_string($modernizrLoad);
__v()->headScript()->appendFile(src('selectivizr.min.js', 'javascripts'), 'text/javascript', array('conditional' => 'lt IE 9'));
@jeremyboggs
jeremyboggs / get_files_by_mime_type.php
Created September 30, 2012 14:15
Get Omeka files with particular MIME types. Defaults are HTML, XML, PDF, RTF, Word, and plain text.
<?php
/**
* Helper to only retrieve files with particular MIME types. Defaults include:
*
* - HTML (text/html)
* - XML (application/xml)
* - PDF (application/pdf)
* - RTF (text/rtf)
* - MS Word (application/msword)
@jeremyboggs
jeremyboggs / custom_excerpt_more.php
Created October 11, 2012 15:16
Filters 'excerpt_more' in WordPress to provide a 'Continue reading' link. Add to your theme's functions.php file.
<?php
/**
* Filters 'excerpt_more' to provide a 'Continue reading' link.
*/
function custom_excerpt_more($more) {
global $post;
$more = '&hellip;. <a href="'. get_permalink($post->ID) . '">Continue reading.</a>';
return $more;
}
@jeremyboggs
jeremyboggs / item-metadata.php
Created October 23, 2012 19:48
Changes different heads for various DC fields.
<div class="element-set">
<h2><?php echo html_escape(__($setName)); ?></h2>
<?php foreach ($elementsInSet as $info):
$elementName = $info['elementName'];
if ($setName == 'Dublin Core') {
switch($elementName) {
// Check if $elementName is 'Description'
case 'Description':
$elementName = 'Header'; // Change value of $elementName to 'Header'
break;
@jeremyboggs
jeremyboggs / functions.php
Created November 1, 2012 15:07
Switch certain field headings in Omeka's custom_show_item_metadata function.
<?php
function custom_show_item_metadata(array $options = array(), $item = null)
{
$item = $item ? $item : get_current_item();
if ($dcFieldsList = get_theme_option('display_dublin_core_fields')) {
$otherElementSets = array();
@jeremyboggs
jeremyboggs / omeka-theme-checklist.md
Created November 2, 2012 17:17
Checklist for developing an Omeka theme

Omeka Theme Checklist

Checklist for developing an Omeka theme. Things to check, ensure they look and work OK.

  • Homepage
    • Display featured item
    • Display featured collection
    • Display recent items
  • Readability (A simple page with a variety of markup—headings, paragraphs, lists, blockquotes, links, etc.)
  • Items