• Resolved RussiaCristiana

    (@russiacristiana)


    Hi
    I’m not a programmer so I’ve tried to search for the string “the_title()” in the search result template (theme: Verbosa), in order to change it with “relevanssi_the_title()“, as in your guide, but I haven’t found the string (is it “entry-title”?).
    Thank you in advance.
    I’m posting the code of the Search.php file:

    <?php
    
    /**
    
     * The template for displaying Search results pages.
    
     *
    
     * @package Verbosa
    
     */
    
    get_header(); ?>
    
    <div id="container" class="<?php verbosa_get_layout_class(); ?>">
    
    <?php verbosa_header_section() ?>
    
    <main id="main" class="main">
    
    <?php cryout_before_content_hook(); ?>
    
    <?php if ( have_posts() ) : ?>
    
    <header class="content-search pad-container" <?php cryout_schema_microdata( 'element' ); ?>>
    
    <?php get_search_form(); ?>
    
    <h1 class="page-title" <?php cryout_schema_microdata( 'entry-title' ); ?>>
    
    <?php printf( __( 'Search Results for: %s', 'verbosa' ), '<strong>' . get_search_query() . '</strong>' ); ?>
    
    </h1>
    
    </header>
    
    <?php cryout_breadcrumbs_hook(); ?>
    
    <div id="content-masonry"  <?php cryout_schema_microdata( 'blog' ); ?>>
    
    <?php /* Start the Loop */
    
    while ( have_posts() ) : the_post();
    
    get_template_part( 'content/content', get_post_format() );
    
    endwhile;
    
    ?>
    
    </div><!--content-masonry-->
    
    <?php
    
    verbosa_pagination();
    
    else :
    
    get_template_part( 'content/content', 'notfound' );
    
    ?><div id="content-masonry"></div><?php
    
    endif; ?>
    
    <?php cryout_after_content_hook(); ?>
    
    </main><!-- #main -->
    
    </div><!-- #primary -->
    
    <?php get_footer(); ?>

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari

    (@msaari)

    It’s in a different file: the post contents are displayed using the template /content/content.php. You’ll find it there.

    Thread Starter RussiaCristiana

    (@russiacristiana)

    Thank you but if I add “relevanssi_” to “the_title” in /content.php, it crashes the results (= no results).
    We’d “only” like to highlight the word(s) in search results.
    Any suggestions?

    Plugin Author Mikko Saari

    (@msaari)

    Can you please show me the template? That change should not crash anything, or cause results to disappear, so that would suggest some kind of an error.

    An easy solution is to ignore the highlights in the titles – I mean people focus on titles anyway – and just use the highlighting in the excerpts, where it’s more useful to bring out the matching content.

    Thread Starter RussiaCristiana

    (@russiacristiana)

    Sure – You are so kind!
    Here is the code content/content.php:

    <?php
    
    /**
    
     * The default template for displaying content
    
     *
    
     * @package Verbosa
    
     */
    
    $verbosas = cryout_get_option( array('verbosa_excerptarchive', 'verbosa_excerptsticky', 'verbosa_excerpthome') );
    
    ?><?php cryout_before_article_hook(); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); cryout_schema_microdata('blogpost'); ?>>
    
    <?php cryout_featured_hook(); ?>
    
    <header class="entry-header">
    
    <?php cryout_post_title_hook(); ?>
    
    <?php cryout_meta_format_hook(); ?>
    
    <?php if ( is_sticky() ) { ?> <span class="entry-format"><i class="icon-sticky"></i></span> <?php } ?>
    
    <?php the_title( sprintf( '<h2 class="entry-title"' . cryout_schema_microdata( 'entry-title', 0 )  . '>
    
    <a href="%s" ' . cryout_schema_microdata( 'mainEntityOfPage', 0 ) . ' rel="bookmark">',
    
    esc_url( get_permalink() ) ),
    
    '</a></h2>' );
    
    ?>
    
    <div class="entry-meta">
    
    <?php cryout_post_meta_hook(); ?>
    
    </div><!-- .entry-meta -->
    
    </header><!-- .entry-header -->
    
    <?php cryout_before_inner_hook();
    
    $verbosa_excerpt_mode = 'excerpt'; // default
    
    if ( $verbosas['verbosa_excerptarchive'] == "full" ) { $verbosa_excerpt_mode = 'content'; }
    
    if ( is_sticky() && $verbosas['verbosa_excerptsticky'] == "full" ) { $verbosa_excerpt_mode = 'content'; }
    
    if ( $verbosas['verbosa_excerpthome'] == "full" && ! is_archive() && ! is_search() ) { $verbosa_excerpt_mode = 'content'; }
    
    if ( false != get_post_format() ) { $verbosa_excerpt_mode = 'content'; }
    
    switch ( $verbosa_excerpt_mode ) {
    
    case 'content': ?>
    
    <div class="entry-content" <?php cryout_schema_microdata( 'entry-content' ); ?>>
    
    <?php the_content(); ?>
    
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'verbosa' ), 'after' => '</div>' ) ); ?>
    
    </div><!-- .entry-content -->
    
    <?php break;
    
    case 'excerpt':
    
    default: ?>
    
    <div class="entry-summary" <?php cryout_schema_microdata( 'entry-summary' ); ?>>
    
    <?php the_excerpt(); ?>
    
    </div><!-- .entry-summary -->
    
    <footer class="post-continue-container">
    
    <?php cryout_post_excerpt_hook(); ?>
    
    </footer>
    
    <?php break;
    
    }; ?>
    
    <?php cryout_after_inner_hook();  ?>
    
    </article><!-- #post-<?php the_ID(); ?> -->
    
    <?php cryout_after_article_hook(); ?>


    Plugin Author Mikko Saari

    (@msaari)

    There’s nothing unusual in the template. Using relevanssi_the_title() instead of the_title() should work without problems. I installed Verbosa on my test site, and I got the title highlights working with that simple change.

    Thread Starter RussiaCristiana

    (@russiacristiana)

    you are right, it does work.
    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘relevanssi the_title() ? HELP!’ is closed to new replies.