Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created June 7, 2012 23:55
Show Gist options
  • Save jeremyboggs/2892485 to your computer and use it in GitHub Desktop.
Save jeremyboggs/2892485 to your computer and use it in GitHub Desktop.
custom coins
<?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);
$real_author_first = get_post_meta($post->ID, 'real_author_first', true);
$real_author_last = get_post_meta($post->ID, 'real_author_last', true);
// 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'
. '&amp;rft.format=text'
. '&amp;rft.jtitle='.urlencode(get_bloginfo('name'))
. '&amp;rft.atitle='.urlencode($post->post_title)
. '&amp;rft.source='.urlencode(get_bloginfo('name'))
. '&amp;rft.date='.get_the_time('Y-m-d')
. '&amp;rft.identifier='.urlencode(get_permalink($post->ID))
. '&amp;rft.language=English'
. '&amp;rft.pub_date='.date('Y-m-d', strtotime($pub_date))
. '&amp;rft.issue='.urlencode($issue)
. '&amp;rft.volume='.urlencode($volume)
. '&amp;rft.aufirst='.urlencode($real_author_first)
. '&amp;rft.aulast='.urlencode($real_author_last)
. '&amp;rft.genre=article';
if ($cats = get_the_category()) {
foreach((get_the_category()) as $cat) {
$coinsTitle .= '&amp;rft.subject='.urlencode($cat->cat_name);
}
}
return $coinsTitle;
}
add_filter('scholarpress_coins_span_title', 'my_custom_coins_title');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment