Have you been struggling to customize your LearnPress course layouts? You’re not alone! Many users find that following the standard instructions for overriding LearnPress templates doesn’t seem to work. You may have even resorted to editing the core plugin files (which is a big no-no!).
Here’s the good news: we’ve got a simple fix that’ll get your customizations working seamlessly and override LearnPress templates correctly:
The Problem
LearnPress templates are found in the /templates
folder within the plugin directory. These files control the look of your course archives, single course pages, quizzes, and more. While these templates contain hooks for adding content, sometimes you need deeper customization that goes beyond just adding hooks.
The typical advice is to copy the entire /templates
folder into your theme’s directory and rename it to learnpress
. However, this often doesn’t trigger the override you’re expecting.
The Solution: A Filter to the Rescue
The key is to explicitly tell LearnPress that you want to override LearnPress templates. We can do this with a simple filter added to your theme’s functions.php
file:
add_filter( 'learn-press/override-templates', function(){ return true; } );
How It Works:
- The Filter: This code snippet uses the
learn-press/override-templates
filter. This filter is specifically designed to control whether LearnPress should use its default templates or look for overrides in your theme. - Return True: By returning
true
from the filter function, you’re signaling to LearnPress that you do have overriding templates in your theme’slearnpress
folder.
Step-by-Step Guide To Overriding LearnPress Templates
Here is a step-by-step to Overriding LearnPress Templates:
-
Locate Your Theme’s functions.php File: In your WordPress dashboard, go to
Appearance -> Theme Editor
. Find and open your theme’sfunctions.php
file. -
Add the Filter: Paste the code snippet provided above at the end of your
functions.php
file. -
Save Changes: Click “Update File” to save your changes.
-
Verify Your Overrides: Now, any template files you’ve placed in your theme’s
learnpress
folder should be used instead of the LearnPress defaults.
Important Note: Always create a child theme before customizing template files. This ensures your changes aren’t lost if you update your main theme. Check our post to know more about How to Create a WordPress Child Theme.
Need More Help? At ThimPress, we’re dedicated to making WordPress education accessible and beautiful. If you need assistance with LearnPress customization or any other WordPress issue, don’t hesitate to reach out to our support team.
Happy customizing!
Learn More from ThimPress Knowledge Base Articles:
- LearnPress: List of Some Issues and Best Ways to Fix Them
- Schedule Your Auto Posting Pipes with Cron Job
- WP Pipes System Requirements
- How to Use Custom CSS in Your Online Course
- Create a Child Theme in Resca: A Step-by-Step Guide
- One-Click Resca Theme Installation Guide (Video)
- Step-by-Step Video Tutorial: Installing Resca Theme
- Quick Fix: LearnPress 404 Error After Update
- Customize LearnPress Profile Page with Ease
- Fix “Sending credit card numbers directly to the Stripe API is generally unsafe.”
Contact US | ThimPress:
Website: https://thimpress.com/
Fanpage: https://www.facebook.com/ThimPress
YouTube: https://www.youtube.com/c/ThimPressDesign
Twitter (X): https://twitter.com/thimpress