PHP Code in Select box
-
Got a fresh install – and this about the 5th time I’ve used this plugin in a commercial project. I LOVE it so far. HOWEVER!
I’ve got a select custom field (dropdown) that is looking up page names & IDs using the following code:
//product pages global $wpdb; $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts where post_type = 'page' and post_status = 'publish' order by post_title ASC"); $i = 0; foreach ($items as $item) { $values[$i] = $item->ID; $valueLabel[$i] = $item->post_title; $i++; }
What appears to be happening is that select box is being populated with the value of each option being set to the ID (as expected) but the DISPLAY (label) is ALSO being set to the ID (not the post_title). I can alter it so it uses the TITLE for both, but this is not ideal – especially if the page names change. I really need to USE the ID but display the Title. This issue was prevalent yesterday when using 3.1.1 (before upgrading to 3.1.2)
I’m using CFT v1.8.6 on this site. Also using 1.8.3 on an older site with WP3.1 which works sweet, so not sure if it’s WP or CFT that is causing this.
Any ideas/thoughts/similar experiences?
- The topic ‘PHP Code in Select box’ is closed to new replies.