Results 1 to 5 of 5
  1. #1
    theshortstack is offline Private Member
    Join Date
    August 2008
    Location
    London
    Posts
    142
    Thanks
    4
    Thanked 5 Times in 3 Posts

    Default Help with Wordpress CSS

    Hi there,

    I'm using a custom Wordpress theme that tags each of the posts on my homepage with the WP categories that they belong to.

    Because some posts can belong to multiple categories, it's making the home page look pretty messy, so I want to try and 'remove' the category tags by using: display: none;

    Looking at the HTML code, I can see that the category tags seem to belong to a "post-category" class:
    HTML Code:
    <div class="post-category"><a href="https://mydomain.com/category/review/">Reviews</a>
    Therefore, I've added the following custom CSS to try and stop them from showing:

    Code:
    #post-category {
    display: none;
    }
    It's not working though, and I was hoping someone here might be able to tell me why. Is it ok to target the class directly like that? Or do I need to reference all of its parents classes too?

    Thanks very much in advance!

  2. #2
    baldidiot is online now Private Member
    Join Date
    January 2010
    Posts
    5,010
    Thanks
    427
    Thanked 2,287 Times in 1,522 Posts

    Default

    # is for an ID but post-category is a class so you need to use:

    .post-category {display: none;}


    However... it would probably be better to edit the theme file to stop the categories outputting rather than just hiding them.
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding on Dan - see the list here. Prices negotiable, and willing to swap for decent links.

  3. #3
    ddm
    ddm is offline Former Member
    Join Date
    July 2006
    Posts
    1,125
    Thanks
    418
    Thanked 470 Times in 287 Posts

    Default

    most likely the tags are added via 'widgets' in the dashboard. have a look in the 'sidebar' spot under widgets, and i would guess it's there and can be removed rather employing a CSS hack

  4. #4
    theshortstack is offline Private Member
    Join Date
    August 2008
    Location
    London
    Posts
    142
    Thanks
    4
    Thanked 5 Times in 3 Posts

    Default

    Thanks, both - really appreciated.

    However, the suggestion of using .post-category doesn't seem to be working either. No idea why.

    Quote Originally Posted by baldidiot View Post
    However... it would probably be better to edit the theme file to stop the categories outputting rather than just hiding them.
    Yes, I've tried this but I can't seem to find the post-category class anywhere. I've even done a search through the PHP and CSS files on my laptop without any luck.

    @ddm - the tags are actually in the main page itself rather than the sidebar, so I haven't been able to find them in widgets either.

    I'll keep going

  5. #5
    baldidiot is online now Private Member
    Join Date
    January 2010
    Posts
    5,010
    Thanks
    427
    Thanked 2,287 Times in 1,522 Posts

    Default

    Quote Originally Posted by theshortstack View Post
    However, the suggestion of using .post-category doesn't seem to be working either. No idea why.
    Maybe post the URL here (or PM it) so we can see exactly what's going on.



    Quote Originally Posted by theshortstack View Post
    Yes, I've tried this but I can't seem to find the post-category class anywhere. I've even done a search through the PHP and CSS files on my laptop without any luck.
    Try using this plug in to find it: https://en-gb.wordpress.org/plugins/string-locator/
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding on Dan - see the list here. Prices negotiable, and willing to swap for decent links.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •