0

I have a custom post type 'job'. I created a archive-job.php . How can I display 'post date', 'city', 'state' in my archive-job.php page?

  1. Currently, my archive-job.php page displays a list of jobs that has 'title' and 'summary' only.

  2. 'city' and 'state' is a taxonomy.

  3. I use 'Formidable Pro' to create front-end job post form. (I guess this doesn't matter).

0

You can use the_terms function in WP to display your term values in your archive page.

Usage

the_terms( $id, $taxonomy, $before, $sep, $after );

Parameters

  • $id (int|req) -> Post ID. Default: None
  • $taxonomy (str|req) -> Taxonomy name. Default: None
  • $before (str|opt) -> Text to display before tags are displayed. Default: Empty string
  • $sep (str|opt) -> Text or character to display between each tag link. Default: ', '
  • $after (str|opt) -> Text to display after the last tag. Default: Empty string

WP : Function Reference/the_terms

  • Hi I insert this in content-job.php <?php get_the_terms( $id, $state ); ?> But nothing shows up. – Jennifer Mar 9 '15 at 10:35
  • Hi @jennifer, get_the_terms() function doesn't echo results. you should assign it to a variable and then print the results as you needed. or use the_terms() function instead. – gpnalin Mar 24 '15 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.