0
我已經有了PHP,可以根據名爲'ecpt_shrating'的自定義字段中的數據將圖像添加到Wordpress帖子。根據自定義字段數據添加圖像
當放在帖子PHP中它只是顯示原始代碼,儘管圖像是可見的。
位新手,對不起,任何幫助非常感謝。
$value = get_post_meta(get_the_ID(), 'ecpt_shrating', true);
if($value == hell) { <img src='/wp-content/uploads/2013/02/image1.gif'>
} elseif($value == poor) { <img src='/wp-content/uploads/2013/02/image2.gif'>
} elseif($value == nice) { <img src='/wp-content/uploads/2013/02/image3.gif'>
} elseif($value == angelic) { <img src='/wp-content/uploads/2013/02/image4.gif'>
} elseif($value == heaven) { <img src='/wp-content/uploads/2013/02/image5.gif'>
}
是地獄,可憐的,可愛的,天使,天堂應該是字符串?如果他們是你需要顯式封裝引號 – rnirnber 2013-02-11 22:21:02