0

I'm looking for a way to insert "THIS ARTICLE MAY CONTAIN COMPENSATED LINKS. PLEASE READ DISCLAIMER FOR MORE INFO." after the H1 in all my blog posts (not pages).

Is there a way to do it without plugins?

Thanks

2
  • 1
    Yes, you need to edit the template file, For blog listing change template-parts/content.php And for single detailed post page change to template-parts/content-single.php Mar 5 at 9:15
  • is the H1 the post title or is it part of the content of the post?
    – Michael
    Mar 6 at 18:08
0

Something like this in your template files

<h1><?php the_title(); ?></h1>
<p><small>THIS ARTICLE MAY CONTAIN COMPENSATED LINKS. PLEASE READ <a href="/link-to-disclaimber/">DISCLAIMER</a> FOR MORE INFO.</small></p>
0
add_filter('wp_title', 'filter_pagetitle');
function filter_pagetitle($title) {
   if ( is_single() && 'post' == get_post_type() ) {
   return $title ."<br>THIS ARTICLE MAY CONTAIN COMPENSATED LINKS. PLEASE READ DISCLAIMER FOR MORE INFO";
   }
   return $title;
   
}

Add this to function.php it will be add specified text on the single article page. if you don't want the text to be on next line remove
tag

0

I ended up learning a little bit about the structure of PHP, and make a simple HTML line of code on single.php (WordPress posts) to appear exactly where I wanted.

Thanks all for your replies 😃

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.