Forums

[resolved] The Loop question (3 posts)

  1. Alanflamer
    Member
    Posted 5 months ago #

    Hello guys, I'm new here. I'm exploring the Codex looking for tips to aply my template, and I'm stuck.

    My problem: I'm editing the category.php template file. I have a number of categories and I want them to apear in a certain way.

    The only problem is that I want to style the first post of this page in a different way than the other posts. I don't want to exclude a post by ID or something, I'm only looking for a way to ad some div, automaticaly, to the first post, so I can give it a different style.

    Can anyone of you help? I'm trying, unluckly, to use Query, but when I do that my Category page shows all my posts, of every category, and I only whant to aply that to the current category of the opened page.

    If anyone can help, thank you. xD

  2. alchymyth
    The Sweeper
    Posted 5 months ago #

    I want to style the first post of this page in a different way than the other posts.

    have you used the forum search (or web search) for this problem?
    it is so common that you should be able to get some answers.

    one way to do this is to add a conditional statement to identify the first post in the loop;

    example: one of my latest posts http://www.transformationpowertools.com/wordpress/styling-first-post-different

    if this does not help, you could paste the code of your category.php template into a http://pastebin.com/ and post the link to it here. someone might have a look and might be able to suggest a solution.

  3. Alanflamer
    Member
    Posted 5 months ago #

    Thanks for the help. I was using the search on the top of the page, not the specific search of the forum. I found various types of solutions, and one in special helped a lot.

    http://adambrown.info/b/widgets/easy-php-tutorial-for-wordpress-users/first-post-different-from-the-rest/

Reply

You must log in to post.

About this Topic