Plugin Directory

Changeset 3428364


Ignore:
Timestamp:
12/27/2025 07:35:25 PM (2 months ago)
Author:
zephyrwp
Message:

Support for Wordpress block theme

Location:
iris-ai
Files:
40 added
3 edited

Legend:

Unmodified
Added
Removed
  • iris-ai/trunk/includes/class-irisai-shortcodes.php

    r3424224 r3428364  
    590590        ?>
    591591        <section id="irisai-results" class="irisai-results" role="region" aria-label="<?php esc_attr_e('Chat results', 'iris-ai'); ?>">
    592             <div class="irisai-card irisai-empty">
    593                 <div class="irisai-empty-icon" aria-hidden="true">
    594                     <?php
    595                     // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    596                     echo self::get_chat_icon_svg();
    597                     ?>
    598                 </div>
    599                 <h3><?php echo esc_html($empty_title); ?></h3>
    600                 <p><?php echo esc_html($empty_message); ?></p>
    601             </div>
    602592        </section>
    603593        <?php
  • iris-ai/trunk/iris-ai.php

    r3424224 r3428364  
    44 * Plugin Name: Iris AI – AI Homepage, Chatbot & Site Assistant
    55 * Description: AI assistant for WordPress with BYO-key or Proxy mode, chat UI, and content tools.
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: Irisai
    88 * Author URI: https://irisai.cloud
     
    2323
    2424// Plugin constants.
    25 define('IRISAI_VERSION', '1.0.3');
     25define('IRISAI_VERSION', '1.0.4');
    2626define('IRISAI_PATH', plugin_dir_path(__FILE__));
    2727define('IRISAI_URL', plugin_dir_url(__FILE__));
     
    396396    wp_send_json_success();
    397397});
     398
     399add_filter( 'render_block', 'irisai_override_theme_hero', 10, 2 );
     400
     401/**
     402 * Replace the IrisAI theme hero block with the live chat output on the front-end.
     403 *
     404 * This ensures the editor preview remains static while the front-end
     405 * renders the interactive assistant.
     406 *
     407 * @since 1.0.4
     408 *
     409 * @param string $block_content Rendered block HTML.
     410 * @param array  $block         Parsed block data.
     411 * @return string
     412 */
     413function irisai_override_theme_hero( $block_content, $block ) {
     414
     415    // Only modify front-end output (not editor, REST, AJAX, feeds, etc).
     416    if ( is_admin() || wp_doing_ajax() || wp_is_json_request() ) {
     417        return $block_content;
     418    }
     419
     420    // Validate expected block structure.
     421    if ( empty( $block['attrs']['metadata']['name'] ) ) {
     422        return $block_content;
     423    }
     424
     425    // Only target the specific theme block.
     426    if ( 'irisaitheme/hero' !== $block['attrs']['metadata']['name'] ) {
     427        return $block_content;
     428    }
     429
     430    // Only render if the shortcode is available.
     431    if ( ! shortcode_exists( 'irisai_chat' ) ) {
     432        return $block_content;
     433    }
     434
     435    // Prevent potential recursive rendering.
     436    remove_filter( 'render_block', 'irisai_override_theme_hero', 10 );
     437
     438    $replacement = do_shortcode( '[irisai_chat]' );
     439
     440    // Restore filter after rendering.
     441    add_filter( 'render_block', 'irisai_override_theme_hero', 10, 2 );
     442
     443    return $replacement;
     444}
  • iris-ai/trunk/readme.txt

    r3424224 r3428364  
    55Requires at least: 5.0
    66Tested up to: 6.9
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    246246
    247247== Changelog ==
     248= 1.0.4 =
     249* Improved compatibility with block themes by safely replacing the theme hero block with the live chat on the front-end while preserving the editor preview
     250* Simplified chat interface by removing unused empty-state card markup to improve performance and reduce unnecessary HTML output
    248251
    249252= 1.0.0 =
     
    269272== Upgrade Notice ==
    270273
     274= 1.0.4 =
     275Improved block theme integration and streamlined the chat interface for better performance and cleaner markup.
     276
    271277= 1.0.0 =
    272278Initial release of IrisAI. Transform your WordPress site with AI-powered chat, vector search, and source citations.
Note: See TracChangeset for help on using the changeset viewer.