• For each posts, I would like to have a variable defined with the category it sits in.

    For instance, post 1 is cat1, then $category would be 1;
    Post 2 is cat2, then $category would be 2;
    Post 3 is cat1, then $category would be 1;

    You get what I want? Thanks.

    And I want to avoid creating another custom key for each post.

Viewing 1 replies (of 1 total)
  • Thread Starter ythibodeau

    (@ythibodeau)

    the thing is that

    the_category();
    and
    single_cat_title();

    echoes the results which is not what I want.
    And I don’t want to edit any of those core functions.

Viewing 1 replies (of 1 total)
  • The topic ‘Get post category within the loop…’ is closed to new replies.