Conditions
A chatbot’s floating widget appears on a page only when its display conditions match. A chatbot without conditions appears nowhere, which lets you place it with a shortcode alone.
Display conditions
The Conditions page holds groups of conditions. Conditions inside a group
must all match (And); the widget appears when any group matches (Or). Each
condition compares one parameter with a value, using == (is equal to) or
!= (is not equal to).
| Parameter | Matches |
|---|---|
| Admin area | Any screen of the WordPress admin. |
| Admin page | One admin screen, by its file, such as edit.php, or a plugin’s page by its slug, such as woocommerce. |
| Block editor | The block editor. |
| Post type | Posts of one post type. |
| Post ID | One post, by its ID. |
| Post status | Posts with one status. |
| Page template | Pages that use one template. |
| Taxonomy | Archives of one taxonomy. |
| Term | Archives of one term, by its ID or slug. |
| User logged in | Visitors who are signed in. |
| User role | Signed-in users who hold one role, among any others. |
| Home | The blog posts index. |
| Front page | The site’s front page. |
| Page | Static pages. |
| Single | A single post of any post type except pages. |
| Singular | Any single post, page or attachment. |
| Search | Search results. |
| Archive | Any archive. |
| Post type archive | The archive of a post type. |
| Category | Category archives. |
| Tag | Tag archives. |
| Taxonomy archive | Archives of custom taxonomies. |
| Author | Author archives. |
| Date, Year, Month, Day, Time | Date-based archives. |
| Attachment | Attachment pages. |
| Not found | The 404 page. |
Admin area, Block editor, User logged in and the yes-or-no parameters such as
Home take no value: == requires the page to match and != requires it not
to.
A condition whose parameter no longer exists, such as a custom condition whose plugin was removed, never matches, so its group does not match either.
Custom conditions
The sleekAi/chatbot/conditions filter adds parameters to the list. Each
entry has an id, a label and a value that SleekAI computes while the
page renders:
add_filter('sleekAi/chatbot/conditions', function ($conditions) {
$conditions[] = [
'id' => 'isCampaign',
'label' => 'Campaign visitor',
'value' => isset($_GET['utm_campaign']),
];
return $conditions;
});
The editor lists the entry by its label. An id that starts with is or
has makes a yes-or-no condition like the built-in ones; any other compares
its value with the value you enter. The
hooks reference describes the filter’s arguments.
Shortcodes
The Shortcodes card shows the two shortcodes of the chatbot. The first places the floating widget wherever the shortcode is used. A chatbot without conditions shows wherever its shortcode is; a chatbot with conditions shows through its shortcode only on pages where they match, as the floating widget does, and only while the chatbot is published:
The second embeds the chat itself, at full width, in the content:
type takes widget, the default, or chat; embed is another name for
chat.