Hello friends welcome to this video
tutorial by perfect Web Solutions
my name is Imran Qasim and in today's
Video Tutorial of WordPress and
WooCommerce for intermediate and advanced
users we are going to learn that how can
we add a simple view counter in the
post what I mean that sometimes you want
to see that how many times your post has
been viewed so you need you need to find a
plug-in for it but with the help
of this video Tutorial you don't need to
find any Plugin put this
small snippet inside your function.php
and then you can echo out it anywhere you want it on the post so
let's get started I have already opened
my favorite text editor Which is SublimeText
text and in that submental I have loaded
my simple source in which is currently
active theme of my wordpress
installation of new stores so let me
show you first if i open local host /
blue store you will see the front end of
the website so what exactly I want to do
here is let me show you that this is a
child theme of Max Asher so first I need
to notify from Max's team ever and pop
it inside so from the Mac school I need
to copy with it all this will depend on
using which theme you are using so I'm
not going to explain this thing that we
need to find this by default because I
know in the current simple thing this is
a child theme of macros so I need to
find this template with this template
for post meta bit I want to display the
counter for the post so I will copy this
and I will paste with inside my sample
store here and let me know I can
override it and when I open this post
meta you will be aligned yet this is the
line have added to get the post also
able to move it so I can show you from
the top so now again I will be low
suffering and despair ability gone so
what I mean I need to add a mutant here
and it's been shown like this
certificate in the exemplified which
this one table for the playing best
contest so as I don't have currently
comment on that yet so I will just put a
static info here and I reload the page
and you will see hit you and in the
front of you either I can put here
people the time being Angela p0 youth 0
so this will be increased as the
people's video host so do this first we
need to go over function dot PSD file
and at the end we need basically two
functions one is get postman's and the
other one is crash-course views so first
we see how can we get attacked before
the function text post views this is a
function which has supposed use and this
function we will be adding into the
thing about PHP files by using the
filter content so that in by I will add
their content as aspect respects testing
parameters and here first we need a fee
per pound
he is equal to post bond view so this is
a funky and then this is account the
variable which will get follows Annetta
the get post meta functions will get a
particular post we keep which you can
assign there so host ID will be get the
ID so it will automatically fetch the ID
for the current active post and giving
in to 13 cookies which we define is
salty and the cool and false means -
means it will assign the value to this
home variable hello initially if we
check came in to come is equal to entity
so it means there is no value inside
this home variable because in charge
they must not be anybody that will be
empathy if it's empty account will get
zero and then we hear news the leaf post
meta and then I will put here
medically that the ID will be added
first and then Matt activity sold and
then let it will be empty after that I
will do ad post meta and here I need to
put value pass the ID get the ID and
after that the meta even to the country
and you know as you know the Metis value
will be background failure and that it
will be default so with the help of this
multi path experiment account edit add
the post meta
so what else if people are viewing more
than one to oppose there will be
something in the console we need to
implement so in the else part we will
become the stuff so it will increase and
then we will be update force method
function and here again we kept the
ideal and of course meta is bouncing and
matter very will be found after
increment and if it doesn't we don't
need so this mention is has been
completed and add including return but
intense we don't need to be done there
anything except this variable control so
we implemented outside the course of so
this which had suppose because next
functioning will get the full view of
the track contention between the plate
account so we're here in the function
get those views and then we will get
particles item in this one same again
bound even became which we use to catch
the vehicle for physical and place it
here so this portion will be the same
from here so if each portion if the
so what we are telling is that counter
get ID and here we need to change it to
that
both I we are getting contacted both ID
best dispersing so delete and add the
post meta otherwise what it will do of
course it will come and it will turn the
house and here we will return 0 for 0
means there will be building and get
else or we don't need to put care if our
for securing to you know if we do in
return this so again we will just need
to put the depend count dot this will in
turn become so here we live in here and
account how many complicated we don't
need to conjure home functions that
person single with any other items will
be double but if there is the third if
we do this or even it can be like this
we will return to because we are setting
a complicated 0 so it will return 0 they
refer account this view the let's check
it gasps those views pop it in and first
we need to add this pension improve a
filter so the filter is air and the flow
filter the can tank
comma fast for you right this is the way
devices for one parameter access and one
is a priority for the one on one
exactly bottom of air below which we
need to put this one and that only when
we are doing the whole so we need to
cook they rejected it with single single
it will be simple
and then behind it if this is a
Singapore then do this procedure up to
them otherwise in Cleveland contact and
do nothing and don't you come adding new
machine will be a bit there but this one
will be only a disease Medicaid will
only be able to the course you can use
their custom both of a did anything you
want you can do it we want to do this
with a baby that we can remove this
check with a finger because if there is
a page then we will check here it is
that's it you need to copy this function
and then we need to the template and
here in this nation
I will be echo and step ib5 simply take
this and then reload if everything goes
well we will again see you with zero so
know that let's click on info and you
find that you it deal because we have
just build it not replace it so I again
Villota P and on the piece of you goes
coupons so every time angle will be
duplicate this counter then we increase
like this this use to and if you go to
home it work in VPS or it means if I
read about this it is not adding it
before because we are not on the
syndicate we are on the home page so
this is this video you have give abuse
because we have the turn here 0 it's
found is equal to 0 if there is empty
count so this is the exact area where
you can easily add a view conquer
integral WordPress site so I'm sure you
have like anything like this video and
if we do need better like button and if
we haven't subscribed to my channel
please click the subscribe button and
don't lick the balaclava because as soon
as I upload a new video
we'll get modified if you click on the
pilot if you haven't you won't get
multiplies with my latest video so this
is a video of us today I hope you liked
it thank you very much for watching this
video scalers in and take care and bye
