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?
- Disable Attachment Pages Completely
- How to Remove all Instances of edit_post_link
- Create WordPress pages with PHP
- Is it possible to generate a page without create in the admin?
- class=”parent” for wp_list_pages?
- “wp_enqueue_style();” don’t load new edited style
- PHP Script within wordpress theme
- functions.php not adding css to website?
- if file_exists not working with wp_enqueue_style
- Print number of post (in reverse)
- Using PHP to toggle stylesheet and header image, set in cookie
- Archive dropdown styling not applied
- Different background-image by category
- Limit get_pages to only show 5 items
- How do I publish only one page to production after making changes on staging?
- Put CSS inside a PHP file and include it the right way
- Custom category code not showing all posts
- Missing sidebar parameter “fix” – before_content
- How Display Posts on category
- Insert a button on a page with random number generation
- Parent theme CSS overriding child CSS rules
- How to style options page in dashboard?
- Theme Options Page – User Updates Logo
- Dynamic Stylesheet loads but doesn’t finish
- Page Automatically Generated from Theme?
- How to add date to navigation bar
- Sort query_posts for Parent Pages to menue order or the count?
- Can I install/embed WordPress on a ‘single page’?
- Incorrect MIME type for assets with Valet
- Customize position of social icons in upme plugin [closed]
- proper way to add css using functions.php?
- Use PHP in stylesheet to specify a background image based on Category ID
- WordPress wp_add_inline_style unable to give hex colors?
- How to make container class in PHP
- How to create table in wordpress without plugin? [closed]
- PHP in CSS file?
- 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?
- wordpress admin plugin menu custom css
- How to remove sidebar primary widget on Mobile on category page [closed]
- How to Change CSS Colors from Custom Plugin Settings Page
- Insert page content into another page with a changed variable
- How to add page numbering with php?
- Issue Enqueueing WordPress style.css
- Applying CSS on PHP variable [closed]
- Toolbar Hidden in a Virtual Page
- CSS images don’t show up with bloginfo
- how to changes mobile menu toggle breakpoint in WordPress
- Timber right sidebar in WordPress theme
- How to Remove Theme Style CSS inside Custom Plugin?
- Add other class content with reference class value
- How can I check if a post with a particular slug or title exists?
- oceanwp+woo mobile cart sidebar text
- Adding Custom css file in the wp-uploads directory with custom php functions
- How to hide a div section when user is logged in, in single product woocommerce
- Category Page Displaying all Pages
- How do I integrate vanilla Javascript to a wordpress website?
- Can’t display anything through homepage text editor
- Cannot dequeue Elementor Font Awesome css
- How to find and delete a menu item in php?
- WordPress Slider is not working
- How to display post meta bellow every posts
- Add Shortcode to ::before class
- Fix hover images blink
- Static Page with php echo [duplicate]
- Blog Image and Title in Right Sidebar
- How to tell if a page has subpages for Custom Post Types
- Displaying POST content with HTML tags and all
- Position a repeated article blocks
- Newbie question. Login/Registration. New PHP page
- Custom Thumbnails [closed]
- Adding my own custom template page but got white page
- How to map my php files as the files for pages
- wp add inline style in loop
- Display pages from specific page template
- How to add feature image url in my template file and content as well?
- How do I use CSS or PHP to customize WordPress Form Manager Plugin Table?
- Sidebar doesnt get updated?
- How to NOT override inline css rules
- Add CSS class to PHP Statement
- How to add margin underneath woocommerce total price amount -> productpages
- Load files content [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Predefine Magazine Style Layouts
- It’s not showing full content for posts pages in wordpress “[…]” while customing some changes in the style.css file [closed]
- Add a “Next Post” & “Previous Post” styled button manually to a post
- Sorting Problem
- PHP warning $post->ID is null
- Custom HTML/CSS Theme into WordPress – SEO considerations
- WooCommerce Checkout Cart [closed]
- why css file not link?how to create permalink?
- Using Featured Image as Hero Background in Word Press