• I mean, I don’t want the ID of a post
    (I don’t want this:
    $post->ID)
    I want his number in a specific category.

    For example am uploading a new post and his ID is 300.
    But I put it in a category that have only 20 posts, I want to find this number – how many posts was before this post in this specific category?

    I hope you understand what am trying to achieve here ^^
    Thanks in advance,
    Amit.

Viewing 4 replies - 1 through 4 (of 4 total)
  • [code moderated – please use the pastebin]

    I wrote this function just now, havent tested it out. It should work. Might need some more parameters for the query though…

    Thread Starter casio222

    (@casio222)

    Hey thanks for the fast replay!
    something went wrong with the args line I think – “Parse error: syntax error, unexpected T_DOUBLE_ARROW”
    I am not an php expert so I don’t really know what it means…

    Forgot to add the array(). Try it out the above code now. The function above should be added in your themes functions.php file

    Thread Starter casio222

    (@casio222)

    see – https://www.amitsadik.com/portfolio/digital-paintings/wild-pregnancy/
    the number down there – “35”

    your function shows the number of posts in a category, just like:
    $category->category_count;

    what I want is to know the number of a post in a category…. I mean the newest post in a category will be number 1, the second will be number 2…. how I get this number..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to find the number of post in category?’ is closed to new replies.