Support » Fixing WordPress » css selector for posts?

  • I have my main blog page styled the way I want it (for the most part), but when I click on a post title or a comment link, the result is that the style no longer applies to the post. I can style the comments and durn near everything else on the page, but the posts are numbered (i.e. – class=post-23…id=post-23).
    Is there a css selector that will target these numbered posts? It seems impractical to make a separate selector for each post.
    What am I missing?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael


    Forum Moderator

    please post a link to your site to illustrate the problem.

    possibly add another general class to the post div in the template …

    The site is here. WordPress 3.3.1, Adventure Journal 1.7.2.
    The issue is that I’m hoping WordPress has a css selector that can target any post, regardless of number; i.e. – div id=’post-42…class=’post-42′. If not, I can edit the template, but am I wrong in assuming that an upgrade will wipe out the edits? If I can do the job using only my ancillary css stylesheet, i’d rather.
    As you can see, the landing page posts are styled with a background image, but clicking on ‘Comments’ or the post title takes you to a post page where the styling is lost, I believe because of the use of the dashed (post-42) selector.
    The funny thing is that on the landing page all the posts are numbered the same way; the only difference I can see is that on the landing page there is a comment before each post: “post-##”. Is that something I could use? If so, I don’t know how…



    Forum Moderator

    the post div seems to use post_class() which gives you a number of css clssses;

    output example from your link:

    <div id="post-45" class="post-45 post type-post status-publish format-standard hentry category-uncategorized">

    the same from the single post:
    <div class="post-45 post type-post status-publish format-standard hentry category-uncategorized" id="post-45">

    the css classes .post and/or .hentry are output for each of the posts and are quite generic and could be used for styling.

    (ps: I have not looked into details why the formatting is off in single posts – this is not really scope of a WordPress forum)

    (Palm slaps forehead!)
    That’s way too simple; I was hoping for something complicated enough that I could justify spending the next few weeks pounding my forehead on my desk…


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘css selector for posts?’ is closed to new replies.