• # October 27, 2011 at 10:55 pm

    This reply has been reported for inappropriate content.

    It worked!! for somereason it wouldn’t work in the editor built into wordpress. so when i got home from school i tried again through a text editor, and uploaded it via FTP. and it worked :) but now each of them have seperate classes and ID’s how do i target these?

    # October 27, 2011 at 11:28 pm

    This reply has been reported for inappropriate content.

    it doesn’t show an end div.

    # October 28, 2011 at 11:08 am

    Move the ending to after the last ‘endif’ in the code above and you should be golden.

    You can then target each post by their id or class name eg: .search-results .post-69{
    However if you ever deleted/rewrote a post it would have a different post number and therefore a different class, therefore it would be better practice to style them by category. Just give each post a category and then style them like so .search-results .category-resume{.

    # October 28, 2011 at 12:02 pm

    This reply has been reported for inappropriate content.

    Thank you! Ill do that when home from school. i can’t wait!

    # October 28, 2011 at 5:21 pm

    This reply has been reported for inappropriate content.

    howcome i can’t just give it a class?

    # October 29, 2011 at 12:23 am

    You can. You can give it whatever class you like within the loop. The loop is simply the PHP which produces the HTML markup for each post, so you can wrap it in whatever HTML tags you like. You mentioned in your 2nd post though that you wanted to select posts individually, and using the WordPress post_class() function gives each post a unique class you can use to target it with.

    Just a thought, but have you ever considered investing in Chris’s book Digging into WordPress? This is all explained very thoroughly in there. I’d highly recommend it.


    # October 29, 2011 at 2:09 am

    This reply has been reported for inappropriate content.

    Oh okay, well what i meant was be able to have some sort of background for each post, rather then just the entire wrap of all posts being one color background.

    # October 29, 2011 at 6:36 pm

    Well that’s what the code above does, it doesn’t wrap the whole set of posts, it wraps each post in a div so that you can style them however you like. If you wanted to wrap the whole set in a div you’d do that outside of the loop, if it’s inside the loop though then that div will be produced multiple times – once for each post. I just checked your link again and it looks like you have it figured out now.

Viewing 8 posts - 16 through 23 (of 23 total)

You must be logged in to reply to this topic.