Last updated September 8th, 2023 at 12:07 pm
Introduction
Since MemberPress version 1.1.7, developers can override MemberPress template files (as well as the template files for MemberPress addons). The method for overriding template files described in this article requires a child theme.
Note: MemberPress’ official documentation does include an article on this topic. As helpful as that article is (it includes many more examples than I do here as well as a video screencast), I got tripped up when I followed that article’s instructions when trying to override the “Course Header” file for the MemberPress Courses addon. I had assumed — because the article on MemberPress’ site does not seem clear on this issue — that I needed to create a memberpress-courses
subdirectory in my child theme. Not so, as you will see here. At any rate, here’s my attempt to simplify the process.
Step-By-Step Procedure for How To Override MemberPress Template Files
1. Find the template file you wish to override.
It will be in the subdirectory whose path follows this pattern:
/wp-content/plugins/{DIRECTORY_NAME}/app/views/{VIEWS_SUBDIRECTORY}/{TEMPLATE_FILE}
(It will always be found under /app/views/
.
Make note of the actual names for {VIEWS_SUBDIRECTORY} and {TEMPLATE_FILE}.
2. Create subdirectory under child theme
Create a subdirectory under your child theme and name it “memberpress”.
Note that memberpress
should be the name of this subdirectory even if the template you will be overriding is part of a MemberPress addon such as Membership Courses or Membeship Downloads.
3. Create another subdirectory
Create a subdirectory under this new “memberpess” subdirectory and name it whatever is the ACTUAL subdirectory name where the {VIEWS_SUBDIRECTORY} placeholder item appears (see above).
4. Copy MEPR template file to child theme subdirectory
Now copy the template file ({TEMPLATE_FILE}) you identified in Step One to the child-theme subdirectory you created in Step 3.
5. Edit Template File
Edit the template file. (If you edited the template file locally — always recommended — now upload it via FTP.)
Examples
For these examples, the path part /wp-content/plugins/
is omitted for simplicity.
Override the Account Home Page Template:
Find the file here:
/memberpress/app/views/account/home.php
Put the file here:
/your-child-theme/memberpress/account/home.php
Override the Course Header Template for Membership Courses:
Find the file here:
/memberpress-courses/app/views/courses/course_header.php
Put the file here:
/your-child-theme/memberpress/courses/course_header.php
Override the Login page Template:
Find the file here:
/memberpress/app/views/login/form.php
Put the file here:
/your-child-theme/memberpress/login/form.php
Closing
If this article helps you, please let me know. If you’d like more articles about MemberPress and/or MemberPress Courses, let me know that, too.
This is amazing this helped me fix my problem with the email reset password template file. The problem was from another 3-rd party plugin that was using the template file to scan the url for traffic but after I changed it a bit it works.