• Resolved addbrads

    (@addbrads)


    Hi,

    I am thinking of using the short description field to insert information about delivery and or freebies etc instead a short description.

    The issue I see with this is the plugin automatically takes the meta description from the short description if one is inserted.

    It takes it from the main description of no short description is present.

    How do I stop this and make TSF act like no short description is present ?

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

    (@cybr)

    Hi there!

    Unfortunately, there’s no easy way to disable the functionality. This feature helps almost all users making use of that field, and serving for corner cases shouldn’t be dealt with because the inner workings are too complicated. Such changes result in bugs.

    So, I recommend filling in a custom meta description. The plugin will then use this custom meta description.

    Thread Starter addbrads

    (@addbrads)

    Ah ok,

    Guess I’ll park that idea then. I have nearly 5000 products so manually adding to the meta description will take far too long.

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi again 🙂

    This might help. It basically does the same as the plugin do internally, but then overwrites the “post_excerpt” when it’s found to be used.

    add_filter( 'the_seo_framework_fetched_description_excerpt', function( $excerpt, $post_id ) {
    
    	$post = get_post( $post_id );
    	if ( ! empty( $post->post_excerpt ) ) {
    		$excerpt = $post->post_content;
    
    		if ( $excerpt ) {
    			$tsf = the_seo_framework();
    			$excerpt = $tsf->strip_newline_urls( $excerpt );
    			$excerpt = $tsf->strip_paragraph_urls( $excerpt );
    			$excerpt = $tsf->s_excerpt_raw( $excerpt );
    		}
    	}
    
    	return $excerpt;
    }, 10, 2 );
    

    The big problem with introducing this snippet is that you’ll have to maintain it. So, using it is entirely up to you.

    Another issue is that it doesn’t know whether it’s overwriting a post or archive excerpt unless you introduce some heavy processing. So, some categories may use content from products as a description; this is rare, however.

    • This reply was modified 7 years, 3 months ago by Sybre Waaijer. Reason: Removing failing check in snippet
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Short Description’ is closed to new replies.