Thread Starter
Anonymous User 20238576
(@anonymized-20238576)
I just re-read my question and I think I didn’t describe it pretty well. So I will try to explain it more precisely this time.
What I am trying to do is to add custom elements (for example a simple heading) in the course page between the tutor LMS elements.
Example:
I would like to add a heading after course enrolment button.
GeneratePress (theme that I am using right now) offers a way to add custom elements anywhere on the page. For example, I can add a simple heading after add to cart on woocommerce single products page.
It doesn’t provide those location options for Tutor LMS, BUT it does provide an option for “Custom hook”.
So basically, what I am trying to know, is where can I find the custom hook location that I can input in GeneratePress for “custom hook” option.
More specifically, as stated above, I would like to add a simple heading after course enrolment button on a single course page.
In tutor lms documentation I found something like this: https://docs.themeum.com/tutor-lms/developers/hooks/templates/
…but I don’t know if this is what I am looking for.
Any advice would be much appreciated
Hello @tomanuel
The available hooks are there you can try those if any one those work for you.
Hello @tomanuel
Except this, we don’t have any other hook or any action. you can work with.
Thread Starter
Anonymous User 20238576
(@anonymized-20238576)
Hello @jobayertuser
So I was in touch with GeneratePress Theme support, and this is what they said:
To be honest i have never seen hook method with /
being used in this way before.
Can you check with Tutor on how they expect us to use it ?
So, he was referring to this hook tutor_course/single/enroll_box/after_thumbnail
So, can you please elaborate more on how can we use the hooks with /
?
Hello @tomanuel
In the documentation we have already given the example of this hook please check there you will get the example code also.
Thread Starter
Anonymous User 20238576
(@anonymized-20238576)
Hello,
so I tried adding the following PHP snippet:
add_action('tutor_course/single/enroll_box/after_thumbnail', function(){
echo 'if i see this text then the hook is working';
});
This resulted in displaying the text on every page before the header.
Please, I really want to make it work.
Would you be keen to read the support thread with GeneratePress? You can see the discussion there so you will have a better understanding in what we are going through. It is only a couple of messages.
Here is the link: https://generatepress.com/forums/topic/displaying-custom-blocks-inside-tutor-lms-pages-templates/#post-2265761
Thank you
Hello @tomanuel
I think This customization will not gonna work with this hook. Send me a screenshot of exactly where after the course enrollment button you want to add the heading. I will try to share the direct code if possible. The hook is not going to work.
Thread Starter
Anonymous User 20238576
(@anonymized-20238576)
Hello @jobayertuser
I would like to put an <h3> heading before enrolment box (as shown in the image below).
Image: https://ibb.co/0DfL01F
Direct code would be very helpful.
Hello @tomanuel
Add this code in your theme functions.php.
add_action('tutor_course/single/before/sidebar', function(){
echo '<h3>Write here!</h3>';
});