0
我想看看他是否正確地做這個代碼來開發一個自定義的簡短聯繫人表單想爲我的網站創建。WordPress的簡碼Issus v3
我看過wp codex想要使用類,所以我想出了這個代碼,如果這將工作。
<?php
class MyPlugin {
// Conact Form shortcode
public static function allb_contact_form($atts, $content = " " ) {
//[contact_form]
//get the attribute_escape
$atts = shortcode_atts(
array(),
$atts,
'contact_form'
);
//return HTML
ob_start();
include 'lib/inc/thmeplates/contact-form.php';
return ob_get_clean();
}
}
add_shortcode('contact_form', array($this , 'allb_contact_form'));
但它不會給我說的錯誤消息。有個人告訴我把add_shortcode('contact_form', array($this , 'allb_contact_form'));
放在代碼的外面。
@Yivi它的工作謝謝你隊友 –