0

I have a taxonomy called stocks. it has various items such as 'NFLX', 'AAPL', 'GOOG'

I want to be able to assign two things to a WordPress Post:

  1. Main stock (only one item selected from the Stocks taxonomy.
  2. Mentioned stocks (select one or more items from the Stocks taxonomy).

Here's the other thing, I want the slug for the MAIN STOCK to be in the URL of my post.

Example:

I write an article on Apple Inc and mention other competing companies. The main stock would be AAPL. Mentioned stocks would be AAPL, GOOG, AMZN, etc. And I'd want the URL to be www.example.com/AAPL/the-name-of-the-article

So, I'm trying to avoid creating two taxonomies (i.e. Main Stock and Mentioned Stocks) and filling both up with the same set of stocks. Ideally, I want to create one taxonomy and use it in two places. Then pull the slug for that taxonomy item selected for the "main stock" to be used in the URL of the post itself.

Is this possible?

  • the answer may depend on how you'll need to query and display posts based on the associated terms. it seems you'll have to use post meta in some way, maybe to store which you want designated as main. – Milo Mar 13 '14 at 3:30
0

You can do this by using the category taxonomy for your stock symbols, then in permalink settings you would select the custom permalink structure with /%category%/ to get your url of AAPL/article-title.. Then you could use tags for mentioned stocks so you can tag the article with AAPL, GOOG, etc.. You don't even need to setup a custom taxonomy.

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.