Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimcoleman/dcc93d392a98f328f66edb34c1c4b80a to your computer and use it in GitHub Desktop.
Save kimcoleman/dcc93d392a98f328f66edb34c1c4b80a to your computer and use it in GitHub Desktop.
Legacy code to enqueue a theme or child theme's version of frontend.css for PMPro v3.1+.
<?php
/**
* Enqueue your theme or child theme's version of the legacy frontend.css file.
* Note: PMPro v3.1+ css selectors have been overhauled and many of the legacy class names are no longer supported.
*/
function my_pmpro_enqueue_theme_frontend_css() {
if ( is_admin() ) {
return;
}
// Figure out which frontend.css file to load.
if( file_exists( get_stylesheet_directory() . "/paid-memberships-pro/css/frontend.css" ) ) {
$frontend_css = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/frontend.css";
} elseif( file_exists( get_template_directory() . "/paid-memberships-pro/frontend.css" ) ) {
$frontend_css = get_template_directory_uri() . "/paid-memberships-pro/frontend.css";
}
if ( empty( $frontend_css ) ) {
return;
}
wp_enqueue_style( 'my_pmpro_custom_frontend', $frontend_css, array(), '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_pmpro_enqueue_theme_frontend_css', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment