Dyad 2 remove the word 'Category:' from the display of posts in a category

  • Unknown's avatar

    Hi there, I’ve recently switched themes to Dyad 2, which I’m really liking and think I’ll stick with and so which has prompted finally asking how this can be done {it is the same let down in every theme that I’ve seen!) – I presume it is done in CSS?

    I have all of my posts organised into categories, which are then menu pages/items, well a custom link to the URL of the chronologically ordered category is). When the menu item (ie the category) is clicked on, the posts are displayed with ‘Category: actual title of my category’ at the top of the page.

    I would just like it headed with the actual title of my category, not preceded by the word Category:

    Hoping some can help, cheers, Kylie {my site is private, it won’t be able to be accessed, but I think this is more a general inquiry on the CSS of the theme in any case}

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi, the WordPress core software creates the titles for tag, date archive and category pages as a single string of text. Currently there is no way to remove the Category: part since we cannot affect part of a single string of text with CSS. This is something that the core WordPress developers are discussing and it looks like the change will make it into a future version of WordPress, but there is no way to say which one. I’m hoping for the next major release.

    We can hide the entire title on category pages in Dyad 2 with the following.

    .category .page-title {
      display: none;
    }
  • Unknown's avatar

    Hi there, thank you for your response – although somewhat disappointing that this is not a quick thing to fix, it results in an extremely clunky looking display! I was pointed in the direction of downloading the theme’s files (I’m on a business plan so can upload a modified / child version of this theme to my site) by a helpful WP support chat person, which was excellent! I presume that this might be something that I am able to tweak in there? Or still not?

  • Unknown's avatar

    There’s a somewhat arduous workaround just using custom CSS, it involves hiding the existing titles and then adding them in one by one for all the categories you have. So it might not be suitable if you have a lot of categories already or you plan on adding more and don’t want to have to keep adding a line of CSS each time.

    Here’s the code anyway, based on the Dyad demo site:

    body.category .page-title {
      display:none;
    }
    
    body.category .page-header {
      margin: 0;
      padding: 0 2rem 5rem;
      text-align: center;
      -ms-word-wrap: break-word;
      word-wrap: break-word;
      color: #1a1c1e;
      font-family: "Noto Serif", Georgia, serif;
      font-weight: 700;
      line-height: 1.38;
      font-size:5rem;
    }
    
    body.category-baking .page-header:after {
      content:'Baking';
    }
    
    body.category-cooking-techniques .page-header:after {
      content:'Cooking Techniques';
    }

    The last block is the one you’ll need to duplicate and then edit the category name in the two places it appears.

  • Unknown's avatar

    Hello halluke, thank you! I do have numerous categories and do intending adding more to those, so it does sound a little arduous – but I’m OCD about detail so certainly not out of the realms of possibility of what I’m prepared to try! Thanks again :-)

  • Unknown's avatar

    There might be a better option if you can now edit theme files on the business plan. I haven’t been on the forum in a while so this is a new change that I don’t know much about – I can’t find much about it in the documentation either – sorry for not being able to help further.

  • Unknown's avatar

    Tx again to halluke and thesacredpath :-)

  • Unknown's avatar

    You are welcome.

    If you create a child theme, you can edit the php script files (if you have experience with php) and I think there may be a way to change this, but it is the WordPress core software that actually creates that title text string. You may be able to put a “span” tag or something around part of the text string and then use CSS to hide that span tag.

  • The topic ‘Dyad 2 remove the word 'Category:' from the display of posts in a category’ is closed to new replies.