placeholder lbry published banner
This commit is contained in:
parent
42c4c36bb2
commit
56a6443b6d
2 changed files with 30 additions and 0 deletions
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
4
templates/published_on_lbry_banner.php
Normal file
4
templates/published_on_lbry_banner.php
Normal 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>
|
Loading…
Reference in a new issue