Key Features of the Assistant
- Quick launch using
Alt + /directly inside the reader UI. - Chat history is stored in
localStorageand restored with full rendered HTML. - Supports multiple message types:
text,html,code,url. - Renders manga using the same template as the real UI:
template-parts/manga/item-ranking.php. - When user types a free-form question, the assistant finds and displays exactly 1 matching post using Init Live Search (UIkit card).
- Smart button positioning — the assistant button automatically avoids the Continue Reading bar and Sticky Navbar.
- Fully internationalized using
__()andesc_html__(). - REST-first interaction — no page reloads, everything happens inside the modal.
Available Question Categories
- Reading suggestions (trending, similar manga, continue reading, recommendations).
- User account (VIP, EXP, Coin rewards, missions).
- System information (how features work, keyboard shortcuts, etc.).
- Free-form questions — the assistant searches posts/pages and returns the best match.
Unlimited extensibility via filter
Developers can add new questions without modifying the theme. Just push a new item into the filter init_manga_assistant_questions.
// Add a custom question (does not modify core)
add_filter('init_manga_assistant_questions', function ($items) {
$items[] = [
'key' => 'completed_list',
'desc' => __('Show me completed manga', 'init-manga'),
'handler' => 'init_manga_handle_completed_list',
'type' => 'html', // returns HTML output
'category' => 'library',
];
return $items;
});
/**
* Handler: list completed manga
* Uses the correct helper: init_manga_get_completed_manga()
* - No pagination (no_pagination = true)
* - Retrieves the latest completed manga sorted by update time
*/
function init_manga_handle_completed_list($payload) {
$limit = 5;
$res = init_manga_get_completed_manga($limit, 1, true); // correct built-in helper
$posts = isset($res['posts']) ? $res['posts'] : [];
ob_start();
echo '<div class="ima-answer"><strong>' . esc_html__('Completed Manga', 'init-manga') . '</strong>';
if (empty($posts)) {
echo '<p>' . esc_html__('No completed manga found.', 'init-manga') . '</p></div>';
return ['type' => 'html', 'data' => ob_get_clean()];
}
echo '<ul class="uk-list uk-list-bullet uk-margin-small-top">';
foreach ($posts as $p) {
echo '<li><a href="' . esc_url(get_permalink($p)) . '">' . esc_html(get_the_title($p)) . '</a></li>';
}
echo '</ul></div>';
return ['type' => 'html', 'data' => ob_get_clean()];
}
Example: Add a fun question so the assistant compliments the reader each time it’s triggered, with a random compliment matching the manga-reading vibe.
// Register the question: "Compliment me"
add_filter('init_manga_assistant_questions', function ($items) {
$items[] = [
'key' => 'compliment_me',
'desc' => __('Compliment me', 'init-manga'),
'handler' => 'init_manga_handle_compliment_me',
'type' => 'text',
'category' => 'fun',
];
return $items;
});
// Handler: returns a random compliment with a "manga reader" vibe
function init_manga_handle_compliment_me($payload) {
$compliments = [
__('You read so fast that you must have unlocked the Sharingan.', 'init-manga'),
__('Your taste in manga is top-tier, like a main character who already has hidden buffs.', 'init-manga'),
__('Others might skip pages, but you enjoy every panel — respect.', 'init-manga'),
__('Reading like this? You’re definitely the hidden boss of the manga community.', 'init-manga'),
__('Every time you flip a page, your aura level increases.', 'init-manga'),
__('Only people with refined taste like you choose manga this good.', 'init-manga'),
__('If focus were a superpower, you’d be S-rank.', 'init-manga'),
__('Plot twists don’t surprise you — because you are the one controlling the story.', 'init-manga'),
];
return $compliments[array_rand($compliments)];
}
Benefits for readers
- Discover new manga faster.
- No need to search or navigate multiple menus.
- Quick access to account information, rewards, and VIP benefits.
Benefits for site owners
- Increases user engagement and time-on-site.
- Reduces content abandonment (“I don’t know what to read next”).
- Highly flexible logic – you can add new scenarios anytime.
The Virtual Assistant makes manga discovery more interactive and helps users take action instantly.
It is a significant step toward turning Init Manga into a fully guided reading experience rather than just a listing interface.
The assistant does not just answer — it drives navigation and keeps users reading. More pages viewed → higher retention → lower bounce rate.
Comments