• 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter BrenFM

    (@brenfm)

    HAH! Just downgraded to v1.8.3 on this install and it works sweet again. DEFINITELY an issue with this plugin. Please, please, please review this bug.

    AGREE

    Using the following code to post content by page_title

    <?php
    function wt_get_ID_by_page_name($page_title)
    {
    	global $wpdb;
    	$page_title_id = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE post_title = '%".$page_title."%' AND post_status='publish'");
    	return $page_title_id;
    }
    ?>

    Worked fine yesterday. But I upgraded to 3.1.2 today and now it’s without function.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Code in Select box’ is closed to new replies.