Forum Replies Created

Viewing 15 replies - 16 through 30 (of 57 total)
  • Thread Starter kazskater99

    (@kazskater99)

    i did all

    Thread Starter kazskater99

    (@kazskater99)

    ya i think so

    Thread Starter kazskater99

    (@kazskater99)

    I did all my code

    Thread Starter kazskater99

    (@kazskater99)

    Notice: Function wp_enqueue_script() was called incorrectly. “wp-editor” script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see?Debugging in WordPress?for more information. (This message was added in version 5.8.0.) in?/home/kaztokyo/www/wordpress/wp-includes/functions.php?on line?6031

    NOT SURE WHAT TO DO THIS PROBLEM ↑

    I want to do this below ↓

    I can not create custom widget cus of wideget problem i am facing not sure how i get. shown NOTICE.

    I can not use widget area for plugin as not safe but i can still use may cause problem.

    AS fas as i know…..

    Thread Starter kazskater99

    (@kazskater99)

    Only my theme I think error show up

    but This message has been while for long time below

    Notice: Function wp_enqueue_script() was called incorrectly. “wp-editor” script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see?Debugging in WordPress?for more information. (This message was added in version 5.8.0.) in?/home/kaztokyo/www/wordpress/wp-includes/functions.php?on line?6031

    Thread Starter kazskater99

    (@kazskater99)

    THOSE CODE IS recently i did even though NOTICE HAS BEEN HERE FOR WHILE.

    Notice: Function wp_enqueue_script() was called incorrectly. “wp-editor” script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see Debugging in WordPress for more information. (This message was added in version 5.8.0.) in /home/kaztokyo/www/wordpress/wp-includes/functions.php on line 6031

    I turned off MAX MEGA MENU too

    Widget area I USED

    I need to fix this but not sure..

    Thread Starter kazskater99

    (@kazskater99)

    // ウィークリーマテリアルデータの取得関数
    function get_weekly_materials_data() {
        // ここでデータを取得するロジックを追加
        $materialsData = [
            [
                'name' => 'Admonition',
                'days' => 'Monday, Thursday',
                'characters' => [
                    ['name' => 'Tighnari', 'image' => 'https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Tighnari.png', 'element' => 'Dendro', 'rarity' => 5],
                    ['name' => 'Traveler (Dendro)', 'image' => 'https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Traveler (Dendro).png', 'element' => 'Dendro', 'rarity' => 5],
                    ['name' => 'Cyno', 'image' => 'https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Cyno.png', 'element' => 'Electro', 'rarity' => 5],
                    ['name' => 'Faruzan', 'image' => 'https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Faruzan.png', 'element' => 'Anemo', 'rarity' => 4],
                    ['name' => 'Candace', 'image' => 'https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Candace.png', 'element' => 'Hydro', 'rarity' => 4],   
                ],
            ],
                 
            // 他のマテリアルデータ...
    
            // 本日のタレントマテリアルソート
            // 今後の追加情報をコメントアウト
            /*
            usort($materialsData, function ($a, $b) {
                // 名前で比較
                return strcmp($a['name'], $b['name']);
            });
            */
    
            // 新しいキャラクターの育成素材の追加情報をコメントアウト
            /*
            $newCharacterMaterials = [
                'name' => 'New Character',
                'days' => 'Tuesday, Friday',
                'characters' => [
                    // 新しいキャラクターの情報
                ],
            ];
            $materialsData[] = $newCharacterMaterials;
            */
        ];
    
        return $materialsData;
    }
    
    // ウィジェットを登録
    function register_weekly_material_schedule_widget() {
        include_once get_template_directory() . '/Weekly_Material_Schedule_Widget.php';
        register_widget('Weekly_Material_Schedule_Widget');
    }
    
    add_action('widgets_init', 'register_weekly_material_schedule_widget');
    
    
    // カスタムスタイルのエンキューを行う関数
    //function Weekly_Material_Schedule_Widget_styles() {
        //$css_file_path = get_template_directory() . '/css/sample.css';
        //$css_last_modified = filemtime($css_file_path);
    
        // キャッシュのバージョンとして最終更新時刻を使用
        //$cache_version = $css_last_modified;
    
        // ターゲットスタイルのハンドル
        //$target_style_handle = 'custom-sample';
    
        // ウィジェットのIDを取得 ウィジェットのIDに置き換える Weekly_Material_Schedule_Widget.php 記載
        //$widget_id = 'weekly-material-schedule'; 
    
        // ウィジェットごとに異なるスタイルをエンキュー 
        //if (is_active_widget(false, false, $widget_id, true)) {
            //wp_enqueue_style($target_style_handle, get_template_directory_uri() . '/css/sample.css', array(), $cache_version);
        //}
    //}
    
    //add_action('wp_enqueue_scripts', 'Weekly_Material_Schedule_Widget_styles');
    <?php
    // Weekly_Material_Schedule_Widget.php
    
    class Weekly_Material_Schedule_Widget extends WP_Widget {
    
        public function __construct() {
            parent::__construct(
                'weekly-material-schedule', // ウィジェットのID
                'Weekly Material Schedule', // ウィジェットのタイトル
                array('description' => 'Display the weekly material farming schedule.') // ウィジェットの説明
            );
        }
    
        // ウィジェットの表示
        public function widget( $args, $instance ) {
            echo $args['before_widget'];
    
            if ( $instance['title'] ) {
                echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
            }
    
            // マスターデータを取得する処理
            $materialsData = get_weekly_materials_data();
    
            // ウィジェットの HTML を表示
            echo '<title>Farmable Today</title>';
            echo '<div class="farming-schedule" id="farmingSchedule"></div>';
    
            ?>
            <!--<script>
                // ブラウザのローカルタイムゾーンで曜日、日付、時間を表示
                function updateDateTime() {
                    const farmingScheduleElement = document.getElementById('farmingSchedule');
                    if (farmingScheduleElement) {
                        const now = new Date();
                        const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' };
                        const localDateTime = now.toLocaleString(undefined, options);
    
                        farmingScheduleElement.innerHTML = `
                            <h2>Farmable Today</h2>
                            <p>Today is ${localDateTime}</p>
                        `;
                    }
                }
    
                // 1秒ごとに更新
                setInterval(updateDateTime, 1000);
    
                // ウィジェット表示時に初回実行
                updateDateTime();
            </script>
    
            <?php
    
            // 名前で比較      
            usort($materialsData, function ($a, $b) {
                return strcmp($a['name'], $b['name']);
            });
    
            $today = date('l'); // 今日の曜日を取得
            $displayedIcons = []; // すでに表示されたアイコンの名前を保持する配列
            $farmingSectionDisplayed = false; // farming-section charactersが表示されたかどうかのフラグ
    
            foreach ($materialsData as $set) {
                if (in_array($today, explode(', ', $set['days']))) {
                    // farming-section charactersがまだ表示されていない場合
                    if (!$farmingSectionDisplayed) {
                        echo "<div class='farming-section characters'>"; // farming-section charactersを開始
                        $farmingSectionDisplayed = true; // フラグを立てて表示済みとする
                        echo "  <div class='farming-list'>"; // farming-listを開始
                    }
    
                    // farming-list-itemの開始
                    echo "    <div class='farming-list-item'>";
                    echo "      <div class='farming-icon-wrapper'>";
                    // キャラクターのタレントレベルに必要なアセンション素材のアイコン(画像)と名前を表示
                    echo "        <img alt='{$set['name']}' class='farming-icon' src='https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Farming/{$set['name']}.png'>";
                    echo "        <p>{$set['name']}</p>"; // farming-iconの名前を表示
                    echo "      </div>";
                    echo "      <div class='farming-characters'>";
    
                    foreach ($set['characters'] as $character) {
                        // キャラクターの名前と画像を表示
                        echo "        <div class='character-info'>";
                        echo "          <a href='/characters/{$character['name']}' class='tierlist-portrait' style='order:-{$character['rarity']}'>";
                        echo "            <img alt='{$character['name']}' class='tierlist-icon rarity-{$character['rarity']}' src='{$character['image']}'>";
                        echo "            <img alt='{$character['element']}' class='tierlist-type' src='https://gamewidth.net/wp-content/themes/Xiaoyu Tekken7/images/genshin/Characters/Element_{$character['element']}.png'>";
                        echo "          </a>";
                        //echo "          <p style='text-align: center;'>{$character['name']}</p>"; // 中央揃えに変更
                        echo "        </div>";
                    }
    
                    echo "      </div>"; // farming-charactersの終了
                    echo "    </div>"; // farming-list-itemの終了
    
                    // 各アセンション素材に対するアイコン名を取得し、重複表示を防ぐために$displayedIconsに追加する
                    $iconKey = $set['name']; // 現在のアセンション素材のアイコン名
                    $displayedIcons[] = $iconKey; // 表示済みのアイコンの配列に追加
                }
            }
    
            if ($farmingSectionDisplayed) {
                // farming-section charactersが表示されている場合
    
                // farming-listの終了
                echo "  </div>"; 
                // farming-section charactersの終了
                echo "</div>";
            }
    
            echo $args['after_widget'];
        }
    
        // ウィジェットの設定フォームを表示
        public function form($instance) {
            // タイトルの取得
            $title = !empty($instance['title']) ? $instance['title'] : esc_html__('New title', 'text_domain');
            ?>
            <p>
                <label for="<?php echo esc_attr($this->get_field_id('title')); ?>">
                    <?php esc_attr_e('Title:', 'text_domain'); ?>
                </label>
                <input
                    class="widefat"
                    id="<?php echo esc_attr($this->get_field_id('title')); ?>"
                    name="<?php echo esc_attr($this->get_field_name('title')); ?>"
                    type="text"
                    value="<?php echo esc_attr($title); ?>">
            </p>
            <?php
        }
    
        // ウィジェットの設定フォームのデータ更新処理
        public function update($new_instance, $old_instance) {
            $instance = array();
            $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
            return $instance;
        }
    }
    ?>
    <script>
        // ユーザーのローカルタイムゾーンに基づいて曜日、日付、時間を取得する関数
        function getLocalDateTime() {
            const now = new Date();
            const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' };
            return now.toLocaleString(undefined, options);
        }
    
        // ブラウザのローカルタイムゾーンで曜日、日付、時間を表示
        function updateDateTime() {
            document.getElementById('farmingSchedule').innerHTML = `
                <h2>Farmable Today</h2>
                <p>Today is ${getLocalDateTime()}</p>
            `;
        }
    
        // 1秒ごとに更新
        setInterval(updateDateTime, 1000);
    </script>
    

    // Weekly_Material_Schedule_Widget.php function.php

    I delated all above NO MORE ERROR show up.

    Thread Starter kazskater99

    (@kazskater99)

    NO at all i chnaged Twenty-Nine

    Thread Starter kazskater99

    (@kazskater99)

    its reloading something in widget too

    Thread Starter kazskater99

    (@kazskater99)

    in widget area block editor

    Thread Starter kazskater99

    (@kazskater99)

    thank you for feedback not sure where tro loock erros in browser..

    • This reply was modified 1 year ago by James Huff. Reason: link moved to proper field
    Thread Starter kazskater99

    (@kazskater99)

    I made widget.php to show contents i did

    later on wince my blocker is still shown NOTICE not enquate with class editor togther. somehow show up warning message above.

    so i turn backed to classic editor but i can not use widget any more to edit..

    Thread Starter kazskater99

    (@kazskater99)

    // functions.php
    
    // ウィークリーマテリアルデータの取得関数
    function get_weekly_materials_data() {
        // キャラクターのマテリアルデータの連想配列
        // マスターデータ...
    
        // キャラクターのデータを連想配列で定義
        $materialsData = [                   
            [
                'name' => 'Cloudseam Scale',
            ],
            // 他のデータ...
        ];
    
        error_log('Weekly Materials Data: ' . print_r($materialsData, true)); // デバッグメッセージ
    
        return $materialsData;
    }
    
    // ウィジェットに渡すデータの取得関数
    function get_materials_data() {
        $data = get_weekly_materials_data();
    
        error_log('Materials Data: ' . print_r($data, true)); // デバッグメッセージ
    
        return $data;
    }
    
    // ウィジェットエリアの登録
    if (function_exists('register_sidebar')) {
        register_sidebar(array(
            'name' => esc_html__('Weekly Material Schedule Widget Area', 'text_domain'),
            'id' => 'weekly-material-schedule-widget-area',
            'description' => esc_html__('Add widgets here to display the weekly material schedule.', 'text_domain'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h2 class="widget-title">',
            'after_title' => '</h2>',
        ));
    }
    <?php //Weekly_Material_Schedule_Widget.php?>
    
    <?php
    class Weekly_Material_Schedule_Widget extends WP_Widget {
    
        public function __construct() {
            parent::__construct(
                'weekly-material-schedule', // ウィジェットのID
                'Weekly Material Schedule', // ウィジェットのタイトル
                array('description' => 'Display the weekly material farming schedule.') // ウィジェットの説明
            );
        }
    
       // ウィジェットの表示
    public function widget( $args, $instance ) {
        echo $args['before_widget'];
        
        if ( $instance['title'] ) {
            echo $args['before_title'] . $instance['title'] . $args['after_title'];
        }
    
        // マスターデータを取得する処理
        $materialsData = get_materials_data();
    
        // ウィジェットの HTML を表示
        ?>
        <div class="farming-schedule">
            <!-- テスト用の表示 -->
            <p>This is a test HTML. If you see this, the widget is working.</p>
    
            <!-- キャラクターのアセンション素材 -->
            <?php
            // キャラクターのアセンション素材に関する HTML 表示コードを追加する
            // 例として、$materialsData の内容を表示するコードを記述
            foreach ($materialsData as $material) {
                echo "<p>{$material['name']}</p>";
            }
            ?>
        </div>
        <?php
    
        echo $args['after_widget'];
    }
    
    
    // ウィジェットを登録
    function register_weekly_material_schedule_widget() {
        register_widget('Weekly_Material_Schedule_Widget');
    }
    
    add_action('widgets_init', 'register_weekly_material_schedule_widget');
    

    NO shown in Wideget crated HTML <p>{$material[‘name’]}</p>

    NO Error shown in dub file at all…

    HELP ME

    Thread Starter kazskater99

    (@kazskater99)

    // ウィークリーマテリアルデータの取得関数
    function get_weekly_materials_data() {
        // キャラクターのマテリアルデータの連想配列
        // マスターデータ...
    
        // キャラクターのデータを連想配列で定義
        $materialsData = [                   
            [
                'name' => 'Cloudseam Scale',
            ],
            // 他のデータ...
        ];
    
        return $materialsData;
    }
    
    // ウィジェットに渡すデータの取得関数
    function get_materials_data() {
        return get_weekly_materials_data();
    }
    
    // ウィジェットエリアの登録
    if (function_exists('register_sidebar')) {
        register_sidebar(array(
            'name' => esc_html__('Weekly Material Schedule Widget Area', 'text_domain'),
            'id' => 'weekly-material-schedule-widget-area',
            'description' => esc_html__('Add widgets here to display the weekly material schedule.', 'text_domain'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h2 class="widget-title">',
            'after_title' => '</h2>',
        ));
    }
    <?php 
    
    class Weekly_Material_Schedule_Widget extends WP_Widget {
    
        public function __construct() {
            parent::__construct(
                'weekly-material-schedule', // ウィジェットのID
                'Weekly Material Schedule', // ウィジェットのタイトル
                array('description' => 'Display the weekly material farming schedule.') // ウィジェットの説明
            );
        }
    
        // ウィジェットの設定フォームを表示
        public function form($instance) {
            // タイトルの取得
            $title = !empty($instance['title']) ? $instance['title'] : esc_html__('New title', 'text_domain');
            ?>
            <p>
                <label for="<?php echo esc_attr($this->get_field_id('title')); ?>">
                    <?php esc_attr_e('Title:', 'text_domain'); ?>
                </label>
                <input
                    class="widefat"
                    id="<?php echo esc_attr($this->get_field_id('title')); ?>"
                    name="<?php echo esc_attr($this->get_field_name('title')); ?>"
                    type="text"
                    value="<?php echo esc_attr($title); ?>">
            </p>
            <?php
        }
    
        // ウィジェットの表示
        public function widget($args, $instance) {
            echo $args['before_widget'];
    
            if (!empty($instance['title'])) {
                echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
            }
    
            // マスターデータを取得する処理を追加
            $materialsData = $this->get_materials_data();
    
            // ウィジェットの HTML を表示
            if (is_wp_error($materialsData)) {
                // エラーメッセージを出力
                echo 'Error retrieving materials data: ' . $materialsData->get_error_message();
            } else {
                // データが正常に取得された場合
                echo 'Materials data retrieved successfully.';
                $this->display_widget_html($materialsData);
            }
    
            echo $args['after_widget'];
        }
    
        private function get_materials_data() {
            // テーマの functions.php で定義した関数を使ってマスターデータを取得
            $materialsData = get_weekly_materials_data();
            return $materialsData;
        }
    
        private function display_widget_html($materialsData) {
            ?>
            <div class="farming-schedule">
                <!-- テスト用の表示 -->
                <p>This is a test HTML. If you see this, the widget is working.</p>
    
                <!-- キャラクターのアセンション素材 -->
                <?php
                // キャラクターのアセンション素材に関する HTML 表示コードを追加する
                // 例として、$materialsData の内容を表示するコードを記述
                foreach ($materialsData as $material) {
                    echo "<p>{$material['name']}</p>"; // 仮の表示例
                }
                ?>
            </div>
            <?php
        }
    }
    
    // ウィジェットを登録
    function register_weekly_material_schedule_widget() {
        register_widget('Weekly_Material_Schedule_Widget');
    }
    
    add_action('widgets_init', 'register_weekly_material_schedule_widget');
    

    NO shown in Wideget crated HTML <p>{$material[‘name’]}</p>

    NO Error shown in dub file at all…

    HELP ME

    Thread Starter kazskater99

    (@kazskater99)

    i changed url

Viewing 15 replies - 16 through 30 (of 57 total)