• Resolved cnk001

    (@cnk001)


    Hello, I’m using a review theme from themeforest. When I enable Yoast SEO I don’t have page numbers in titles on my custom taxonomies.

    I have pages/taxonomies: ‘review-tag’ and ‘review-category’.

    In my functions.php I found this code:

    
    if( !function_exists('reviews_wp_title') ){
    function reviews_wp_title( $title, $sep ) {
    	global $paged, $page, $reviews_slugs;
    
    	if ( is_feed() ){
    		return $title;
    	}
    
    	if( !empty( $_GET[$reviews_slugs['keyword']] ) ){
    		$title = $_GET[$reviews_slugs['keyword']]." $sep ".$title;
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-category']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-category']], 'review-category' );
    		$title = $term->name." $sep ".$title;
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-tag']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-tag']], 'review-tag' );
    		$title = $term->name." $sep ".$title;
    	}
    
    	return $title;
    }
    add_filter( 'wp_title', 'reviews_wp_title', 10, 2 );
    }
    
    if( !function_exists('reviews_wp_title_new') ){
    function reviews_wp_title_new( $title ) {
    	global $reviews_slugs;
    	if( !empty( $_GET[$reviews_slugs['keyword']] ) ){
    		$title['title'] = $_GET[$reviews_slugs['keyword']]." - ".$title['title'];
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-category']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-category']], 'review-category' );
    		$title['title'] = $term->name." - ".$title['title'];
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-tag']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-tag']], 'review-tag' );
    		$title['title'] = $term->name." - ".$title['title'];
    	}
    
        return $title;
    }
    add_filter( 'document_title_parts', 'reviews_wp_title_new', 10, 1 );
    }
    
    if( !function_exists('reviews_wp_seo_title') ){
    function reviews_wp_seo_title( $title ) {
    	global $reviews_slugs;
    	if( !empty( $_GET[$reviews_slugs['keyword']] ) ){
    		$title = $_GET[$reviews_slugs['keyword']]." - ".$title;
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-category']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-category']], 'review-category' );
    		$title = $term->name." - ".$title;
    	}
    
    	if( !empty( $_GET[$reviews_slugs['review-tag']] ) ){
    		$term = get_term_by( 'slug', $_GET[$reviews_slugs['review-tag']], 'review-tag' );
    		$title = $term->name." - ".$title;
    	}
    
        return $title;
    }
    add_filter( 'wpseo_title', 'reviews_wp_seo_title' );
    }

    When I disable Yoast everything works.
    How can I fix it?

    • This topic was modified 7 years ago by cnk001.

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

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page number on custom pages/taxonomies’ is closed to new replies.