• Using v6.1 I’m attempting to build a sample page-only site for a client. (Disclosure – I’ve not used WordPress for years.) I’m hung up getting started, trying to shrink or eliminate showing page titles.

    Page titles are rendered with <h1 class="wp-block wp-block-post-title ... , which is immense.

    I tried adding CSS:

    .wp-block .wp-block-post-title {
    visibility: hidden;
    }

    or with display: none;

    but there is no change. Nor are there any well-regarded plugins that claim to be compatible with the version of WordPress I’m using.

Viewing 5 replies - 1 through 5 (of 5 total)
  • CSS is CSS, nothing to do with WordPress 😀

    Most likely your selector is not specific enough, or is incorrect… that’s why it’s not working.

    Please provide the URL of the page in question, so I can check the code on the page and help you with this.

    Standing by.

    Thread Starter geowb

    (@geowb)

    Thanks for your reply. The page only exists on my development server and is not available in the wild. I take it that “…CSS, nothing to do with WordPress” means that website styles are not accessible to casual users/developers such as myself. I can see the classes of site elements using the browser’s inspector. And I’m used to having control over the css. I’ll probably have to dig deeper to learn how to better control the appearance of pages. Thanks anyway.

    I take it that “…CSS, nothing to do with WordPress” means that website styles are not accessible to casual users/developers such as myself.

    Actually what I meant was that you don’t really need any WordPress-specific knowledge to write custom CSS to style the page (other than knowing where to put the CSS code in your WordPress dashboard).

    Whether it’s WordPress, Joomla, Drupal, or even plain ‘ole static HTML… doesn’t make any difference: you simply need to know your standard CSS selector and specificity rules and the knowledge of your browser’s developer tools.

    For instance, you said the page title has this:

    <h1 class="wp-block wp-block-post-title ...

    But you’re using the selector:

    .wp-block .wp-block-post-title {
    
    }

    … which is wrong (according to CSS rules, not WordPress rules).

    Since the two classes are defined together for the same element, there should be no space in the class names in the selector. So this should be

    .wp-block.wp-block-post-title {
    
    }

    But I don’t know if there are other elements on the page with the same classes, so better safe by limiting it to the h1 element only, so it becomes

    h1.wp-block.wp-block-post-title {
    
    }

    And this will affect ALL pages that have an h1 element with these classes. If this is just for the homepage, you’ll need to add the homepage’s unique body class to it (provided your theme includes the body classes!), so it becomes:

    .home h1.wp-block.wp-block-post-title {
    
    }

    All these have nothing to do with WordPress per se: they’re just basic CSS rules (which is what I was trying to say earlier.)

    Thread Starter geowb

    (@geowb)

    Thanks. I’d forgotten how opaque WordPress is. It’s going to take few more hours to get oriented. I appreciate your efforts but I’m starting back at the bottom of my learning curve. Patience is required.

    Be well.

    Thread Starter geowb

    (@geowb)

    An observation: the <h1... title only appears when editing a page. For a site visitor that title is not displayed. Two questions: What is the advantage of having an immense title appear when one is trying to create a page and no visitor will ever see that title? Is there any way to create and edit a page without that large scale header?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot hide title with CSS’ is closed to new replies.