Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Changes to Annotum Wordpress theme to support ePub Export Plugin
* Get the ePub download link for a post
* @param int $id
* @return string
function anno_epub_download_url($id = null) {
# Requires ePub Export Plugin, returns "" if ePub Export Plugin didn't create ePub file
$article_id = get_the_ID();
$uploads = wp_upload_dir();
$fname = $uploads[path] . "/" . $article_id . ".epub";
// Use link if ePub exists
if (file_exists($fname)) {
$url = $uploads[url] . "/" . $article_id . ".epub";
} else {
$url = "";
return $url;
// Set a default ePub Link
$epub_link = '';
if (function_exists('anno_epub_download_url')) {
$epub_url = anno_epub_download_url(get_the_ID());
if (!empty($epub_url)) {
$epub_link = '<a href="'.esc_url($epub_url).'">'.__('ePub', 'anno').'</a>';
<div class="tools-bar supplement clearfix">
<div class="cell print">
<a href="#" onclick="window.print(); return false;"><?php _e('Print Article', 'anno'); ?></a>
<div class="cell citation">
<a><?php _e('Citation', 'anno'); ?></a>
<div class="citation-container">
<textarea class="entry-summary" readonly><?php anno_the_citation(); ?></textarea>
</div><!--/.citation-container -->
<div class="cell download">
<?php echo implode(', ', array($pdf_link, $xml_link, $epub_link)); ?>
<div class="cell share clearfix">
<div class="social-nav">
<ul class="nav">
<li><?php anno_email_link(); ?></li>
<li><?php anno_twitter_button(); ?></li>
<li><?php anno_facebook_button(); ?></li>
</div><!-- .action-bar -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment