• Resolved obeattie

    (@obeattie)


    Hi,

    I am trying to reate a statement which says ‘if the post is in category 3 and is the first (latest) post then…

    I am currently using

    <?php if ( in_category('3')) { ?>

    to sort the category bit out… how would I do it (i presume it would be something like <?php if ( in_category('3')) && something { ?>)

    Could anyone help me here?

    Many thanks,
    Oli

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter obeattie

    (@obeattie)

    Does anyone know about this? Please

    What do you want to do? Maybe there is already a solution so no need to invent the wheel…
    What is what you want to do with the last post from X category?
    If you can describe that – helpers could come up easier with a viable solution.

    Thread Starter obeattie

    (@obeattie)

    Hi,

    What basically I am doing is that if the post is in the ‘Featured’ categoey (3) then it gets a entry-featured div and an emblem image applied. Otherwise what it does is assign it an entry div.

    However, I also want the first post to display differently with an emblem. But, I do not want both emblems to display if it is both. If anyone gets my meaning.

    So, basically whta i want is that if it is in featured but not the first post that the entry-featured be applied to it.
    If it is in both, just entry-featured applied.
    If it is the first post but not features, an entry-first applied to it.
    Otherwise, just entry applied.

    Thanks again,
    Oli

    Hmm. Maybe it’s me but it is still confusing.

    So let’s try it again:
    If the post is in category 3 then it will be displayed in a special div “featured-entry”. Right?
    In this div there also should be a – let’s call it – category icon, right?

    What is confusing is your term of “first post”. First is usually the oldest post of yours. Did you mean the latest?
    Or what exactly is “first”? Post in another category displayed below?

    Sorry, just trying to understand the issue so if there is a solution to be able to offer it.

    Thread Starter obeattie

    (@obeattie)

    Oh no problem, I seem to be very bad at articulating my thoughts recently.

    What I want to do is that if the post is in category 3 in general, to apply a div to it (entry-featured), and also add an img to it which is like a little rosette showing it is featured.

    What I also want to do is highlight the most recent post (what I meant by first) with an entry-first div and also apply a rosette (a different one).

    However, there will obviously be some situations where both of those conditions is true. Then, I want to just apply the entry-featured div and rosette. Not both as everything would begin to look horrible.

    Hope this is a bit clearer for you,
    Oli

    Thread Starter obeattie

    (@obeattie)

    I think I may have dont it, but the code is very ugly. I am just going to test it now.

    Thread Starter obeattie

    (@obeattie)

    Yup. Done it :D. If anyone is interested in the code, post a request for it and I’ll put it here.

    Yes please!! Can you post the code??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘If is first post and is in category’ is closed to new replies.