Support » Developing with WordPress » CSS to specific pages

  • Hello,

    I completely new in web dev and I would like to apply CSS just on specific page

    I have this .entry-title {display:none;} that is great to not display title on my homepage, portfolio, etc…

    But I have also a part of my website which is a blog and so where I need people to see the title.

    I supposed the easiest to do is to target this CSS only to page I dont want the title to be seen, but I don’t know how to write

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Steven Stern

    (@sterndata)

    Support Team Volunteer

    Look a the <body> tag for the page(s) in question. You’ll see each has a page ID as a class

    For example, a post on one of my sites has

    <body class="post-template-default single single-post postid-1820 single-format-standard custom-font-enabled">

    So, for your example, I’d do this to target that particular post.

    .postid-1820 .entry-title {display:none;}

    Thanks steve, I’ll try right now 😉

    also, dependant on your theme, the .entry-title container might be within a different other container if it is for example just the page title, or the title of a post within the blog page…

    to get more detailed suggestions, you might need to post the name of your currently used theme (if it is one of the themes from https://wordpress.org/themes/ ) or provide a link to your site.

    Hello,

    Steve, in my case I just replace your code .postid-X with page-id-X and it works perfectly

    It looks like this at the end

    .page-id-58 .entry-title {display:none;}
    .page-id-2 .entry-title {display:none;}

    I there a way to write it in just one row ? maybe something like .page-id-58;2 .entry-title {display:none;} I don’t know whether multiplying this king of code could slow down the website maybe ?

    Here is my website http://www.clementchambaud.com

    • This reply was modified 1 year, 8 months ago by  fahara.

    Hello,

    I just found my answer, thanks again

    .page-id-107 .entry-title, .page-id-56 .entry-title {display:none;}

    This is really awesome info! Thanks for the answers.

    Wow, thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CSS to specific pages’ is closed to new replies.