Skip to content

Instantly share code, notes, and snippets.

View jeremyboggs's full-sized avatar

Jeremy Boggs jeremyboggs

View GitHub Profile
<?php
function my_custom_coins_title($coinsTitle)
{
global $post;
$affiliation = get_post_meta($post->ID, 'affiliation', true);
$issue = get_post_meta($post->ID, 'issue', true);
$volume = get_post_meta($post->ID, 'volume', true);
$pub_date = get_post_meta($post->ID, 'pub_date', true);
@jeremyboggs
jeremyboggs / people_post_type.php
Created May 29, 2012 19:06
Custom post type for People in WP. Includes dropdown of existing users to associate to the person post.
<?php
/**
* Custom Post Type for People
*/
function people_register_post_types() {
register_post_type( 'people',
array(
'labels' => array(
'name' => __( 'People' ),
<?php
function sanitize_string($string) {
$string = strtolower($string);
// Gets rid of spaces
$sanitized = preg_replace('/\s/', '', $string);
// Gets rid of non-alphanumerics
$sanitized = preg_replace( '/[^A-Za-z0-9_]/', '', $string );
@jeremyboggs
jeremyboggs / link_images_to_fullsize.php
Created May 15, 2012 19:44
Change the link around images files in Omeka to point to the fullsize image, not the archival image.
@jeremyboggs
jeremyboggs / filter_scholarpress_coins.php
Created May 6, 2012 15:42
Illustrates how to use new filter in ScholarPress Coins plugin
<?php
function my_custom_coins_title($coinsTitle)
{
global $post;
// Starts the coins title value again.
$coinsTitle = 'ctx_ver=Z39.88-2004'
. '&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc'
. '&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator'
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.7)
chunky_png (1.2.5)
compass (0.12.1)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
compass-susy-plugin (0.9)
@jeremyboggs
jeremyboggs / article-header-markup.html
Created April 19, 2012 14:42
Curious what the best way to mark up a heading with a kicker and byline would be. What tags, and in what order.
<header>
<p class="kicker">Latest Post</p>
<h1>Post Title</h1>
<p class="byline"><time datetime="2011-03-25">March 25, 2011</time></p>
</header>
@jeremyboggs
jeremyboggs / custom-item-show.php
Created April 18, 2012 13:24
Set parameters on $_GET to display different metadata on an Omeka's items/show template.
<?php head(array('title' => item('Dublin Core', 'Title'), 'bodyid'=>'items','bodyclass' => 'show')); ?>
<div id="primary">
<!-- Our item view navigation. Sets a parameter on $_GET, so we can change what gets displayed accordingly. -->
<a href="<?php echo abs_item_uri(); ?>?view=transcript">View Transcript</a> | <a href="<?php echo abs_item_uri(); ?>">View Metadata</a>
<h1><?php echo item('Dublin Core', 'Title'); ?></h1>
@jeremyboggs
jeremyboggs / add_post_title_class.php
Created April 9, 2012 14:55
Adds post title as a value to WP's body_class and post_class
<?php
function add_post_title_class($classes) {
global $post;
if ($postTitle = sanitize_title($post->post_title)) {
$classes[] = $postTitle;
}
return $classes;
<?php
$page = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array(
'posts_per_page' => '10',
'cat' => '-592, -614',
'post_status' => 'publish',
'paged=' . $page
);
query_posts($args);