• Related to my earlier post about getting recent posts into the frontpage while WP is installed in a subfolder, I am trying to get a custom field accessed through the code (an image filename) to no avail. Can someone tell me what is wrong with this?

    $news=$wpdb->get_results(“SELECT ‘ID’,’post_title’,’post_content’ FROM $wpdb->posts WHERE ‘post_type’=\”post\” AND ‘post_status’=\”publish\” ORDER BY post_date DESC LIMIT 3″);

    foreach($news as $np){
    $image=$wpdb->get_results(“SELECT ‘meta_value’ FROM $wpdb->postmeta WHERE ‘post_id’=$np->ID AND meta_key=\”featured_home_img\””);

    echo “Image is [$image->meta_value]”;
    }

    $image->meta_value always comes back with an empty result. I checked the SQL query in phpMyAdmin and it executed just fine (with the value for “featured_home_img” returned). I checked the postmeta table and the relevant posts all have a meta_key called “featured_home_img”, so no problem there.

    Please help me solve this. I am going bonkers again.

Viewing 1 replies (of 1 total)
  • Thread Starter bakhlawa

    (@bakhlawa)

    <bump>

    Still need help with this one. I just need to know how to get to custom field values for a post on the homepage (root folder of domain) when the WP blog sits in a subfolder.

Viewing 1 replies (of 1 total)

The topic ‘Integration issue – can’t read table value’ is closed to new replies.