Ver.1.0.8
同一ページに複数表示可能になった。
【内容】
同一ページ複数表示可能
コンテンツ自体を $.each() にすることで、複数混在に対応。
jQuery(function ($) {
$(document).ready(function (e) {
var me = $(".psforms-container"),
::
})
})
jQuery(function ($) {
$(document).ready(function (e) {
$(".psforms-container").each(function(){
var me = $(this),
::
})
})
})
テンプレートの “id” 内容変更
ラッパーの “id” 属性を一意の文字列に変更。ただし、まだ何も活用していない。
<?php // ユニークキーに変更
$id = uniqid(self::PLUGIN_ID.'_',false);
“contact” の “links” の順序変更
テンプレート “contact” での “links” 内の “main.min.js” は必ずjQueryの後に組み込まないと、実行されない。
"links": {
"jquicss": { ... },
"jquijs": { ... },
"style": { ... },
"main": { ... }
},
"links": {
"style": { ... },
"main": { ... },
"jquicss": { ... },
"jquijs": { ... },
},
不要なコードの削除
当初 myScript() で style.min.css, main.min.js を組み込んでいたが、設定ファイルの “links” での組み込みで不要になっていた。
add_action('wp_enqueue_scripts', [$this, 'myScripts']);
function myScripts(){
global $post;
if( is_object($post) and has_shortcode($post->post_content, self::PLUGIN_ID) ){
wp_enqueue_style('psforms-style', plugins_url('style.min.css', __FILE__ ), [], self::VERSION);
wp_enqueue_script('psforms-main', plugins_url('main.min.js', __FILE__ ), ['jquery'], self::VERSION);
}
}
private function fld($e=[]){
switch($e['type']){
default:
$ret = '<tr><th>'.$e['title'].'</h><td><input type="text" name="'.$e['name'].'"</td></tr>';
break;
}
return $ret;
}
開発サイトURL変更
https://parallel-soft.com/psforms/ に変更