You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comfort Job provides a variety of hooks and filters that allow developers to customize and extend the plugin's functionality. These hooks and filters can be used to modify the behavior of the plugin, add new features, or integrate with other plugins or themes.
14
14
15
-
**Last modified:** December 9, 2024
15
+
## Hooks
16
+
17
+
Hooks in Comfort Job are points in the code where developers can add custom functions or code to modify the plugin's behavior. There are two types of hooks in WordPress: action hooks and filter hooks.
Action hooks allow developers to execute custom functions at specific points in the plugin's code. These functions can perform actions such as displaying content, updating data, or sending notifications. Action hooks in Comfort Job are typically triggered by events such as saving a job listing or deleting a company.
27
+
28
+
Here are some common action hooks in Comfort Job:
29
+
30
+
-`comfortjob_before_job_listing`: Triggered before a job listing is displayed on the frontend.
31
+
-`comfortjob_after_job_listing`: Triggered after a job listing is displayed on the frontend.
32
+
-`comfortjob_job_saved`: Triggered after a job listing is saved in the database.
33
+
34
+
Developers can create custom functions and hook them into these action hooks to add new functionality to Comfort Job.
35
+
36
+
### Filter Hooks
37
+
38
+
Filter hooks allow developers to modify or filter data before it is displayed or processed by the plugin. Filters in Comfort Job are used to customize the output of job listings, companies, or other data displayed by the plugin. Developers can use filter hooks to change text, alter URLs, or modify data structures.
39
+
40
+
Here are some common filter hooks in Comfort Job:
41
+
42
+
-`comfortjob_job_title`: Filters the title of a job listing.
43
+
-`comfortjob_company_name`: Filters the name of a company.
44
+
-`comfortjob_job_location`: Filters the location of a job listing.
45
+
46
+
Developers can create custom filter functions and hook them into these filter hooks to customize the output of Comfort Job.
47
+
48
+
## Using Hooks and Filters
49
+
50
+
To use hooks and filters in Comfort Job, developers can create custom functions in their theme's `functions.php` file or in a custom plugin. These functions should be defined with the `add_action()` or `add_filter()` functions, specifying the hook name and the custom function to be executed.
51
+
52
+
For example, to add a custom function to the `comfortjob_after_job_listing` action hook, developers can use the following code:
53
+
54
+
```php
55
+
function my_custom_function() {
56
+
// Custom code to be executed after a job listing is displayed
0 commit comments