• Resolved Stefan Pejcic

    (@stefanpejcic)


    Hi, great plugin guys, I’ve replaced yoast plugin on all of my sites wih slim seo.

    Just One question, the current title is generated as Post Title – Site Title and the meta description is taken from the actual content.

    I have a movie reviews site where users submit movie name and the site then creates a new post for each movie and takes data from imdb (description, rating, actors, cover image etc.)

    let’s say I want to add “Review of” before each post title and in meta description for each post, which file should I be editing?

    I hope you can help me out with this one. thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi Stefan,

    Thanks for using Slim SEO.

    To add the “Review of” before each post title and meta description, please add the following code to your theme’s functions.php file:

    // For meta title.
    add_filter( 'pre_get_document_title', function( $title ) {
        if ( is_singlular( 'your-movie-post-type' ) ) {
            $title = "Review of $title";
        }
        return $title;
    } );
    
    // For meta description.
    add_filter( 'slim_seo_meta_description', function ( $description ) {
        if ( is_singular( 'your-movie-post-type' ) ) {
            $description = "Review of $description";
        }
        return $description;
    } );
    Thread Starter Stefan Pejcic

    (@stefanpejcic)

    Hi Anh, thanks for the feedback.

    I couldn’t get it to work for the title,
    $title = “Review of $title”; simply replaces the title with “Review of”

    Description works perfectly:

    // For meta description.
    add_filter( 'slim_seo_meta_description', function ( $description ) {
        if(is_single() && get_post_type()=='post' && get_post_format()=='video'){
            $description = "Review of $description";
        }
        return $description;
    } );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom text before each title’ is closed to new replies.