Yes, there’s the body_class filter. You could use e.g.
function body_class_guest_user( $classes, $class ) {
if ( ! is_user_logged_in() ) {
$classes[] = 'guest-user';
}
return $classes;
}
add_filter( 'body_class', 'body_class_guest_user', 10, 2 );
However you could equally well just use the :not() selector, e.g. body:not(.logged-in)
(browser support),
or absence of logged-in i.e. set up the guest-user styling as default but then override it if .logged-in
.
Related Posts:
- Add multiple custom fields to the general settings page
- When should you, and when should you not, use wp_list_pluck()?
- Is it possible to remove the “standard” post format?
- Woocommerce add to simple product attribute programmatically [closed]
- Issue with get_theme_mod returning a blank value instead of the saved value
- How to remove row-actions from pages table?
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Modify search function in WordPress (TwentyTwelve)
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- How to fix a theme with page.php Default Template that accidentally deleted?
- Set default options for inserting media
- Default or Preset Content for Custom Post Types
- Remove tag on my RSS Feed
- How do I change parameters without changing the core
- Problem with extract() with custom shortcode
- add sidebar area to header of child theme
- Theme-Config tab in admin Pannel?
- Creating loop within functions.php
- How to Add a Random Custom Gravatar in the WordPress Comments?
- Delete pages and Create default pages for all new network sites
- Actions according to image type and size
- Post thumbnail relative link and HTML modify
- adding custom classes for tables
- Pass Shortcode Attribute to footer Script
- How to mass-delete inline styles in WordPress custom post type automatically?
- How would go about if I just want a temporary function?
- Remove the deleted users avatar from list
- PHP files included in functions.php don’t seem to work
- How Can I Expand the WordPress Customize window without any Plugin?
- Set quantity of woocommerce product on page visit [closed]
- wp_dropdown_categories and custom attribute
- str_replace function in theme
- Automatically wrap multiple images in div
- Ajax not working properly
- Right way to update widget on dynamic new input field
- Include default functions and methods
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- How can I modify all existing tags while keeping the urls themselves?
- Best practices regarding the creation of custom widgets?
- Unable to login using username
- Word Press – Dynamic Content [closed]
- Insert image in WordPress with HTML5 tag and caption function
- how can I just add to parent theme function(s) instead of redeclaring whole the function
- different style sheet for just one page template
- Condition OR for current user ID
- Where do I store custom functions that call custom page template files?
- Custom HTML markup
- Use a shortcode to display custom meta box contents
- Wp-query Order By problem
- login_headertitle is deprecated since version 5.2.0
- Add attribute only to first image of every post via functions.php
- Different favicon on different pages
- The_content and Preg_replace in loaded Iframe [closed]
- two search forms on the same page
- Function to replace comment’s accented characters before posting
- Insert a field with PREG_REPLACE – strange behaviour
- How to echo Widget Title in Custom Frontend-Template Box
- New checkbox in custom widget isn’t saving data
- Linking Javascript in functions.php file
- how to display a page before the home page
- loginout function customization
- Function to check if custom page is used by page?
- implementing a centralized content “show-do-not-show” toggle?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- How to remove font awesome from loading in wp theme
- How to replace ACTION url from original wordpress login form?
- Header menu aligned right on all pages except for single-post page [closed]
- Hide author info in single posts by certain users
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- Shortcode to insert default text and change one word throughout it?
- I want to customize the_posts_navigation function by replacing prev and next with images
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- How would I correctly implement a new if statement in a child functions file?
- WordPress Ajaxifying not working properly
- WordPress function with attribute pass to template
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- True email confirmation for registration (keeping unvalidated users from user table)
- Adding A New Widget to WordPress Disables the Existing Widgets
- How To Show Shortcodes In WordPress Custom Fields?
- Help! Need a different logo on my main page from my other pages
- Display page number on custom page title function
- How to replace words in my posts and saved new words
- How do I integrate my Child Theme into a Custom Template?
- Shortcode to eliminate and replace with
- Add functionality to post editor
- custom post with loading script per single post
- Get Value of Custom Field
- restrict access to specific urls on a specific period of time
- child_of not working while searching
- Why does modifying my functions.php file always result in a server error
- Remove snippets of JS from core
- Removing Facebook contact field from user contact not working
- How do I add functionality to images?
- Explode Array from Repeatable Custom Field
- WordPress Custom wp mail template return full template
- Problem with removing characters “<” – WpAllImport
- How to create a post without link in wordpress?
- post_row_actions filter from parent theme not executing in child theme