I have made an illustrative diagram and let
us say that wordpress is 
using a particular code and it is not using
any of the code that you have.
Word press has added developers with an option
to add their own code.
So in the process of the normal flow for example,
first rendering the head and the contents
and then the footer.
It provides certain kind of interventions
or locations at various points in the wordpress
execution where you can add your own code.
So if you write your own code in a space and
hook it to your wordpress blog then what happens
is that instead of going to the normal route,
wordpress will take its route.
It will go through your code and it will resume
back to the normal flow and then while going
through the code it will then go through the
hook that it will go through that location
and resume from there.
You can hook your code in different locations.
So basically there are two things you can
do;
1.
Add your own code, for example your own Html
code, to add the image or something like that.
2.
To modify a piece of the content, for example
the title of the blog post or the content
of the blog post or any other thing that wordpress
provides hook for.
So there are two kinds of things that you
can do or use;
1.
You can use something called filter
2.
You can use Action
Let me tell you the concept of the Filter,
for example let us say your blog post title
is my blog post title, and your website address
is my website.
And instead of just creating the content you
want to add four branding reasons – My Website
at the end.
So in that case the word press comes into
your code with this information and you modify
this whole thing by adding my website at the
end and so the new Title that comes is My
Blog Post Title – My website.
The filter modifies the content or the value
that has been added, while action just adds
an Html.
For example you see an action in Header and
you want to add Meta tag, all you need to
do is to add an Html code and that thing will
be out put in the particular location where
the filter is called.
So these are two important ideas of filter
and action.
So most common filters and actions are wp_head()
which you can add your output information.
The content information which is another important
part of filter, well you can modify the content
of the blog post and you have something which
is called Wp-Title as well and later on when
reaching the end of the content, you can have
wp-footer as another filter.
So some of them are the actions and some filters.
All you need to do is to find out the filter
name and filter reference name, and it is
provided in the link.
You can go to the glossary where you can understand
more about the actions.
And you can learn more about filters and all
the references to the action and how they
work and the actions that you can utilize
and if you click on blogging reference and
filter reference you will be taken to all
the filters and you can modify the values
provided.
Let us take an example of word press filters,
for example this is a blog with a number of
blog posts.
If you check at the top you will see that
there is a title that pops out, which is just
another word press title and what I am going
to add is just another string to the
Title and check if this thing really words.
To see the title in its completeness, you
just have to right click and then go to webpage
source and then you will search for the titles
and the slash have the title in between and
then we are going to add string to the title.
Now open the project in our locate file folder
which is the hosted site and the structure
will remain the same and the theme located
inside the wp-content, folder contains the
2014 content which is the current theme you
see in the blog post.
And I am going to modify functions.php file
of the theme and so function.php will be in
almost all the themes.
It is a requirement and so you can write you
custom code here.
So what I am going to do is I am going to
change the title of the whole blog post just
by adding some string
to that.
I will use function called the as add filter
and the filter that is used to change the
title of the blog post is wp_Title and I will
give it some kind of function here, for example
my function and I will close it and then the
contents of my function, I will define that
and create a body.
The thing about filters is that they have
a parameter and for example the wp filter
will pass the parameter which will be the
Title of the blog or the Blog post.
So it will be an argument to this function
and so what I am going to do is create a string
and give it some value like, My Blog, then
I am going to return this value with the title
and it is represented by Dollar
 
under wp_Title and this function will take
the parameter called my dollar title and I
will just add some kind of string and I will
put a dash so that makes more clear.
Then I go to my blog post and hit a file to
show weather this is happening or not, so
I will go to the source code and then refresh
it.
So as you will see the Title changed and it
shall become my blog.
My function has also added some kind of information
to it.
This title is very important especially when
you what to access key words in Google search.
Example type TV, so you can see that the title
is displayed by search engine which is Google
or Bing and it is taken from the tag and for
example you can have Tv.com in front instead
of the back.
So you can also have it by that by reversing
it and removing the dollar string from there,
save it and refresh the source code again.
So as you can see my blog has been pre-pended to this Title, rather than going at the end.
It depends on your advertising or marketing
strategy, so if you want to show your name
of website or key word, so you can have it
like that.
So this explains the part of video when filters
are used to modify certain kind of details.
So you have this list which you can use, you
can just go through the list and see the different
types of filters which you can use and this
is just a starting point and not the end of
it.
You would have to go through each blog to
understand what each of it does for you.
Now I am going to talk about actions and so
as you can see from the screen, they are many
actions and they are some used very frequently
and one is wp_footer, what it does is to add
some kind of code to the footer section of
the blog post.
So for example if you have a blog post and
you wish to add something such as Copy right
or something like that.
Now adding of action is much simpler than
the filter, what you need is to do is to add
_action, take the action name which is wp_footer
and give a function for example, My_action
in two double codes.
Action may or may not involve any kind of
parameters, but mostly you can leave it blank
and what you are going to do is to add some
kind of Html which is closing the page with
tags and I will write p, powered by my blog.
When it is run the code will be added to the
footer section of the blog and then you refresh.
As you can see the Wp_footer or the action
is stored and it can be modified and more
functions added.
It was powered by my blog and there was nothing
needed to modify or change and hence we were
able to add the Html.
So I guess the difference between the filters
and the action is clear now and so I hope
you enjoyed watching my video, if you like
my video or have any comments feel free to
drop them below.
Thanks and good bye
