We found that customizing the Tevolution or Theme working with it is becoming difficult for you guys. Thus here is a short tutorial which can make it bit easier for you. It can help you find the actual code location in the files.
There are many hooks defined in the Tevolution using which you can customize the code or add your code easily without touching initial code.
USE OF HOOK IN WORDPRESS: It allows you to call functions in the plugin on it’s specific location or event execution. You can also call more than one function at a location.
HOW TO USE HOOKS:
In Tevolution plugin, to use hooks we need to understand two methods:
- Do_action():
Hooks are defined in the plugin using do_action() method like this:
Do_action(‘hook_name’);
When this function is called all the add_action()s related with this hook name is called and thus the functions are also called.
- Add_action():
do_action is linked to an another function called add_action() to run our function code.
Add_action can be used by you in the related file while do_action()s are defined by the Templatic developers.
We can use it this way:
Add_action(‘hook_name’,’function_name’,Priority,Accepted_Args);
Here,
Function_name is the name of the function to be called on do_action(‘hook_name’) call.
Priority is an option value if you are having multiple add_action then you can give it’s value. It is a digital value starting from 10. Priority with 10 will be executed first then at 11 and so on.
Accepted_Args is a numerical value which represents the number of arguments the function_name() is accepting. It is also an optional argument.
EXAMPLE:
- Suppose, you are using Nightlife theme. Now, you want to add anything before breadcrumbs on single pages, then first you will need to do add_action like this:
- [CODE]add_action(‘templ_before_single_container_breadcrumb’,’my_code’);[/CODE]
- You can add this code in any file. Just make sure that the file is executed on the related pages. Here, single pages. For this example, you can add the code in Nightlife’s Custom_functions.php file.
- Now, in above line of code, my_code is a function. So you will also need to define a function with that name. So overall, my code will look like this:
- [CODE]add_action(‘templ_before_single_container_breadcrumb’,’my_code’);
function my_logo()
{
echo “Here is my code.”;
}[/CODE] - If you want to remove something from the theme. For example, to remove breadcrumbs, we have used this function – single_post_type_breadcrumb(). So you will need to remoce action for the same like this:
- [CODE]remove_action(‘templ_before_single_container_breadcrumb’,’single_post_type_breadcrumb’);[/CODE]
First make changes in the child theme(Ex.: Nightlife). If the changes are not affecting there then only touch “Supreme”.
TEVOLUTION HOOK’S LIST:
Here is different hook’s list provided by Tevolution:
Hook Name | Location and Use |
templ_before_single_container_breadcrumb | It makes effects on the single post/custom post/category listing/tag listing pages. The code gets executed after breadcrumbs and before container. |
templ_inside_single_container_breadcrumb | It makes effects on the single post/custom post/category listing/tag listing pages. The code gets executed after container starts. |
templ_before_categories_title | It makes effects on the single post/custom post/category listing/tag listing pages. The code gets executed before page title(post name or category title) |
templ_after_categories_title | It effects on the category and tag listing pages. The code gets executed after the category heading. If category slider exist then after the category slider. |
tmpl_category_page_image | It effects on the category and tag listing pages. The code gets executed for the thumb images of posts. The do action is actually used to display the category post image. If you want to change default Tevolution category post image then remove ‘tmpl_category_page_image’ action usind code: remove_action(‘tmpl_category_page_image’, ‘tmpl_category_page_image’); and create your new action for display category post image using add_action(). |
templ_before_post_title | It effects on the category and tag listing pages and single post page. The code gets executed before the title of posts. It is used to display extra content before post title. |
templ_after_post_title | It effects on the category and tag listing pages and single post page. The code gets executed after the title of posts. It is used to display extra content after post title. |
templ_post_info | It is used to display post information like display post publish date, author name, number of comments,etc…Note:*can’t be used with Nightlife. |
templ_before_post_content | It is used display the extra content before the post gallery. |
templ_after_post_content | It is used display the extra content after the post content/description. |
templ_listing_custom_field | It is used to display the post type custom field listing on the listing page/category pages. If you want to display extra custom field or any other field then first remove ‘templ_listing_custom_field’ action and add your custom action to display additional custom field. |
templ_send_friend_inquiry_email | It is used whenever we want to execute some code on sending an inquiry mail. |
tmpl_detail_page_image_gallery | It is used to display images in a single/detail post pages. |
tmpl_detail_page_custom_fields_collection | This hook is used to display custom fields section in the detail pages. To execute any code after the custom field section, you can use this hook. |
tmpl_before_comments | Add action to display anything before the post comments on the detail pages/single post pages. |
tmpl_single_post_pagination | This hook is used to display previous & Next paginations on the detail pages. You can use it to display anything before/after these buttons. |
tmpl_after_comments | Used to display anything after comments on the single pages. |
tmpl_related_post | This is used to display related posts on the single page. |
templ_inside_preview_container_breadcrumb | This do action is executed inside the container after breadcrumbs on the preview page. |
templ_preview_before_post_title | This do action is executed before the post title on the preview page. |
templ_preview_after_post_title | This do action is executed after the post title on the preview page. |
tmpl_preview_page_gallery | This do action is executed to display images of the post on the preview page. |
templ_preview_before_post_content | This do action is executed before preview post content. |
tmpl_preview_page_fields_collection | This do_action is used to fetch the fields for the preview page. |
templ_preview_after_post_content | This hook is used to display anything after the post content on preview page. |
templ_preview_address_map | This action is used to display map on the preview page. |