Display text if title in archive has specific word

You may use string comparison. I could illustrate a simple example code.

It is assumed that the user with the following knowledge/experience

  • PHP – understand what is variables, static value
  • WordPress templates and how to modify them

There are many ways to test string such as

  • php string comparison strpos() (simple)
  • php regular expression preg_match() (required more test and knowledge)

This example shows the simple way to check the title.

Assumed you are talking about templates so the following code will be put in tag archive template. eg. tag.php

<?php 
// assumed you are doing it in a loop
if ( have_posts() ) :
    while ( have_posts() ) : the_post();
        $str_search = strpos( $post->title, 'Banna' ); // assumed when your $post-title contains 'Banna'

        if( $str_search !== false && $str_search >= 0 ) {
            echo 'cool fruits';
        }

    endwhile;
endif;

?>
  • A friendly reminder: make sure you read, research and test rather than just copy and paste and hope this answer resolve all the questions and troubles instantly without spending further effort.