WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Add a class to body of blocked pages (4 posts)

  1. PoseLab
    Member
    Posted 1 year ago #

    How could I add a class to the body of blocked pages? If I am logged in, the plugin adds the class logged-in to the body tag. I would like to add the class "blocked" to the body of blocked pages. Is this possible?

    Thanks for your fantastic work

    http://wordpress.org/extend/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    Hmmm... I don't think the plugin adds a logged-in class to the body. Maybe your theme is doing that with is_user_logged_in?

    That would be the way to do it though if you are adding a body class. In the appropriate template in your theme add a condition for if is_usr_logged_in() is true, then add your class (it may already be there for the logged in state).

  3. PoseLab
    Member
    Posted 1 year ago #

    Hi Chad

    Yes, My theme is adding to the body the class logged-in with the body_class function. Can I add a class to an element of blocked pages?

  4. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    I would probably look at "Add Classes by Filters," the use the filter function to make a determination if the page is blocked. If pages are not blocked by default, then blocked pages would have a post meta of "block".

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic