Support » Plugin: The SEO Framework » Automatic title tags WooCommerce categories

  • Resolved TonyHnor

    (@tonyhnor)


    Hello,

    I try to figure out how to use TSF to create automatic title tags (and descriptions) for a WooCommerce site. There are 50 categories and over 1000 products, so a manual job is not wanted.

    What we want is: The word ‘Buy’ before category/subcategory and Buy before product name and Category.

    Is this possible?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @tonyhnor,

    Yes, that’s possible!

    This filter should do the trick:

    add_filter( 'the_seo_framework_pro_add_title', function( $title ) {	
    	if ( ( function_exists( 'is_product_category' ) && is_product_category() )
    	|| ( ( function_exists( 'is_product' ) && is_product() ) )
    	   ) {
    		$title = 'Buy ' . $title;
    	}
    	
    	return $title;
    } );

    You might wish to disable archive prefix additions globally. If you only wish to remove them on product category pages, then you should also implement this filter:

    add_filter( 'the_seo_framework_use_archive_title_prefix', function( $use, $term ) {
    	
    	if ( ! empty( $term->taxonomy ) && 'product_cat' === $term->taxonomy )
    		$use = false;
    	
    	return $use;
    }, 10, 2 );

    Note that the first snippet isn’t showing signs in the admin area.

    The snippets won’t be needed after we implement the verbose title adjustments. But that’s not being worked on yet.

    Let me know if you require further assistance 🙂 Cheers!

    Thank you, it worked like a charm 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatic title tags WooCommerce categories’ is closed to new replies.