Add YouTube Subscribe Button On Your Website

Getting Your YouTube ID

The trickiest part of this entire process is getting your YouTube ID, therefore Click here, it will open up a new YouTube tab. In the top right portion of the screen, click on the round icon with your profile picture. Next, you will see a drop down, click on where it says “My Channel”.

My Channel YouTube

Once the page loads scroll to the top where you see the address bar. In that URL you will see the number that you need. Your number will be different but I highlighted the number in blue below. You want everything after the slash “/” and before the question mark “?”.

YouTube Id Number

Only cool people share!

Create The Subscribe Button

Now go back to the page you were on and create the subscribe button. If you lost your place, you can also click this link and it will take you directly to that page. Paste that number into the box provided.

Customize YouTube Subscribe Button

Customize YouTube Subscribe Button

Now you can customize your YouTube subscribe button. There is a dark theme and a light theme. You can also have a compact layout or a full layout. If you would like to show your subscriber count, you can reveal that as well. As you select these options, you will see a preview of what it will look like. When you are satisfied with the result then copy the code in the box. This is what you place in your website.

Code For YouTube Subscribe Button

Placing The Subscribe Button In Your Website

Place the subscribe button anywhere on your website. If you use WordPress, then you may place it in a widget. If there is too much clutter in your widgets then place the subscribe button in the content itself like I do. Here is a code to put in your functions.php file if you want to copy the way I do it. It will place it after the 4th paragraph on your posts. Look for the part where it says, “PUT YOUR YOUTUBE SUBSCRIBE BUTTON CODE HERE” because that is where you put your code.

 

//Insert YouTube subscribe button after fourth paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_adss' );
function prefix_insert_post_adss( $content ) {
$ad_code = '<div>Subscribe To My YouTube Channel: </div>
<div>PUT YOUR YOUTUBE SUBSCRIBE BUTTON CODE HERE</div>';
if ( is_single() || is_page() ) {
return prefix_insert_after_paragraphh( $ad_code, 4, $content );
}
return $content;
}
// Parent Function that makes the magic happen
function prefix_insert_after_paragraphh( $insertion, $paragraph_id, $content ) {
$closing_p = '</p>';
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {
if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}
if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}
return implode( '', $paragraphs );
}

 

Update: If you want to include the YouTube subscribe button on your website without it slowing your website down, please see this post. Ajax In WordPress Tutorial | Ultimate Beginners Guide (a1websitepro.com) THere is a plugin there that I made you can download for free and put on your websites.

Thanks for reading. Please be sure to subscribe to this blog because we have more great tutorials coming up. See video of this process on the next page.

Add YouTube Subscribe Button On Your Website was last modified: November 10th, 2021 by Maximus Mccullough
Add YouTube Subscribe Button On Your Website

Pages:Previous 1 2 3 Next

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.