In your functions.php:
function my_body_class($classes) {
if(is_page()){
global $page;
$title = get_the_title( $page );
$classes[] = $title;
}
return $classes;
}
add_filter('body_class', 'my_body_class');
That will add the page title as a class to each page.
Related Posts:
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- trouble with page_id & highlighting current page
- Why isn’t my link attribute getting my css?
- hello can you advise how to fix the error?
- How to add a php custom page to WordPress
- Selectbox in admin panel function linking to CSS
- Sort query_posts for Parent Pages to menue order or the count?
- How to hide all child pages with post_query?
- Can I install/embed WordPress on a ‘single page’?
- Using if/else statements with output from theme options
- Is there CSS to expand the gallery limit on Index Pages?
- How to design a table based on css values set from admin/dashboard
- My page.php shows the index.php
- Incorrect MIME type for assets with Valet
- How to display pictures from database?
- How to add condition in wordpress loop? [closed]
- Populate editor with some content of a page with a page template
- Customize position of social icons in upme plugin [closed]
- Best way to schedule daily change in CSS parameter
- Css loads very slow [closed]
- Gravity form built in Captcha
- How can I add an area/option for a custom page description?
- Create Page To Count Comments For Each Post In WordPress Site
- How does wp_enqueue_scripts work?
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- two columns of posts on homepage, one of them “favorites”
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- custom css for admin only
- responsive.css in the WordPress should be prioritized
- How do I add a custom css to all posts without affecting homepage css? [closed]
- get_the_title() gets printed out twice
- How do I find PHP file that contains content of my page?
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- proper way to add css using functions.php?
- WordPress style.css not updating, only after theme reload
- Adding logo to WordPress header
- WordPress page content outside WordPress
- Thumbnails appear to be zoomed
- Using the_excerpt() on a page
- Use PHP in stylesheet to specify a background image based on Category ID
- Inject class in body when particular page template is used
- Automatically set all tags to have a height of 0 if there is no content inside the tag [closed]
- height should be set to auto to avoid pixelation in the post thumbnail function
- Odd / Even posts add class minus first post
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Change CSS based on is_user_logged_in
- RTL Stylesheet Confusion with WordPress
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Correct way to enqueue page specific CSS file
- Wrapping a Sidebar within
- How to check if the current page is at a specified path in the URL?
- Add Codepen animation as Preloader to WordPress
- WordPress wp_add_inline_style unable to give hex colors?
- Reduce size of responsive title
- How to make container class in PHP
- How to create table in wordpress without plugin? [closed]
- Show About and Contact Us page when they’re clicked in the top menu.
- WordPress archive page showing 404 Error [duplicate]
- Parsing Menu Items and Blog Posts
- How to use theme function in post/page?
- My php code is not being executed
- PHP in CSS file?
- Clickable image link sends people to wrong URL
- Styling the second sidebar
- Add class to DIV depending on page loaded
- Liking a facebook page from wordpress website?
- Apply class to every third list item? [duplicate]
- How to include custom code on a page that’s set to act as homepage?
- Can a page contain php code?
- Last class on last headline?
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- Creating a mobile site by adding a new class to the body tag from functions.php
- wordpress admin plugin menu custom css
- What’s the best way to include PHP code in pages?
- How to add drag and drop functionalities to a div inside option panel
- Removing WordPress Footer -without access to PHP code?
- Automatically add images to a menu
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- How to remove sidebar primary widget on Mobile on category page [closed]
- How to Change CSS Colors from Custom Plugin Settings Page
- page-slug.php not working but only for specific slug
- Need php code’s output to display underneath a Divi Module
- Insert page content into another page with a changed variable
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- Where can I find the inline-css of my theme header?
- CSS change in woo commerce Place Order Text [closed]
- How to echo every parent page title?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Post repeated when opening in overlay, how do I solve this? [closed]
- Menu Custom Data Attributes
- Retrieve Json data and create multiple pages with it
- Highlight the links without using dropdown
- How to add page numbering with php?
- Display child page content of a specific parent on home page