Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Yes, but you have to do some footwork: define your dropdown with a SQL query. In your template, convert the selected post ID to the data you need.

    Thread Starter imjoeybrennan

    (@imjoeybrennan)

    Thanks for the response. I have the ID in JavaScript and would like to make a jQuery AJAX call to get details about the post. I’m having trouble tracking down the documentation for retrieving items via AJAX in this manner. Any ideas?

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Oof… honestly, I hate WordPress for stuff like this. The API is clunky at best, and the application architecture obscures everything. Are you wanting to do this inside of the manager or on the front-end? If you want to do it in the manager, what’s wrong with defining a relation field? It basically gives you all that stuff already.

    Thread Starter imjoeybrennan

    (@imjoeybrennan)

    Actually, I’m trying to do this on the front-end. Any suggestions for accomplishing this from that angle?

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    It’s not trivial, unfortunately, and most of that is due to WP’s clunky Ajax stuff. I would break this down:

    1) get comfortable converting a post ID into the post’s data — there’s lots of stuff about this in the CCTM wiki, and there’s lots of WP functions that help do this. This is THE critical skill that underpins 90% of the questions I get, and it’s really nothing to do directly with the CCTM or WP, it’s just data normalization 101 stuff.

    2) practice using WP’s horrifically bad Ajax interface… try mocking up the simplest possible scenario, like retrieving a simple word or something from the Ajax request and inserting it into a div on the calling page. If this doesn’t make you want to abandon WP altogether in favor of a mature application, you are a better man than I. There’s a chapter about this in my book: http://www.amazon.com/WordPress-3-Plugin-Development-Essentials/dp/184951352X

    In a nutshell, though, weigh carefully the eye-candy for the UI because it can make your pages vastly more complex and unmanageable, esp. if the system is as badly architected as WP (imo).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I dynamically pull a selected custom post types custom field’ is closed to new replies.