SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    549
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    adding multiple classes and id's

    I'm building a wordpress website http://salafiwales.co.uk

    On the blog I don't mind all the info, date, time, comments etc on the page but on my " in store " page I have items posted and I do not want all the info on ech page. I have put the following css to get rid of it all: However I want to place all the post id's for the items for the same rules ie postid-386 etc so how do I do this without creating rules for each class?

    .postid-374 #sidebar {
    display: none;
    }
    .postid-374 #content {
    background: none;
    }

    .postid-374 #category-name {
    display: none;
    }

    .postid-374 #reply-title {
    display: none;
    }

    .postid-374 #comment {
    display: none;
    }

    .postid-374 .form-allowed-tags {
    display: none;
    }

    .postid-374 .form-submit {
    display: none;
    }


    .postid-374 #comment {
    display: none;
    }

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    It's not quite clear what you are asking, but you can group them together by separating them with commas. E.g.

    Code:
    .postid-374 .form-allowed-tags, .postid-374 .form-submit, .postid-374 #comment {
      display: none;
    }
    Off Topic:

    As an aside, though, this is dreadful web design—and a wonderful advertisement for not using WordPress. Using display: none to hide stuff is pretty lousy. Users still download all that junk, and think of poor blind users who may still have to trawl through all that stuff, and Google, too.

    It would be preferable to use a better CMS, or at least find out how to head that code off 'at the pass', so to speak, and not let it into the HTML in the first place.

  3. #3
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    549
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I mean I have lots of postid's that I want to apply the above rules to so how do I grounp those?

    ie I have
    postid-374
    postid-389
    postid-368
    postid-360
    postid-350

    and for all of them I want to choose not to display the comments, post date etc etc

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Again, a bit vague, but something like this:

    Code:
    .postid-374 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
      display: none;
    }

  5. #5
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    549
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    ok, this is the store page:

    http://salafiwales.co.uk/?page_id=28

    when you click on each item you are taken to it's post and I want to remove the post dates, comments etc etc for each of those items...
    so do I have to add each post id like this:

    .postid-374 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
    display: none;
    }

    .postid-389 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
    display: none;
    }

    .postid-386 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
    display: none;
    }

    .postid-360 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
    display: none;
    }

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    All but the first item in each of those blocks is the same, so no need to reapeat them over and over. Take the first item (before the comma) of each line, and the remaining ones of the first line, and that will do it:

    Code:
    .postid-374 #comments, .postid-389 #comments, .postid-386 #comments, .postid-360 #comments, .postid-389 #comments, .postid-368 #comments, .postid-360 #comments, .postid-350 #comments {
    display: none;
    }

    But again, a better approach would be to go to the WP template and remove the comments on the pages that don't need them.

  7. #7
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    549
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    lol I don't know why it took me so long to get my head around that, but I got it now!!!

    For each rule I placed all the postid's like this:

    .postid-374 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar {
    display: none;
    }

    .postid-374 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar {
    display: none;
    }

    .postid-374 #content, .postid-389 #content, .postid-386 #content, .postid-360 #content, .postid-389 #content, .postid-368 #content, .postid-360 #content, .postid-350 #content {
    background: none;
    }

    .postid-374 .description, .postid-389 .description, .postid-386 .description, .postid-360 .description, .postid-389 .description, .postid-368 .description, .postid-360 .description, .postid-350 .description {
    display: none;
    }

    .postid-374 #respond, .postid-389 #respond, .postid-386 #respond, .postid-360#respond, .postid-389 #respond, .postid-368 #respond, .postid-360 #respond, .postid-350 #respond {
    display: none;
    }

    btw I have only ever used wordpresss, I do like it but what cms are you recommending?

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by hantaah View Post
    For each rule I placed all the postid's like this:
    Code:
    .postid-374 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar {
    display: none;
    } 
    
    .postid-374 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar {
    display: none;
    }
    Just note that you could simplify that further. You only need display: none once. E.g., you could group all those (minus the first item, which is a duplicate):

    Code:
    .postid-374 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar, .postid-389 #sidebar, .postid-386 #sidebar, .postid-360 #sidebar, .postid-389 #sidebar, .postid-368 #sidebar, .postid-360 #sidebar, .postid-350 #sidebar {
    display: none;
    }
    btw I have only ever used wordpresss, I do like it but what cms are you recommending?
    WordPress is really a blog system rather than a CMS designed for your urposes (hence the #comments stuff everywhere, for example). There are lots of CMSes out there for regular sites, some free, some with a price. I recommend ExpressionEngine, but if you don't want to pay for it, try Drupal, MODx, Concrete5, Textpattern, CMSMadeSimple and so on.
    Last edited by TechnoBear; Sep 27, 2012 at 04:30. Reason: Fixed quote

  9. #9
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,729
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    As an aside, though, this is dreadful web design—and a wonderful advertisement for not using WordPress.
    WP is just a tool , like anything else using it the wrong way ( as the OP'er is ) is bound to have dreadful results.
    Using display: none to hide stuff is pretty lousy.
    Yup!


    OP:
    postid-374
    postid-389
    postid-368
    postid-360
    postid-350
    This is where THINKING becomes all important...
    Why? I there a pattern to the post/ comments/ meta info you want to 'hide'. Do you really want to HIDE or you just don't WANT IT TO BE OUTPUT at all? if the latter why are you using a WP template, settings, and theme which output and display this info. If you really just dont want certain posts AT ALL ..Simply find post# 374,389, 368,360,350, and any other posts you dont want published and unpublish in the WP dashboard.

    There are so manuy ways to do this am having trouble picking one to suggest. Let say you just don't want those post to show up at all when a specific page template is used. Ok for that you actually have to code a line or two.

    Go to the template file make an array to store the post you want to omit in this template ( or you could have a convoluted if statement later.. but this is far more graceful)

    Code:
    <? $omitThese=array(374,368,etc,etc);?>
    Then find the loop part of your template and add this line right after the while have_post() .

    Code:
    if (in_array($post->ID,$omitThese )){ continue;}
    This way your post will be output in other templates , but not in the one ones you have made this alteration to.


    I hope that gets you closer to making WP work the way you want it to

  10. #10
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    postid-374
    postid-389
    postid-368
    postid-360
    postid-350
    *[class^="postid-"] * {display: none;}

    Hell on the parser, but Larry Wall did say laziness was a virtue. Having the back-end not send it in the first place as Dresden mentioned is way better of course, but CSS is starting to get a bit smarter. Some day it'll finally have the full power of regex instead of these weak-@ssed wildcard things and then we'll be rockin'.


Bookmarks

Posting Permissions

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