Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've refrained from asking this question for a couple weeks, as I wasn't completely certain what I wanted cleared up... think I got it.

I'm in the process of putting together a plugin to run a somewhat complex portfolio feature for my new personal site. The need was for a reasonable number of custom fields for each portfolio item, a number of categories (illustration, web design etc) and a way to build relationships. I use those categories to populate a list which delivers data via user submitted ajax requests.

I weighed several options for this and landed on what I knew - and specifically didn't use custom post types; really, the only reason was ignorance. I did read a number of articles on the subject, but it just wasn't clear to me how to accomplish my goals.

At any rate - I've spent the last couple weekends building a plugin that creates three new tables, deals with CRUD from the admin pages, and controls ajax requests. And it works great, in fact, for the "multi" template (which just gathers categories of thumbnails).

Then I started working on the "single" page (which would just be a template for the display of a single line item), and it dawned on me that to incorporate searching, comments, permalinks etc, I was going to have to do a lot of hacking to tie my custom data into the main wp system.

At any rate. I've since come understand that I can, in fact, use custom post types to hold the portfolio line items, and a custom taxonomy to develop the set of terms I will need for categorization. I'm hoping someone can fill me in on some of the details that are still sticking (because the documentation on this subject is very thin, at best...).

The code to create a custom post type seems pretty straightforward, as is the code for a custom taxonomy, but I am still unclear on a couple points:

1.Custom Fields

How do I manage them? I have about 20 columns that I'm populating - I've read a few things stating they are created via meta boxes? What table is that data actually stored in? wp-posts?

2:Custom Terms

I understand how to create a custom taxonomy, but how do I go about linking my custom post type with that taxonomy? How do I filter a query for this taxonomy to populate the front-facing ajax drop-down selector?

Are there plugins that can make this easier? I'm planning on coding everything at this point.

Finally, given the scope of my project, are custom post types appropriate for what I'm trying to do? Does it make sense to scrap what I've already put together? Honestly - this is my first attempt at a plugin, and I've learned quite a lot - but the addition of wp features like searching, comments, permalinks etc. all seem pretty attractive.

I submit to the experts -

Update

How do I filter a query for this taxonomy to populate the front-facing ajax drop-down selector?

Let me explain this more clearly. When the front-facing portfolio page is visited by a user, I run a query on all the available terms (currently this term data is from my non-wp, custom tables), and use those to populate either a drop-down selector, or just an unordered list. I hook into those elements to pass (in this case) ID values (categories like 'illustration' or 'web design') to an ajax sequence, which returns a json object containing sql results. I then build out thumbnails and other content for these items dynamically.

The question then, is how do I structure a query to return custom post types based on terms from a custom taxonomy? As long as I can return a json object from that query, I can just use my current ajax / js sequence as it stands.

Thanks for the help -

share|improve this question

1 Answer 1

up vote 3 down vote accepted

How do I manage them? I have about 20 columns that I'm populating - I've read a few things stating they are created via meta boxes?

The custom fields are more of a storage engine for meta data. It's up to you how to use them. And yes, meta boxes are common for that when you need nice way to input/edit them on post screen.

What table is that data actually stored in?

*_postmeta

I understand how to create a custom taxonomy, but how do I go about linking my custom post type with that taxonomy?

When you register taxonomy you pass object type(s) that it applies to.

How do I filter a query for this taxonomy to populate the front-facing ajax drop-down selector?

I am not sure what exactly you need here. Elaborate?

Update

how do I structure a query to return custom post types based on terms from a custom taxonomy?

See:

Are there plugins that can make this easier?

Yep, plenty. But if you are proficient enough to deal with that much code directly I recommend to at least try and do it natively first.

There are plenty of awesome frameworks, plugins and other helper code for WordPress, but it is considerably hard to accurately research, evaluate and pick what will perfectly fit your needs in the long run.

Finally, given the scope of my project, are custom post types appropriate for what I'm trying to do?

Seems perfectly appropriate to me.

share|improve this answer
    
Busy weekend, meant to get back to you on this sooner. Thanks for the effort, Rarst, its much appreciated. Its pretty painful to dump work (I spent probably 10 or 15 hours getting my current solution up and running) - but I think that this is the right answer in the long run. As for an elaboration on that point, see my update. Thanks again - –  Bosworth99 Jun 27 '11 at 14:45
    
@Bosworth99 sorry, I am still not clear what do you need for "query for taxonomy dropdown". Could you try to rephrase that part? –  Rarst Jun 27 '11 at 14:54
    
Excellent. Thanks again for the help –  Bosworth99 Jun 27 '11 at 15:13
    
Weekend has arrived, and I've started work on this change to my plugin. Pulling new post type, taxonomies and meta boxes together and functioning perfectly took all of an hour and a half. I think the trick was just figuring out how each piece of the puzzle fits together, and how to get them properly registered. Anyway - it burns a little dumping so much work, but I learned a lot doing it the hard way, so the time spent wasn't wasted. At any rate - your time is much appreciated... –  Bosworth99 Jul 1 '11 at 18:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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