• Resolved sgumby

    (@sgumby)


    Is there a reason you don’t have 1 consistent body class for all of your pages. WooCommercere has “woocommerce” in the body for pretty much all of their pages. You could have “pmpro”. A quick scan of your hooks-filters makes it look like you don’t have anything for this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter sgumby

    (@sgumby)

    Here is a quick solution if anyone else has this problem. Its not fully tested so I’ll update here again if I find more tweaks. Add to functions.php.

    function custom_add_body_class($classes) {
    
      foreach($classes as $index => $string) {
        if (strpos($string, "pmpro-body-has-access") !== FALSE){
        }
        else if (strpos($string, "pmpro") !== FALSE){
          $classes[] = 'pmpro_page';
          break;
        }
      }
    
      return $classes;
    }
    add_filter('body_class', 'custom_add_body_class');
    Plugin Support Mary Job

    (@mariaojob)

    Hi @sgumby,

    I am unsure what you refer to by one consistent body class, but perhaps this guide for the PMPro CSS Customization File would be useful for you to get started with: https://www.paidmembershipspro.com/customizing-the-paid-memberships-pro-stylesheet/

    Kind regards.

    Thread Starter sgumby

    (@sgumby)

    All of your pages need to have the same class in the body tag. That way if I want something special to happen in the header or footer of those pages I can do it with .pmpro_page footer. Instead I think all of your pages have a different class so I have to do .pmpro_account_page footer, .pmpro_payment_page footer. That means its possible I’ve missed a page.

    In my instance I had some global css settings that I needed on every page so that your plugin’s pages would match the rest of the site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ONE body class for ALL pages’ is closed to new replies.