1

Is there an easy way to modify custom post types on the frontend? Maybe you can direct me to a plugin?

For example, I have a custom post type called "Product". The examples I see online show how I can perform CRUD on products in the dashboard, but is there a way I let a user modify a product on the frontend of the site?

Do I need to write my own crud code for the front end?

2 Answers 2

5

I'm from the World of Django, where CRUD is King, so I had a similar question. The best answer I've found so far is Pods and the associated Pods UI. Unlike "Custom Posts", which are kind of weird once you take a look under the hood, Pods actually creates real tables with real fields. Furthermore, you can crate relations! What a concept! Try that with Custom Fields. I haven't done this for a user-facing page yet, but it makes for a very nice admin-facing input form.

Update in response to comment:

WP doesn't really have an ORM to speak of. It has meta tables (wp_usermeta, wp_postmeta, and wp_commentmeta) to store "extra" information in (this is where new fields are stored for Custom Post Types), but there is none of the very nice lazy-dereferencing you have in a proper ORM.

Although relationships (foreign key, one-to-one, and many-to-many) are not natively supported by WP, there are a handful of plugins that address this issue and one of them that may make this situation palatable for you. I haven't used any of them (yet) so I can't speak for their relative strengths and weaknesses.

10
  • This is a really good find. I'll definitely give it a test run and get back to you. Custom Post Types does not allow for relational mapping? That might be a deal breaker for me.
    – rexposadas
    Commented Jan 26, 2011 at 18:19
  • Thank you for the answer. This pointed me to the right direction.
    – rexposadas
    Commented Jan 27, 2011 at 18:59
  • @Peter Rowell - I came to WordPress from Drupal which inspired Pods; prior to that with ~15 years of relational database design experience. At first I saw WordPress' approach as a negative but after working with it for two years I've come to prefer it in most cases. The reality is it just works better most of the time. Yes, it is not as elegant nor is it as performant or robust for well-defined scenarios but like a dynamic languages vs. statically-typed languages it's more flexible and easier to implement on an ad-hoc basis and that frequently that trumps the more structured alternative. Commented Jan 30, 2011 at 0:13
  • @MikeSchinkel - I'll confess to not having done any specific performance testing of one method versus the other. I think my major complaint is that using the meta tables doesn't fit the way my (admittedly aging) brain works and there is zero syntactic sugar to keep me from rubbing my face in it. I have a project coming up for a large, private collection of lute music (yes, really) and if I have time I'll try doing and A-B comparison of the two in terms of performance. Commented Jan 30, 2011 at 17:44
  • @Peter Rowell - Nice to have you here; finally, someone older than me! :) I think you'll find that performance wise it is slower, but that the sites where it matters that it's slower is a small subset of total sites. Frankly what I would like to see is the ability to start with WordPress' meta approach but transition seamlessly to Pods when it's needed. I'm actually working on a project where that might be viable. BTW, I envy you being about to work in Python, my 2nd favorite language (PHP is 3rd, or worse in my book) but my life path just hasn't taken me there. Commented Jan 31, 2011 at 1:12
0

I know plugin Front-end Editor that allows to edit different things on front-end, but not sure how compatible it is with custom post types.

1
  • it doesn't look like it's compatible with Custom Post Types. I'll give it a try after I take PODS for a spin. Thank You.
    – rexposadas
    Commented Jan 26, 2011 at 18:21

Your Answer

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

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