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

    (@msaari)

    Getting title highlights requires changes in code. See the first example here. Also, instead of get_the_title() you need to use relevanssi_get_the_title to see the highlights.

    Thread Starter BuenaPalomeno

    (@buenapalomeno)

    Hello,

    Thanks for your response. I was wondering what am I doing wrong.

    This is my code:

    add_filter( 'genesis_post_title_output', 'child_post_title_output', 15 );
    
    function child_post_title_output( $title ) {
        global $post;
    
        // change h2 to h1 depending if you have a search page title or not
        if ( function_exists( 'relevanssi_get_the_title' ) ) {
            $title = sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">%s</a></h2>', esc_url( get_permalink() ), apply_filters( 'genesis_post_title_text', relevanssi_get_the_title( $post->ID ) ) );
    
        }
        return $title;
    }

    But titles on search is still not highlighted. But once I remove the $post->ID from function relavanssi_get_the_title() titles are highlighted but with errors:
    “Warning: Missing argument 1 for relevanssi_get_the_title(), called in /home/groupo10/public_html/wp-content/themes/lifestyle-pro/functions.php on line 171 and defined in /home/groupo10/public_html/wp-content/plugins/relevanssi/lib/common.php on line 692”

    why is that?

    Thanks!

    Plugin Author Mikko Saari

    (@msaari)

    The error is caused by a missing argument, and the argument is missing because you removed it.

    Why the $post->ID doesn’t work, I don’t know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Highlight Post Title’ is closed to new replies.