0

Hello I have wordpress website and I set up a new page called Ballina (Home) which I placed as static front page. But I want to remove the title and its CSS styling from this page because I want the page to be builded with from widgets only without that default settings

3
  • 1
    You can use body classes to remove (hide with css) title from frontpage.
    – Robert hue
    Oct 19, 2014 at 12:19
  • how to use body classes? Can you be more specific please?
    – albpower
    Oct 19, 2014 at 12:24
  • Why don't you create a front-page.php file? Oct 19, 2014 at 16:15

1 Answer 1

2

The body_class() (see Codex) is a function that displays classes depending on the query. In other words: Depending on where you are, it outputs different classes. You can as well append your own - either directly as argument or with a filter:

// Directly in your template
<body <?php body_class( 'your-custom-class-name' ); ?>>

Example for a filter callback:

// Add specific CSS class by filter
add_filter( 'body_class', 'wpse165818_custom_class_names' );
function wpse165818_custom_class_names( $classes )
{
    // add 'your-custom-class-name' to the $classes array
    $classes[] = 'your-custom-class-name';

    // return the $classes array
    return $classes;
}

Let's say your page title is in div container with class page-title. Now you can use body CSS classes to hide it on specific page.

For homepage, you can use this in your style.css.

body.home .page-title {
    display:none;
}

This will hide element with class page-title on homepage. So you will need to find page title class and use it in this code.

WordPress adds tons of CSS classes to HTML body. You can view them on page source and use them accordingly.

1
  • Thank you I got it to work by modifying style.css with the proper class of the title :)
    – albpower
    Oct 19, 2014 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.