> The code isn't really semantic, which makes it difficult to get to the
> excerpt text. If you can't differentiate the excerpt from the content
> following by extra spans then there isn't a good way to catch your
> excerpt.

I know, but sadly I have no control on it, it's just like WordPress
put out the code. :/

Anyway, I found a good solution (for good, I mean "better then no
solution", of course)

  $('.hentry > p:first').addClass('excerpt').find('span').replaceWith
('hook');
  var portions = $('.hentry > p:first').html();
  var excerpt = portions.split('hook')[0];
  var notexcerpt = portions.split('hook')[1];
  $('.hentry > p:first').html("<strong>"+excerpt+"</strong>
"+notexcerpt);

Then I styled the excerpt by css with a ".excerpt strong" selector.

I am absolutely sure that jQuery/Javascript ninjas out there will
surely able to refactor it.
So, if someone would like to improve it, it would be really
appreciate.
I know it is a rough and crappy code, but, as said, better then
nothing.

Reply via email to