0
我從教程採取了以下代碼。這是爲了創建一個短代碼,我可以使用它來添加一個按鈕到我的WordPress的帖子,它直接發送消息給創建帖子的用戶。php - 致命錯誤,類未找到,當添加Wordpress短代碼
我得到了PHP的錯誤 -
Fatal error: Class 'wpchats' not found in /homepages/22/d688271077/htdocs/clickandbuilds/VillaShare/wp-content/themes/listable/functions.php on line 755
請參閱下面的代碼的functions.php和簡碼:
add_shortcode('wpc-link-to-chat', function($atts) {
$a = shortcode_atts(array(
'user_id' => wp_get_current_user()->ID
), $atts);
$user_id = (int) "{$a['user_id']}";
$wpchats = new wpchats;
return $wpchats->get_settings('messages_page') . "?recipient=$user_id";
});
簡碼:
[wpc-link-to-chat user_id="3"]
猜測你的類沒有聲明 - 你在哪裏上課,它包含什麼? – Stender