• Resolved jules22

    (@jules22)


    Hi I would like to create my own look/layout for the Offline Single Course Page. What is the best way to do it ? I am a developer and familiar with PHP/Queries, etc.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support brianvu-tp

    (@briantp)

    Hi jules22,

    Thank you for reaching out!

    You can easily customize the layout of the Offline Single Course Page by modifying the layout in your child theme. You can do this by utilizing the hooks available in the SingleCourseOfflineTemplate.php file located at:

    wp-content/plugins/learnpress/inc/TemplateHooks/Course/SingleCourseOfflineTemplate.php

    This will allow you to make the necessary changes to the page layout according to your needs.

    If you need further assistance, feel free to reach out!

    Best regards,
    Brianvu-tp

    Thread Starter jules22

    (@jules22)

    Thanks for the quick reply. Is it possible to create single-{post-type}.php , for example in the theme folder create the file single-lp_course.php and create a custom query in the file ?

    Thread Starter jules22

    (@jules22)

    Sorry another question, I was testing a filter as follows:

    function filter_buttons($htmlarray){
    var_dump($htmlarray);
    }

    add_filter( ‘learn-press/single-course/offline/section-right/info-meta/buttons’, ‘filter_buttons’);

    It did echo me the array contents but also the following error:

    Fatal error: Uncaught TypeError: LearnPress\Helpers\Template::combine_components(): Argument #1 ($elms) must be of type array, null given, called in /home/artisalwaysmagic/public_html/wp-content/plugins/learnpress/inc/TemplateHooks/Course/SingleCourseOfflineTemplate.php on line 223 and defined in /home/artisalwaysmagic/public_html/wp-content/plugins/learnpress/inc/Helpers/Template.php:262 Stack trace: #0 /home/artisalwaysmagic/public_html/wp-content/plugins/learnpress/inc/TemplateHooks/Course/SingleCourseOfflineTemplate.php(223):

    Plugin Support brianvu-tp

    (@briantp)

    Hi jules22,

    Thank you for your follow-up!

    1. It is not recommended to override the single-lp_course.php file directly because this can easily cause conflicts with future updates of LearnPress. The best approach is to modify the layout via hooks, which will provide a more stable and flexible solution.
    2. Regarding the error in your filter testing, the issue occurs because your function is expecting an array, but it may be returning null. Also, you need to make sure that your filter function returns the modified value.

    Here’s an example of how to properly use the filter:

    function filter_buttons($htmlarray){
    // Ensure $htmlarray is an array and modify it as needed
    if (is_array($htmlarray)) {
    var_dump($htmlarray);
    }

    // Always return the modified array
    return $htmlarray;
    }

    add_filter('learn-press/single-course/offline/section-right/info-meta/buttons', 'filter_buttons');

    For more detailed information about how to use filters, you can refer to this helpful guide.

    Let me know if you need further assistance!

    Best regards,
    Brianvu-tp

    Thread Starter jules22

    (@jules22)

    Great thanks!

    Plugin Support brianvu-tp

    (@briantp)

    Hi jules22,

    We are glad to hear that you found the solution useful!

    If you are satisfied with LearnPress, we would greatly appreciate it if you could leave us a 5-star review. A nice rating is a big motivation for us to keep up the hard work, and it’s really important to us.

    Thank you very much for your feedback.

    Best regards,
    Brianvu-tp

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.