0

I have 2 post types (job, resume) and sharing 1 custom taxonomy (cities)

it's for jobs in "New york" and it's also for jobseekers in "New york" (resume is the post-type for jobseeker)

 register_taxonomy(
  'city',
  array( 'job_listing', 'resume' ),
  array( 'hierarchical' => true,
        //'label' => 'Location', 
            'label' => __('Locations1', 'Locations2'),   // both of them shows "locations1" there is no "locations2" on resume
            //'query_var' => true, 
         'query_var' => 'location',
        //'rewrite' => true
         'rewrite' => array( 'slug' => 'locations' )
  )

);

It works ok but I need to know how to get them to displayed.

On backend, it shows ok but it's all total posts amounts.

 domain.com/wp-admin/edit-tags.php?taxonomy=city&post_type=job
 domain.com/wp-admin/edit-tags.php?taxonomy=city&post_type=resume

problem : these display all amount of posts. not each post_types.

On front-end, I need to show 2 lists

 "jobs in Newyork", "resumes in Newyork"

How can I get them?

1
  • It is fine to share a taxonomy across post types, and you're registering it correctly. The label parameter, however, only accepts a string. You are using the function __() where the first parameter is the string and the second is the text-domain for translations. The second parameter is never visible. You might find the following tutorial on advanced rewrite rules helpful for creating prettier front-end URLS Dec 19, 2013 at 8:22

1 Answer 1

3

For jobs in Newyork:

$query1 = new WP_Query( array('post_type' => 'job','city'=>'new-york') )

For resumes in Newyork:

$query2 = new WP_Query( array('post_type' => 'resume','city'=>'new-york') )

Is this what you need ?

5
  • yes that's what I need (I haven't tried yet) I am working on backend, Label name is not also working. it supposed to show "location2" on resume. but it's "location" and total amount. not each...
    – pulla
    Dec 19, 2013 at 8:13
  • please see register_taxonomy part, am I doing right to share a taxonomy for 2 post-types?
    – pulla
    Dec 19, 2013 at 8:13
  • Yes you can share a taxonomy for any number of posts-types you want Dec 19, 2013 at 9:49
  • For label parameter refer this example : codex.wordpress.org/Function_Reference/register_taxonomy Dec 19, 2013 at 9:51
  • yes I will please wait for a while. it's too late here :)
    – pulla
    Dec 19, 2013 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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