Create a Custom Template for your Sitewide Sale using Memberlite

In a previous article, we demonstrated the five default templates included in the Sitewide Sales Add On for Paid Memberships Pro. This post shows you how to insert a custom template name you can then target via your child theme’s style.css or a plugin for Memberlite Customizations.

The recipe leverages the pmpro_sws_landing_page_templates filter hook in the Sitewide Sales Add On for Paid Memberships Pro.

The Code Recipe

Adding the recipe to your website

Copy and paste this code recipe into a helper Memberlite Customizations plugin.

Styling your Custom Template.

Once you have inserted the new template name, you’ll need to edit or create a new Sitewide Sale and set the “Landing Page Template” and “Banner Template” (if desired) to your new value.

The selection will allow you to target the sale via the following CSS selectors (replace templatename with your template’s key name):

/* Added to the  tag */
body.pmpro-sitewide-sale-landing-page-templatename { }

/* Wraps the entire output of the [pmpro_sws] shortcode */
#pmpro_sitewide_sale_landing_page_template-templatename { } 

/* Wraps the entire display of the banner (if selected) */
.pmpro_sws_banner_template-templatename { }

We’ll be adding default templates over time, so if you have a favorite landing page design share a link to the page in the comments below.

Enhance the Theme My Login Widget for Members

Modified appearance of the Theme My Login WidgetIf you’re using Theme My Login for adding an enhanced member login process on your site, check out the tutorial below to modify the plugin’s included widget feature. This recipe includes code to enhance the widget’s title and customize the displayed list of user links to match your site’s Members menu.

Adding this helpful widget with quick links to important areas of the membership is the perfect way to improve the members experience on your site.

How it Works

This recipe includes three separate functions that each handle a unique piece of the customization process. The first function modify_tml_widget_title modifies the widget’s title. The recipe replaces the default title “Welcome” to include the user’s display name a link to their Membership Account page (if you are using Paid Memberships Pro) or the user profile.

The second function, hide_tml_widget_user_links, is used to remove all of the default links that Theme My Login adds to the widget. You can read more about this filter at the Theme My Login documentation site. Note that if you’d like to keep the default links, just remove that section of the recipe.

show_member_menu_tml_widget_user_panel is the third and final function in the recipe, which is used to insert the “Members” navigation menu into the widget. You can use similar logic to insert another named menu if you would like to add alternative links. We can help you with inserting a custom menu as part of a Memberlite Support membership—just open a topic on our forums.

The Code Recipe

Adding the recipe to your website

Copy and paste this code recipe into a helper Memberlite Customizations plugin.


Default appearance of the Theme My Login Widget
Modified appearance of the Theme My Login Widget

Create a Plugin for Customizations to Your Memberlite Site

Many of our articles and code recipes include instructions on how to “customize and add this code to a plugin for customizations”. In addition, our support team may provide you with customizations to add to your site via this method.

This tutorial explains how to create and edit a custom plugin for all of your tweaks to the theme.

But can’t I just edit my theme?

We strongly recommend using the customization plugin method for a variety of reasons. To be clear, the file functions.php within Memberlite or your child theme (if applicable) performs like a plugin in that it can execute php code. While adding code to your active theme’s functions.php file is often quicker than building a plugin, the downside is that as we update Memberlite, you’ll lose the custom functionality that was added. Code in a plugin will persist.

In addition, the use of a customizations plugin helps your developers and our support team know exactly WHERE the custom code is located as it relates to your Memberlite setup.

First, figure out how to FTP into your Website

Your web host should have provided you with FTP or SFTP credentials. To properly log in to your web server you will need the:

  • FTP (or SFTP) address
  • Username
  • Password
  • (possibly) a port number and root directory

If you don’t know how to use FTP, this guide on the WordPress Codex provides some background on FTP and options for FTP clients, you can also refer to your web host’s FAQs and guides.

Creating Your Customizations Plugin

  1. Create a folder called memberlite-customizations in the wp-content/plugins folder of your site.
  2. Create a file called memberlite-customizations.php in the folder you just created.
  3. Edit the memberlite-customizations.php file and paste this block of code into the file:

  4. Save the file.
  5. Upload the plugin via FTP to your website.
  6. Activate the plugin via the Plugins page of your WordPress Admin.

Editing Your Customizations Plugin

  1. Connect to your web server via FTP.
  2. Navigate to the /wp-content/plugins/memberlite-customizations/ folder.
  3. Download the latest copy of the memberlite-customizations.php file.
  4. Open the file in your preferred editor.
  5. Add the code for the recipe or code shared via your support forum thread at the bottom of memberlite-customizations.php.
  6. Save the File and upload the folder and file to your website via FTP.

This Makes Me Nervous.

We understand that you may not be completely comfortable working “in the code”. Our support team can put minor code tweaks in place for you if you share FTP information in a private thread.

If you are updating the customizations on your own and an update to the customizations plugin completely breaks your site, don’t fret.

These steps should repair your site:

  1. Connect to your website via FTP and navigate to the wp-content/plugins folder.
  2. Rename the folder memberlite-customizations to anything else (I generally rename it to memberlite-customizations-off.
  3. Now, visit your site. WordPress will automatically deactivate the plugin and, in doing do, your site should be restored.
  4. You can then repair any broken code in the file and rename the folder to the original memberlite-customizations.
  5. Upload the updated file and reactivate the plugin via the ‘Plugins’ dashboard page.