placeholder lbry published banner

This commit is contained in:
Paul Kirby 2018-11-01 12:33:18 -05:00
parent 42c4c36bb2
commit 56a6443b6d
2 changed files with 30 additions and 0 deletions

View file

@ -151,6 +151,10 @@ class LBRYPress
{ {
register_activation_hook(LBRY_PLUGIN_FILE, array($this, 'activate')); register_activation_hook(LBRY_PLUGIN_FILE, array($this, 'activate'));
register_deactivation_hook(LBRY_PLUGIN_FILE, array($this, 'deactivate')); register_deactivation_hook(LBRY_PLUGIN_FILE, array($this, 'deactivate'));
// Banner output for published posts
// NOTE: move this to its own class to reduce clutter?
add_action('the_content', array($this, 'published_on_lbry_banner'), 12, 1);
} }
/** /**
@ -198,6 +202,28 @@ class LBRYPress
error_log('Deactivated'); error_log('Deactivated');
} }
public function published_on_lbry_banner($content)
{
if (!is_single() || !in_the_loop() || !is_main_query()) {
return $content;
}
global $post;
if ($post->post_type != 'post') {
return $content;
}
if (!get_post_meta($post->ID, LBRY_WILL_PUBLISH, true)) {
return $content;
}
ob_start();
require(LBRY_ABSPATH . 'templates/published_on_lbry_banner.php');
$banner = ob_get_clean();
return $content .= $banner;
}
/* /*
* Utility Functions * Utility Functions
*/ */

View file

@ -0,0 +1,4 @@
<div class="lbry-published-banner">
<h5>This post has also been published to the <a href="https://lbry.io" target="_blank">LBRY blockchain</a> network.</h5>
<h5><a href="https://lbry.io/learn" target="_blank">Click Here</a> to learn more about the benefits of content freedom.</h5>
</div>