Trim the_excerpt
-
Does anyone know how I might get rid of breaks/newlines from the_excerpt? I want to configure a digg badge for each of my posts, and the code looks like this:
<script type="text/javascript"> digg_url = '<?php the_permalink(); ?>'; digg_title = '<?php the_title(); ?>'; digg_bodytext = '<?php the_excerpt(); ?>'; </script> <script src="https://digg.com/tools/diggthis.js" type="text/javascript"></script>
The only problem, however, is that
the_excerpt
for some posts returns a string with a new line. Thus, the javascript thinks that there is an error, an unterminated string literal. I trieddigg_bodytext = '<?php trim(the_excerpt()); ?>';
but that didn’t work.Any suggestions? (And sorry if this is the wrong section…I wasn’t sure if it was a “hack” or something “advanced” – it’s not really any of them.)
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Trim the_excerpt’ is closed to new replies.