Chatterbox Plugin Uses WordPress Blocks to Show Conversations

Category Image 052

Chatterbox is a new plugin with a fun and creative use for the block editor. It displays chat or text threads using blocks that are styled as conversations. Users can type in a record of a chat, including timestamps, with a live preview in the editor.

Since written conversations are essentially little blocks of text and media, the block editor lends itself nicely to composing and displaying this type of content. The Chatterbox block can be found under Layout Elements in the block inserter. It includes the option to select a style (Inbound, Outbound, or Event) and add a timestamp.

Dave Ryan, a WordPress developer at Bluehost, said he created the plugin in order to test Gutenberg’s Block Context API and borrowed the chat component from Salesforce’s Lightning Design System. He suggested that Chatterbox could be useful for showing demos of chat bots, publishing chat records in news stories, or simply adding an engaging visual display to conversations.

Once the Block Context API matures, Ryan plans to add message background and text colors, message sender with name and avatar, and the ability to override the message sender on a per-message basis for group chats. The next steps beyond that on the roadmap include the following:

  •  Implement Bookends and other SFDS Chat options
  •  Animated chat sequences
  •  Automated animated sequences, using character lengths for timing
  •  Automate hiding of message meta based on adjacent blocks
  •  Message Images
  •  Message Files

Ryan said some of the planned features will rely on new features in the Gutenberg project. Once those have been released he will update Chatterbox to include more customization options. The plugin is available for free on WordPress.org and contributors can find the code on GitHub.

Apple and Google’s Contact Tracing API Expected by April 28th

Featured Imgs 23

Earlier this week European Commissioner Thierry Breton shared an image on Twitter of him having a video conference with Apple CEO Tim Cook. It has been widely reported that during this meeting Cook told the Commissioner that the COVID-19 contact tracing API being co-developed by Apple and Google will be ready for launch on April 28th.

How To Limit WordPress Search Results By Post Type

Featured Imgs 21

There are occasions in which you may want to limit WordPress search results to a specific post type rather than just the default. Your theme may have custom post types that you want to be included in the search, or perhaps you only want to search the custom post type and not posts or pages. This is relatively simple to do without a plugin, which is usually best practice when possible.

UNLIMITED DOWNLOADS: 500,000+ WordPress & Design Assets

Sign up for Envato Elements and get unlimited downloads starting at only $16.50 per month!




 

Open your theme’s functions.php file and copy the following code snippet at the bottom.

function 1wd_searchfilter($query) { 
    if ($query->is_search && !is_admin() ) {
        $query->set('post_type',array('post','page'));
    } 
return $query;
} 
add_filter('pre_get_posts','1wd_searchfilter');

Note the line where it says

$query->set('post_type',array('post','page'));

Change that line where it says ‘post’, ‘page’ to whatever post type you want the search to be filtered through. So, for example, your code would look like this:

function 1wd_searchfilter($query) { 
    if ($query->is_search && !is_admin() ) {
        $query->set('post_type',array('custom_post_type_name_1','custom_post_type_name_2'));
    } 
return $query;
} 
add_filter('pre_get_posts','1wd_searchfilter');

Be sure to change the name of the custom post type to your own.

We hope that helps you next time you need to limit WordPress search results by post type. Be sure to check out our other WordPress tutorials for more useful tips!