Plugin Directory

Changeset 3232088


Ignore:
Timestamp:
01/30/2025 02:44:06 PM (14 months ago)
Author:
cmarcet
Message:

Fix js and css calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • agent700-ai-chat/trunk/agent700-ai-chat.php

    r3232072 r3232088  
    2020{
    2121    if (get_option('agent700_model') && get_option('agent700_chat_api_url') && get_option('agent700_agent_id')) {
    22         wp_enqueue_style('agent700-styles', plugins_url('styles/styles.css', __FILE__), array(), '1.0.0');
    23         wp_enqueue_script('agent700-chat', plugins_url('scripts/agent-chat.js', __FILE__), array(), '1.0.0', true);
     22        wp_enqueue_style('agent700-styles', home_url('/wp-content/plugins/agent700-ai-chat/styles/styles.css'), array(), '1.1');
     23        wp_enqueue_script('agent700-chat', home_url('/wp-content/plugins/agent700-ai-chat/scripts/agent-chat.js'), array(), '1.1', true);
    2424    }
    2525}
     
    287287}
    288288
    289 // Hook to enqueue scripts and styles in WordPress
    290 add_action('wp_enqueue_scripts', 'agent700_enqueue_assets');
    291 
    292 function agent700_enqueue_assets() {
    293     // Define paths to assets
    294     $plugin_url = plugin_dir_url(__FILE__);
    295 
    296     // Enqueue CSS
    297     wp_enqueue_style('agent700-chat-style', $plugin_url . 'styles/chat-style.css', array(), '1.0.0', 'all');
    298 
    299     // Enqueue JavaScript
    300     wp_enqueue_script('agent700-chat-script', $plugin_url . 'scripts/chat-script.js', array('jquery'), '1.0.0', true);
    301 
    302     // Add inline styles or scripts if necessary
    303     /* $custom_css = "
    304         .chat-agent-icon {
    305             background-color: #f0f0f0;
    306         }
    307     "; */
    308     // wp_add_inline_style('agent700-chat-style', $custom_css);
    309 
    310     $custom_js = "
    311         document.addEventListener('DOMContentLoaded', function() {
    312             console.log('Agent700 script loaded');
    313         });
    314     ";
    315     wp_add_inline_script('agent700-chat-script', $custom_js);
    316 }
    317 
    318289function agent700_chat_icon_field_render() {
    319290    $chat_icon = get_option('agent700_chat_icon');
Note: See TracChangeset for help on using the changeset viewer.