• Hi all!

    In light of all the censorship moves from some of the social networks, and the privacy changes in others, I’ve decided that having a blog under my own terms as the beginning of my social presence is a must.

    By that account, I’m reordering my presence in some social networks as this:

    Hosted WordPress (manual) —> Twitter (auto) —> FB (auto)

    I’m using WP to Twitter and it works great. I’m basically posting the excerpt of my posts to twitter and that feeds it into FB, all is great. I would like a way to help me count the characters in the excerpt field, so that I can fit in the holy grail of 140 chars.

    I’m quite proficient in PHP / HTML /JS So the thing that I need is pointers. Should I create a full blown plugin just for this silly need? is it better to just hack the admin page?

    Thanks for your input,
    Rubén.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yoast SEO uses the live counter for typing the description meta tag and title into the page.

    get SEO by Yoast, (WordPress SEO)
    instal,
    edit a page,
    look at the bottom at the meta description input field.

    Maybe you can hack it?

    Thread Starter umquat

    (@umquat)

    I installed and removed it in less than 5 mins.

    It felt like killing a mosquito with a photon torpedo! that plugins is soo huge that I wouldn’t know where to begin!

    —————-
    Thanks webs!

    I’ll install it and report back ??

    You’re right,

    I did have a look for you, maybe a starter:

    function updateTitle( force ) {
    	if ( jQuery("#yoast_wpseo_title").val() ) {
    		var title = jQuery("#yoast_wpseo_title").val();
    	} else {
    		var title = wpseo_title_template.replace('%%title%%', jQuery('#title').val() );
    	}
    	if ( title == '' )
    		return;
    
    	title = jQuery('<div />').html(title).text();
    
    	if ( force )
    		jQuery('#yoast_wpseo_title').val( title );
    
    	title = yst_clean( title );
    	title = jQuery.trim( title );
    
    	if ( title.length > 70 ) {
    		var space = title.lastIndexOf( " ", 67 );
    		title = title.substring( 0, space ).concat( ' <strong>...</strong>' );
    	}
    	var len = 70 - title.length;
    	if (len < 0)
    		len = '<span class="wrong">'+len+'</span>';
    	else
    		len = '<span class="good">'+len+'</span>';
    
    	title = boldKeywords( title, false );
    
    	jQuery('#wpseosnippet .title').html( title );
    	jQuery('#yoast_wpseo_title-length').html( len );
    	testFocusKw();
    }

    maybe some minor help concerning your problem:

    jQuery('#yoast_wpseo_title').val( title );
    title = yst_clean( title );
    title = jQuery.trim( title );
    if ( title.length > 70 )
    {
    var space = title.lastIndexOf( " ", 67 );
    title = title.substring( 0, space ).concat( ' <strong>...</strong>' );
    }
    var len = 70 - title.length;
    if (len < 0)
    	len = '<span class="wrong">'+len+'</span>';
    else
    	len = '<span class="good">'+len+'</span>';
    
    jQuery('#yoast_wpseo_title-length').html( len );

    Good Luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show the size in chars of the excerpt field.’ is closed to new replies.