function jitozu_snow_dome_shortcode() { // 1. WordPressから「作品」データを取得 $args = array('post_type' => 'works_dome', 'posts_per_page' => -1); $query = new WP_Query($args); $works_data = array(); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $works_data[] = array( 'title' => get_the_title(), 'category' => get_field('work_cat'), 'date' => get_field('work_date'), 'img' => get_field('work_img'), 'link' => get_field('work_link'), ); } } wp_reset_postdata(); // 2. JSファイルを読み込み、データを渡す // ※ main.js はテーマフォルダ内の /js/main.js に置く前提です wp_enqueue_script('three-js', 'https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.min.js', array(), null, true); wp_enqueue_script('snow-dome-main', get_template_directory_uri() . '/js/main.js', array('three-js'), '1.0', true); wp_localize_script('snow-dome-main', 'wpData', array('designWorks' => $works_data)); // 3. HTMLの「箱」を出力 ob_start(); ?>

Warning: Cannot modify header information - headers already sent by (output started at /home/tomatodog8/www/wp-content/themes/jin/functions.php:1265) in /home/tomatodog8/www/wp-includes/pluggable.php on line 1435

Warning: Cannot modify header information - headers already sent by (output started at /home/tomatodog8/www/wp-content/themes/jin/functions.php:1265) in /home/tomatodog8/www/wp-includes/pluggable.php on line 1438

Warning: Cannot modify header information - headers already sent by (output started at /home/tomatodog8/www/wp-content/themes/jin/functions.php:1265) in /home/tomatodog8/www/wp-includes/pluggable.php on line 1435

Warning: Cannot modify header information - headers already sent by (output started at /home/tomatodog8/www/wp-content/themes/jin/functions.php:1265) in /home/tomatodog8/www/wp-includes/pluggable.php on line 1438