How to Add Google AdSense Code inside a WordPress Post

How to Add Google AdSense Code inside a WordPress Post

September 26, 2019 100 By Bernardo Ryan


how to add Google AdSense code
inside a WordPress post hello and welcome and in this quick video session I’m
going to show you a simple method and for you to be able to add your
Google AdSense code anywhere within your post as I’ve shown
you it was very simple to add it on your sidebar right but what if you wanna add it somewhere else and have more control over where the Ad appears simply you grab the code that you’ve generated
in Google AdSense so if you haven’t done so you
login and create an Ad unit right now once you do
what you do is you login into your dashboard in your WordPress site go under appearance here and let’s
go under editor now these are all the core files that
actually fires your WordPress site now I would strongly encourage you not
to play around with these apart from what I will show you unless
you know what you’re really doing okay so what I’ve done is I’ve located
the functions dot PHP file which all WordPress sites have
regardless of the theme that you’re using okay and what I do is I scroll down towards the end of the functions.php file and what I do is
let me quickly just create this function bare with me this is very simple okay I’m not gonna go through
explaining everything because it’s too simple by name it anything I want up okay okay now that’s all I need here okay and when I do is I simply paste that Google AdSense code inside that return code element there right so that’s all I’ve done now what’s next next is simply when I need to do is I need to have access to this function
that I’ve just created and I need to add a short code let me create this code will be available in
description of this video so what I put here is I say okay add to appear add to appear here and the I simply copy the name of the function copy and paste inside this apostrophe okay so simply I paste that in there and that’s all there is to it now what’s next I simply hit update file now once I do and let’s go inside this post that I had right and let’s add our Google AdSense code just here and let’s add one here as well its here okay let’s add it in two places let’s find that post we locate posts and this is the post that we’ve just seen
before let’s edit that and let’s choose we’ve got two
different options one visual one text this choose text and here and what we do is and bare with me because I forgotten the name of the function I’ve just created
bare with me let me open that function file up where was it down the bottom add to appear here silly me now add to appear where ever I want right I just do this and I just paste that name that I’ve
created let me copy that short code now let me copy that
and let me put it just under here as well let me paste that and let me update that file and once I
do now all I have to do to is simply hit refresh and voila I have total control of where the Google AdSense appear within my posts anywhere I
can add them anywhere and not just the sitebar as you can see it is very simple the code will be
available surely you change the what goes here you simply you add your own so this code will
be available in the description and then it’s just matter of putting it in brackets and then calling that name whatever you
named it as add to appear you can say ABC whatever right if I was to say ABC okay and I just copy that then I would surely call it as such okay and then when I update same thing
would happen so that means I would show ads anywhere that I want within the content of
the post itself or the page okay I thank you very much for your visit and
if you operate a WordPress site I have many different video tutorials
that show you many useful insights thank you for learning with me I’ll talk
to you very soon happy rankings thank you