• Resolved sendinthefox

    (@sendinthefox)


    Hi I have read articles about hiding Page Titles, I understand that I can do this in the Custom CSS area of theme and in the PHP file.But I want a solution for each single page on my own discretion. When I put this into my head: my Theme: Stoken does not accept it:

    <head><style>
    h1#page-title { display:none !important; }
    </style></head>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there.

    You want hide the title but maybe not on all pages or posts, so you want to pick and choose?

    If so then a plugin like the following should help:

    https://wordpress.org/plugins/rt-custom-css-page-and-post/screenshots/

    https://wordpress.org/plugins/stylesheet-per-page/

    https://wordpress.org/plugins/insert-javascript-css/

    Hopefully that should help 🙂

    Every page will have a unique page ID assigned to it, that will also be part of the body element’s classes. That is, if you do a “view source” on one of your pages (or examine the page using a web debugging tool like Firebug or Chrome Developer Tools) and look for the body tag, you should see a class name that looks like page-id-#, where # is the unique identifier.

    So let’s say you want to hide the page title for pages which have an ID of 9, 23, and 117. You can add a rule that looks like this in your custom CSS:

    .page-id-9 #page-title,
    .page-id-23 #page-title,
    .page-id-117 #page-title {
       display: none;
    }

    As an aside, you shouldn’t have to use the !important clause in this situation. Usually, when I see someone using !important, it’s because they don’t understand CSS specificity. The only time you need to use it is if:

    1. You have to override an inline style.
    2. There is an existing rule with such a high specificity that it can’t be overridden with a higher specificity (i.e., by tacking on additional class and/or ID specifiers), and adding a rule with an identical selector won’t work because the rule you’re trying to override comes after your custom CSS.

    Use Chrome DevTools or Firebug to determine what CSS rule is in effect and first try adding an overriding rule with the same selector, and if it doesn’t work because your custom CSS comes after the stylesheet that contains the rule, then add to the specificity of the selector by tacking on either an element, class, or ID. You want to just use the minimum amount of specificity to get the job done.

    Thread Starter sendinthefox

    (@sendinthefox)

    Ok thanks CBruin – you’re solution seems the best for me – I did see some stuff on page #ids. I will inspect the page with Chrome dev tools – thanks again for your help with this, WordPress Org should document this, or easier to find under Page Titles
    😉

    Thread Starter sendinthefox

    (@sendinthefox)

    You don’t have to inspect code you can see the Page ID in the URL bar when you are editing the particular page – all works thanks 🙂

    I’m having the same problem. CrouchingBruin’s very clearly stated solution does not seem to work for me.

    The URL whose page title I am trying to suppress is
    https://livermorevalleyeducationfound.wordpress.com/programs/element-116/

    Here are the entire contents of the site’s CSS file:

    .page-id-154 #slider-wrap {
    display: none;
    }

    .page-id-370 #slider-wrap {
    display: none;
    }

    .page-id-154 #page-title,
    .page-id-370 #page-title {
    display: none;
    }

    The slider-wrap code works correctly (to suppress header image), but the #page-title code does not suppress the page titles.

    Assistance will be greatly appreciated – thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Single page CSS – Hide Page Title’ is closed to new replies.