public
Created

Changes to Annotum Wordpress theme to support ePub Export Plugin

  • Download Gist
anno-xml-download.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/**
* 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;
}
tools-bar.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
// 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>
<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>
<div class="cell download">
<?php echo implode(', ', array($pdf_link, $xml_link, $epub_link)); ?>
</div>
<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>
</ul>
</div>
</div>
</div><!-- .action-bar -->

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.